소스 검색

修改支付订单导入和显示和修改模版样式

hj123456 4 년 전
부모
커밋
3e072100fe

+ 8 - 7
kmall-admin/src/main/java/com/kmall/admin/controller/MallPaymentOrderDataController.java

@@ -1,8 +1,5 @@
 package com.kmall.admin.controller;
 
-import java.text.ParseException;
-import java.util.*;
-
 import com.kmall.admin.entity.MallPaymentOrderDataEntity;
 import com.kmall.admin.service.MallPaymentOrderDataService;
 import com.kmall.admin.utils.ParamUtils;
@@ -21,7 +18,11 @@ 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;
 
 /**
  * 支付订单表Controller
@@ -139,17 +140,17 @@ public class MallPaymentOrderDataController {
             }else if (Dict.payFlag.item_alipay.getItem().equals(payFlag)){
                 excelUtil.readExcel(JxlsXmlTemplateName.ALI_PAYMENT_ORDER_DTO_List, beans, file.getInputStream());
             }
-        }catch (Exception e){
+        }catch (Exception e) {
             e.printStackTrace();
             return R.error("导入失败!");
         }
         try {
-            mall2PaymentOrderDataService.uploadExcel(list,payFlag);
+            mall2PaymentOrderDataService.saveUploadExcel(list, payFlag);
         } catch (Exception e) {
             e.printStackTrace();
             return R.error(e.getMessage());
         }
-        return R.ok();
+        return R.ok("导入成功!");
     }
 
     /**

+ 3 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/MallPaymentOrderDataDao.java

@@ -19,4 +19,7 @@ public interface MallPaymentOrderDataDao extends BaseDao<MallPaymentOrderDataEnt
     int saveData(MallPaymentOrderDataEntity mallPaymentOrderData);
 
     List<MallPaymentOrderDataEntity> queryListData(Map<String, Object> params);
+
+    List<MallPaymentOrderDataEntity> queryListTimeAndTnoData(Map<String, Object> params);
+
 }

+ 5 - 5
kmall-admin/src/main/java/com/kmall/admin/entity/MallPaymentOrderDataEntity.java

@@ -170,7 +170,7 @@ public class MallPaymentOrderDataEntity implements Serializable {
      */
     private Date tstm;
 
-    private String id;
+    private String aliid;
 
     /**
      * 设置:编号
@@ -676,11 +676,11 @@ public class MallPaymentOrderDataEntity implements Serializable {
         this.applyRefundAmount = applyRefundAmount;
     }
 
-    public String getId() {
-        return id;
+    public String getAliid() {
+        return aliid;
     }
 
-    public void setId(String id) {
-        this.id = id;
+    public void setAliid(String aliid) {
+        this.aliid = aliid;
     }
 }

+ 7 - 2
kmall-admin/src/main/java/com/kmall/admin/service/MallPaymentOrderDataService.java

@@ -73,12 +73,17 @@ public interface MallPaymentOrderDataService {
     int deleteBatch(Integer[]payOrderIds);
 
     /**
-     * 根据excel表单导入添加入库 -- 支付宝和微信账单
+     * 根据excel表单导入添加入库 -- 支付宝和微信流水账单
      * @param list
      * @param payFlag
      * @return
      */
-    int uploadExcel(List<MallPaymentOrderDataEntity> list,String payFlag);
+    int saveUploadExcel(List<MallPaymentOrderDataEntity> list,String payFlag);
 
+    /**
+     * 导出支付宝、微信流水账单
+     * @param map
+     * @param response
+     */
     void exportDataFormatList(Map<String, Object> map, HttpServletResponse response);
 }

+ 44 - 13
kmall-admin/src/main/java/com/kmall/admin/service/impl/MallPaymentOrderDataServiceImpl.java

@@ -2,24 +2,19 @@ package com.kmall.admin.service.impl;
 
 import com.kmall.admin.dao.MallPaymentOrderDataDao;
 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 org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.apache.poi.ss.usermodel.Row;
-import org.apache.poi.ss.usermodel.Sheet;
-import org.apache.poi.ss.usermodel.Workbook;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.servlet.http.HttpServletResponse;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
 import java.util.*;
 
 
@@ -71,19 +66,55 @@ public class MallPaymentOrderDataServiceImpl implements MallPaymentOrderDataServ
     }
 
     @Override
