|
|
@@ -5,14 +5,12 @@ import com.fs.hisStore.domain.FsStorePaymentScrm;
|
|
|
import com.fs.hisStore.param.FsStorePaymentParam;
|
|
|
import com.fs.hisStore.param.FsStoreScanPaymentStatParam;
|
|
|
import com.fs.hisStore.param.FsStoreStatisticsParam;
|
|
|
-import com.fs.hisStore.vo.FsStorePaymentStatisticsVO;
|
|
|
-import com.fs.hisStore.vo.FsStorePaymentVO;
|
|
|
-import com.fs.hisStore.vo.FsStoreScanPaymentStatDetailsVo;
|
|
|
-import com.fs.hisStore.vo.FsStoreScanPaymentStatVo;
|
|
|
+import com.fs.hisStore.vo.*;
|
|
|
import org.apache.ibatis.annotations.Param;
|
|
|
import org.apache.ibatis.annotations.Select;
|
|
|
import org.apache.ibatis.annotations.Update;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -142,6 +140,61 @@ public interface FsStorePaymentScrmMapper
|
|
|
"</script>"})
|
|
|
List<FsStorePaymentVO> selectFsStorePaymentListQuery(@Param("maps") FsStorePaymentParam fsStorePayment);
|
|
|
|
|
|
+ @Select({"<script> " +
|
|
|
+ "select SUM(CASE WHEN p.status IN (1, -1) AND p.pay_money IS NOT NULL THEN p.pay_money ELSE 0 END) AS totalPaymentAmount, SUM(CASE WHEN p.status = '-1' AND p.refund_audit_status = '2' AND refund_money IS NOT NULL THEN p.refund_money ELSE 0 END) AS totalRefundAmount from fs_store_payment_scrm p left join company_user cu on p.company_user_id=cu.user_id left join fs_user u on u.user_id=p.user_id left join company_dept d on d.dept_id=p.dept_id left join company c on c.company_id=p.company_id left join fs_store_order_scrm o on o.id=p.order_id " +
|
|
|
+ "where 1=1 " +
|
|
|
+ "<if test = 'maps.payCode != null and maps.payCode !=\"\" '> " +
|
|
|
+ "and p.pay_code like CONCAT('%',#{maps.payCode},'%') " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test = 'maps.orderCode != null and maps.orderCode !=\"\" '> " +
|
|
|
+ "and o.order_code like CONCAT('%',#{maps.orderCode},'%') " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test = 'maps.tradeNo != null and maps.tradeNo !=\"\" '> " +
|
|
|
+ "and p.trade_no like CONCAT('%',#{maps.tradeNo},'%') " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test = 'maps.bankSerialNo != null and maps.bankSerialNo !=\"\" '> " +
|
|
|
+ "and p.bank_serial_no like CONCAT('%',#{maps.bankSerialNo},'%') " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test = 'maps.mobile != null and maps.mobile !=\"\" '> " +
|
|
|
+ "and u.phone like CONCAT('%',#{maps.mobile},'%') " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test = 'maps.status != null '> " +
|
|
|
+ "and p.status =#{maps.status} " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test = 'maps.businessType != null '> " +
|
|
|
+ "and p.business_type =#{maps.businessType} " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test = 'maps.companyId != null '> " +
|
|
|
+ "and p.company_id =#{maps.companyId} " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test = 'maps.params != null and maps.params != \"\" '> " +
|
|
|
+ "<if test = 'maps.params.beginTime != null and maps.params.beginTime != \"\" '> " +
|
|
|
+ " AND date_format(p.pay_time,'%y%m%d') >= date_format(#{maps.params.beginTime},'%y%m%d') " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test = 'maps.params.endTime != null and maps.params.endTime != \"\" '> " +
|
|
|
+ " AND date_format(p.pay_time,'%y%m%d') <= date_format(#{maps.params.endTime},'%y%m%d') " +
|
|
|
+ "</if>" +
|
|
|
+ "</if>" +
|
|
|
+ "<if test = 'maps.refundBeginTime != null and maps.refundBeginTime != \"\" '> " +
|
|
|
+ "and DATE_FORMAT(p.refund_time,'%y%m%d') >= date_format(#{maps.refundBeginTime},'%y%m%d') " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test = 'maps.refundEndTime != null and maps.refundEndTime != \"\" '> " +
|
|
|
+ " AND date_format(p.refund_time,'%y%m%d') <= date_format(#{maps.refundEndTime},'%y%m%d') " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test = 'maps.bankTransactionId != null and maps.bankTransactionId !=\"\" '> " +
|
|
|
+ "and p.bank_transaction_id like CONCAT('%',#{maps.bankTransactionId},'%') " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test = 'maps.companyUserNickName != null and maps.companyUserNickName !=\"\" '> " +
|
|
|
+ "and cu.nick_name like CONCAT('%',#{maps.companyUserNickName},'%') " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test = 'maps.createTimeList != null '> " +
|
|
|
+ " AND date_format(p.create_time,'%y%m%d') >= date_format(#{maps.createTimeList[0]},'%y%m%d') " +
|
|
|
+ " AND date_format(p.create_time,'%y%m%d') <= date_format(#{maps.createTimeList[1]},'%y%m%d') " +
|
|
|
+ "</if>" +
|
|
|
+ " order by p.payment_id desc "+
|
|
|
+ "</script>"})
|
|
|
+ FsStorePaymentAmountVO calculateTotalAmount(@Param("maps") FsStorePaymentParam fsStorePayment);
|
|
|
+
|
|
|
|
|
|
@Select({"<script> " +
|
|
|
"select p.*,o.order_code,fsp.title, c.company_name,u.phone as user_phone,cu.nick_name as company_user_nick_name,cu.user_name as company_user_name " +
|