-    public int uploadExcel(List<MallPaymentOrderDataEntity> list,String payFlag) {
+    public int saveUploadExcel(List<MallPaymentOrderDataEntity> list,String payFlag) {
+        List<MallPaymentOrderDataEntity> insertList = new ArrayList<>();
         SysUserEntity sysUserEntity = ShiroUtils.getUserEntity();
         if (list!=null && list.size()>0) {
             for (MallPaymentOrderDataEntity  paymentOrderDataEntity : list) {
-                MallPaymentOrderDataEntity orderDataEntity = new MallPaymentOrderDataEntity();
+
+
+                //判断wx要进行截取
+                if (Dict.payFlag.item_weixin.getItem().equals(payFlag)) {
+                    try {
+                        paymentOrderDataEntity.setTimeStr(paymentOrderDataEntity.getTimeStr().split("`")[1].toString());
+                        paymentOrderDataEntity.setTransactionOrder(paymentOrderDataEntity.getTransactionOrder().split("`")[1].toString());
+                        paymentOrderDataEntity.setOutTradeNo(paymentOrderDataEntity.getOutTradeNo().split("`")[1].toString());
+                        paymentOrderDataEntity.setAmountOrder(paymentOrderDataEntity.getAmountOrder().split("`")[1].toString());
+                        paymentOrderDataEntity.setMerchantName(paymentOrderDataEntity.getMerchantName().split("`")[1].toString());
+                        paymentOrderDataEntity.setPayMoney(paymentOrderDataEntity.getPayMoney().split("`")[1].toString());
+                        paymentOrderDataEntity.setRefundMoney(paymentOrderDataEntity.getRefundMoney().split("`")[1].toString());
+                        paymentOrderDataEntity.setRefundId(paymentOrderDataEntity.getRefundId().split("`")[1].toString());
+                        paymentOrderDataEntity.setCashCoupon(paymentOrderDataEntity.getCashCoupon().split("`")[1].toString());
+                        paymentOrderDataEntity.setMerRefundNumber(paymentOrderDataEntity.getMerRefundNumber().split("`")[1].toString());
+                        paymentOrderDataEntity.setRefundRechargpCoupon(paymentOrderDataEntity.getRefundRechargpCoupon().split("`")[1].toString());
+                        paymentOrderDataEntity.setFeeCharge(paymentOrderDataEntity.getFeeCharge().split("`")[1].toString());
+                        paymentOrderDataEntity.setRate(paymentOrderDataEntity.getRate().split("`")[1].toString());
+                        paymentOrderDataEntity.setApplyRefundAmount(paymentOrderDataEntity.getApplyRefundAmount().split("`")[1].toString());
+                    } catch (Exception e) {
+                        throw new RRException("导入的数据不是微信账单!");
+                    }
+                }
+                String outTradeNo = paymentOrderDataEntity.getOutTradeNo();
+                String timeStr = paymentOrderDataEntity.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("数据有重复,请检查导入数据的正确性!");
+                }
                 paymentOrderDataEntity.setCreaterSn(sysUserEntity.getUsername());
                 paymentOrderDataEntity.setCreateTime(new Date());
                 paymentOrderDataEntity.setPayFlag(payFlag);
-                BeanUtils.copyProperties(paymentOrderDataEntity,orderDataEntity);
-                mall2PaymentOrderDataDao.saveData(orderDataEntity);
+                insertList.add(paymentOrderDataEntity);
             }
+            mall2PaymentOrderDataDao.saveBatch(insertList);
+        }else {
+            throw new RRException("导入数据信息为空,请看模版再重新导入!");
         }
-        return 0;
+        return 1;
     }
 
     @Override

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

@@ -5,7 +5,7 @@
         <loop startRow="1" endRow="1" items="MallPaymentOrderDataEntityList" var="MallPaymentOrderDataEntity"
               varType="com.kmall.admin.entity.MallPaymentOrderDataEntity">
             <section startRow="1" endRow="1">
-                <mapping row="1" col="0">MallPaymentOrderDataEntity.id</mapping>
+                <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>
@@ -27,7 +27,7 @@
             </section>
             <loopbreakcondition>
                 <rowcheck offset="0">
-                    <cellcheck offset="0">end</cellcheck>
+                    <cellcheck offset="0"></cellcheck>
                 </rowcheck>
             </loopbreakcondition>
         </loop>

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

@@ -30,7 +30,7 @@
             </section>
             <loopbreakcondition>
                 <rowcheck offset="0">
-                    <cellcheck offset="0">end</cellcheck>
+                    <cellcheck offset="0"></cellcheck>
                 </rowcheck>
             </loopbreakcondition>
         </loop>

+ 279 - 0
kmall-admin/src/main/resources/mybatis/mapper/MallPaymentOrderDataDao.xml

@@ -208,6 +208,57 @@
 			AND time_str <![CDATA[ <  ]]> #{endTime}
 		</if>
 	</select>
+
+	<select id="queryListTimeAndTnoData" resultType="com.kmall.admin.entity.MallPaymentOrderDataEntity">
+		select
+		`pay_order_id`,
+		`merchant_name`,
+		`out_trade_no`,
+		`pay_money`,
+		`refund_money`,
+		`pay_type`,
+		`payment_type`,
+		`transaction_order`,
+		`time_str`,
+		`attach`,
+		`transaction_status`,
+		`currency_type`,
+		`Amount_order`,
+		`refund_id`,
+		`mer_refund_number`,
+		`refund_type`,
+		`refund_status`,
+		`apply_refund_amount`,
+		`cash_coupon`,
+		`refund_rechargp_coupon`,
+		`fee_charge`,
+		`rate`,
+		`pay_flag`,
+		`serial_number`,
+		`opposite_account`,
+		`other_name`,
+		`bank_order`,
+		`business_basic_order`,
+		`business_billing_source`,
+		`business_order`,
+		`business_description`,
+		`remark`,
+		`rate_remark`,
+		`payment_notes`,
+		`creater_sn`,
+		`create_time`,
+		`moder_sn`,
+		`mod_time`,
+		`tstm`
+		from mall2_payment_order_data
+		WHERE 1=1
+		<if test="outTradeNo != null and outTradeNo != ''">
+			AND out_trade_no = #{outTradeNo}
+		</if>
+		<if test="timeStr != null and timeStr != ''">
+			AND time_str = #{timeStr}
+		</if>
+	</select>
 	
  	<select id="queryTotal" resultType="int">
 		select count(*) from mall2_payment_order_data
@@ -215,6 +266,15 @@
         <if test="name != null and name.trim() != ''">
             AND name LIKE concat('%',#{name},'%')
         </if>
+		<if test="payFlag != null and payFlag.trim() != ''">
+			AND pay_flag = #{payFlag}
+		</if>
+		<if test="startTime != null and startTime != ''">
+			AND time_str <![CDATA[ >  ]]> #{startTime}
+		</if>
+		<if test="endTime != null and endTime != ''">
+			AND time_str <![CDATA[ <  ]]> #{endTime}
+		</if>
 	</select>
 	 
 	<insert id="save" parameterType="com.kmall.admin.entity.MallPaymentOrderDataEntity" useGeneratedKeys="true" keyProperty="payOrderId">
@@ -293,6 +353,225 @@
 			#{createTime}
 	</insert>
 
+	<insert id="saveBatch"  parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
+		<foreach collection ="list" item="item" index= "index" separator =";">
+			insert into mall2_payment_order_data
+			<trim prefix="(" suffix=")" suffixOverrides="," >
+				<if test="item.merchantName != null" >
+					`merchant_name`,
+				</if>
+				<if test="item.outTradeNo != null" >
+					`out_trade_no`,
+				</if>
+				<if test="item.payMoney != null" >
+					`pay_money`,
+				</if>
+				<if test="item.refundMoney != null" >
+					`refund_money`,
+				</if>
+				<if test="item.payType != null" >
+					`pay_type`,
+				</if>
+				<if test="item.paymentType != null" >
+					`payment_type`,
+				</if>
+				<if test="item.transactionOrder != null" >
+					`transaction_order`,
+				</if>
+				<if test="item.timeStr != null" >
+					`time_str`,
+				</if>
+				<if test="item.attach != null" >
+					`attach`,
+				</if>
+				<if test="item.transactionStatus != null" >
+					`transaction_status`,
+				</if>
+				<if test="item.currencyType != null" >
+					`currency_type`,
+				</if>
+				<if test="item.amountOrder != null" >
+					`Amount_order`,
+				</if>
+				<if test="item.refundId != null" >
+					`refund_id`,
+				</if>
+				<if test="item.merRefundNumber != null" >
+					`mer_refund_number`,
+				</if>
+				<if test="item.refundType != null" >
+					`refund_type`,
+				</if>
+				<if test="item.refundStatus != null" >
+					`refund_status`,
+				</if>
+				<if test="item.applyRefundAmount != null" >
+					`apply_refund_amount`,
+				</if>
+				<if test="item.cashCoupon != null" >
+					`cash_coupon`,
+				</if>
+				<if test="item.refundRechargpCoupon != null" >
+					`refund_rechargp_coupon`,
+				</if>
+				<if test="item.feeCharge != null" >
+					`fee_charge`,
+				</if>
+				<if test="item.rate != null" >
+					`rate`,
+				</if>
+				<if test="item.payFlag != null" >
+					`pay_flag`,
+				</if>
+				<if test="item.serialNumber != null" >
+					`serial_number`,
+				</if>
+				<if test="item.oppositeAccount != null" >
+					`opposite_account`,
+				</if>
+				<if test="item.otherName != null" >
+					`other_name`,
+				</if>
+				<if test="item.bankOrder != null" >
+					`bank_order`,
+				</if>
+				<if test="item.businessBasicOrder != null" >
+					`business_basic_order`,
+				</if>
+				<if test="item.businessBillingSource != null" >
+					`business_billing_source`,
+				</if>
+				<if test="item.businessOrder != null" >
+					`business_order`,
+				</if>
+				<if test="item.businessDescription != null" >
+					`business_description`,
+				</if>
+				<if test="item.remark != null" >
+					`remark`,
+				</if>
+				<if test="item.rateRemark != null" >
+					`rate_remark`,
+				</if>
+				<if test="item.paymentNotes != null" >
+					`payment_notes`,
+				</if>
+				<if test="item.createrSn != null" >
+					`creater_sn`,
+				</if>
+				<if test="item.createTime != null" >
+					`create_time`,
+				</if>
+			</trim>
+			<trim prefix="values (" suffix=")" suffixOverrides="," >
+				<if test="item.merchantName != null" >
+					#{item.merchantName},
+				</if>
+				<if test="item.outTradeNo != null" >
+					#{item.outTradeNo},
+				</if>
+				<if test="item.payMoney != null" >
+					#{item.payMoney},
+				</if>
+				<if test="item.refundMoney != null" >
+					#{item.refundMoney},
+				</if>
+				<if test="item.payType != null" >
+					#{item.payType},
+				</if>
+				<if test="item.paymentType != null" >
+					#{item.paymentType},
+				</if>
+				<if test="item.transactionOrder != null" >
+					#{item.transactionOrder},
+				</if>
+				<if test="item.timeStr != null" >
+					#{item.timeStr},
+				</if>
+				<if test="item.attach != null" >
+					#{item.attach},
+				</if>
+				<if test="item.transactionStatus != null" >
+					#{item.transactionStatus},
+				</if>
+				<if test="item.currencyType != null" >
+					#{item.currencyType},
+				</if>
+				<if test="item.amountOrder != null" >
+					#{item.amountOrder},
+				</if>
+				<if test="item.refundId != null" >
+					#{item.refundId},
+				</if>
+				<if test="item.merRefundNumber != null" >
+					#{item.merRefundNumber},
+				</if>
+				<if test="item.refundType != null" >
+					#{item.refundType},
+				</if>
+				<if test="item.refundStatus != null" >
+					#{item.refundStatus},
+				</if>
+				<if test="item.applyRefundAmount != null" >
+					#{item.applyRefundAmount},
+				</if>
+				<if test="item.cashCoupon != null" >
+					#{item.cashCoupon},
+				</if>
+				<if test="item.refundRechargpCoupon != null" >
+					#{item.refundRechargpCoupon},
+				</if>
+				<if test="item.feeCharge != null" >
+					#{item.feeCharge},
+				</if>
+				<if test="item.rate != null" >
+					#{item.rate},
+				</if>
+				<if test="item.payFlag != null" >
+					#{item.payFlag},
+				</if>
+				<if test="item.serialNumber != null" >
+					#{item.serialNumber},
+				</if>
+				<if test="item.oppositeAccount != null" >
+					#{item.oppositeAccount},
+				</if>
+				<if test="item.otherName != null" >
+					#{item.otherName},
+				</if>
+				<if test="item.bankOrder != null" >
+					#{item.bankOrder},
+				</if>
+				<if test="item.businessBasicOrder != null" >
+					#{item.businessBasicOrder},
+				</if>
+				<if test="item.businessBillingSource != null" >
+					#{item.businessBillingSource},
+				</if>
+				<if test="item.businessOrder != null" >
+					#{item.businessOrder},
+				</if>
+				<if test="item.businessDescription != null" >
+					#{item.businessDescription},
+				</if>
+				<if test="item.remark != null" >
+					#{item.remark},
+				</if>
+				<if test="item.rateRemark != null" >
+					#{item.rateRemark},
+				</if>
+				<if test="item.paymentNotes != null" >
+					#{item.paymentNotes},
+				</if>
+				<if test="item.createrSn != null" >
+					#{item.createrSn},
+				</if>
+				<if test="item.createTime != null" >
+					#{item.createTime},
+				</if>
+			</trim>
+		</foreach>
+	</insert>
 	<insert id="saveData" parameterType="com.kmall.admin.entity.MallPaymentOrderDataEntity" useGeneratedKeys="true" keyProperty="payOrderId">
 		insert into mall2_payment_order_data
 		<trim prefix="(" suffix=")" suffixOverrides="," >

+ 1 - 1
kmall-admin/src/main/webapp/WEB-INF/page/shop/mallpaymentorderdata.html

@@ -329,7 +329,7 @@
                 </div>
                 <div class="modal-footer">
                     <button type="button" id="cancel" class="btn btn-default" data-dismiss="modal">取消</button>
-                    <button type="button" class="btn btn-primary" @click="uploadFormSubmit">确认</button>
+                    <button type="button" class="btn btn-primary" id="btn-smubit" @click="uploadFormSubmit">确认</button>
                 </div>
             </div>
         </div>

+ 16 - 11
kmall-admin/src/main/webapp/js/shop/mallpaymentorderdata.js

@@ -4,15 +4,17 @@ $(function () {
         datatype: "json",
         colModel: [
 			{label: '编号', name: 'payOrderId', index: 'pay_order_id', key: true, hidden: true},
-			{label: '商名称', name: 'merchantName', index: 'merchant_name', width: 80},
+			{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: 'payType', index: 'pay_type', width: 80},
-			{label: '付款类型', name: 'paymentType', index: 'payment_type', width: 80},
-			{label: '交易订单号', name: 'transactionOrder', index: 'transaction_order', width: 80},
-			{label: '时间', name: 'timeStr', index: 'time_str', width: 80},
 			{label: '支付方式', name: 'payFlag', index: 'pay_flag', 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');
+				}},
 			{
 				label: '操作', width: 180, sortable: false,align: 'center',
 				formatter: function (value, col, row) {
@@ -232,14 +234,11 @@ let vm = new Vue({
 			$('#salesDataFormDiv').modal('show');
 		},
 		uploadFormSubmit: function () {
-			debugger;
+
 			if(!vm.q.payFlag){
 				alert("请选择支付类型");
 				return ;
 			}
-			// if(!vm.checkTime){
-			// 	alert("请选择核对时间");
-			// }
 			let fileName = $('#file').val();
 			if(!fileName){
 				alert("选择上传文件");
@@ -254,7 +253,10 @@ let vm = new Vue({
 			let formData = new FormData();
 			formData.append("file", document.getElementById("file").files[0]);
 			formData.append("payFlag", vm.q.payFlag);
-
+			// 显示loading提示
+			dialogLoading(true);
+			var stamp = document.getElementById("btn-smubit");
+			stamp = true;
 			$.ajax({
 				async: false,
 				type: "POST",
@@ -264,13 +266,16 @@ let vm = new Vue({
 				contentType: false,
 				processData: false,
 				success: function (data) {
+					dialogLoading(false);
 					if(data.code==0){
 						$('#cancel').click();
-						alert('导入成功', function (index) {
+						alert(data.msg, function (index) {
 							$("#jqGrid").trigger("reloadGrid");
 						});
+						stamp = false;
 					}else{
 						alert(data.msg);
+						stamp = false;
 					}
 				}
 			});

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