| @@ -219,7 +219,7 @@ public class WxMicroPayController extends BaseController { | |||||
| @ApiImplicitParam(name = "date", value = "日期yyyy-MM-dd", dataType = "string", paramType = "query"), | @ApiImplicitParam(name = "date", value = "日期yyyy-MM-dd", dataType = "string", paramType = "query"), | ||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query",required = true), | @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query",required = true), | ||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query",required = true)}) | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query",required = true)}) | ||||
| public ResultData listUnverified(String date, Integer pageNum, Integer pageSize) { | |||||
| public ResultData listMicroPay(String date, Integer pageNum, Integer pageSize) { | |||||
| return wxOrderService.microPayListOnDateAsPage(getUser().getId(), EnumOrderType.MICROPAY.getCode(), date, pageNum, pageSize); | return wxOrderService.microPayListOnDateAsPage(getUser().getId(), EnumOrderType.MICROPAY.getCode(), date, pageNum, pageSize); | ||||
| } | } | ||||
| @@ -0,0 +1,124 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import com.iformall.domain.po.WxOrder; | |||||
| import java.util.List; | |||||
| public class WxOrderPayVo extends WxOrder { | |||||
| /**发券商户信息*/ | |||||
| /**商户名**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户名",name="merchantName") | |||||
| private String merchantName; | |||||
| /**b端用户姓名**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="b端用户姓名",name="bUserName") | |||||
| private String bUserName; | |||||
| /**b端用户手机号**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="b端用户手机号",name="bUserPhone") | |||||
| private String bUserPhone; | |||||
| /**c用户绑定的手机号**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="用户绑定的手机号",name="cUserPhone") | |||||
| private String cUserPhone; | |||||
| public String getMerchantName() { | |||||
| return merchantName; | |||||
| } | |||||
| public void setMerchantName(String merchantName) { | |||||
| this.merchantName = merchantName; | |||||
| } | |||||
| public String getbUserName() { | |||||
| return bUserName; | |||||
| } | |||||
| public void setbUserName(String bUserName) { | |||||
| this.bUserName = bUserName; | |||||
| } | |||||
| public String getbUserPhone() { | |||||
| return bUserPhone; | |||||
| } | |||||
| public void setbUserPhone(String bUserPhone) { | |||||
| this.bUserPhone = bUserPhone; | |||||
| } | |||||
| public String getcUserPhone() { | |||||
| return cUserPhone; | |||||
| } | |||||
| public void setcUserPhone(String cUserPhone) { | |||||
| this.cUserPhone = cUserPhone; | |||||
| } | |||||
| public static enum Field | |||||
| { | |||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||||
| ,OrderNumber_ASC("`order_number` ASC"),OrderNumber_DESC("`order_number` DESC") | |||||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||||
| ,CUserId_ASC("`c_user_id` ASC"),CUserId_DESC("`c_user_id` DESC") | |||||
| ,MerchantId_ASC("`merchant_id` ASC"),MerchantId_DESC("`merchant_id` DESC") | |||||
| ,BUserId_ASC("`b_user_id` ASC"),BUserId_DESC("`b_user_id` DESC") | |||||
| ,CouponId_ASC("`coupon_id` ASC"),CouponId_DESC("`coupon_id` DESC") | |||||
| ,PaymentType_ASC("`payment_type` ASC"),PaymentType_DESC("`payment_type` DESC") | |||||
| ,Payment_ASC("`payment` ASC"),Payment_DESC("`payment` DESC") | |||||
| ,PaymentTime_ASC("`payment_time` ASC"),PaymentTime_DESC("`payment_time` DESC") | |||||
| ,OrderStatus_ASC("`order_status` ASC"),OrderStatus_DESC("`order_status` DESC") | |||||
| ,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC") | |||||
| ,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC") | |||||
| ,Detail_ASC("`detail` ASC"),Detail_DESC("`detail` DESC") | |||||
| ; | |||||
| private String value; | |||||
| Field(String value){ | |||||
| this.value = value; | |||||
| } | |||||
| public String getValue() { | |||||
| return value; | |||||
| } | |||||
| public void setCol(String value) { | |||||
| this.value = value; | |||||
| } | |||||
| @Override | |||||
| public String toString() { | |||||
| return this.getValue(); | |||||
| } | |||||
| } | |||||
| public void setSortColumns(WxOrder.Field... fields) | |||||
| { | |||||
| if (fields == null || fields.length == 0) { | |||||
| return; | |||||
| } | |||||
| for (int k = 0; k < fields.length; k++) { | |||||
| if (fields[k] == null) { | |||||
| return; | |||||
| } | |||||
| } | |||||
| StringBuilder sb = new StringBuilder(fields[0].toString()); | |||||
| for (int k = 1; k < fields.length; k++) { | |||||
| sb.append(","); | |||||
| sb.append(fields[k].toString()); | |||||
| } | |||||
| this.sortColumns = sb.toString(); | |||||
| } | |||||
| public void setSortColumns(String sortColumns) | |||||
| { | |||||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||||
| return; | |||||
| } | |||||
| if (sortColumns.contains(",")) { | |||||
| String[] cols = sortColumns.split(","); | |||||
| List<WxOrder.Field> fList = new java.util.ArrayList(); | |||||
| for (int k = 0; k < cols.length; k++) { | |||||
| fList.add(WxOrder.Field.valueOf(cols[k])); | |||||
| } | |||||
| this.setSortColumns(fList.toArray(new WxOrder.Field[fList.size()])); | |||||
| } else { | |||||
| this.setSortColumns(WxOrder.Field.valueOf(sortColumns)); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -4,6 +4,7 @@ import java.util.*; | |||||
| import com.iformall.common.CommonMapper; | import com.iformall.common.CommonMapper; | ||||
| import com.iformall.domain.vo.WxOrderCVo; | import com.iformall.domain.vo.WxOrderCVo; | ||||
| import com.iformall.domain.po.WxOrder; | import com.iformall.domain.po.WxOrder; | ||||
| import com.iformall.domain.vo.WxOrderPayVo; | |||||
| public interface WxOrderMapper extends CommonMapper<WxOrder, Long> { | public interface WxOrderMapper extends CommonMapper<WxOrder, Long> { | ||||
| @@ -19,6 +20,6 @@ public interface WxOrderMapper extends CommonMapper<WxOrder, Long> { | |||||
| WxOrderCVo selectDetailOfCUser(WxOrder wxOrder); | WxOrderCVo selectDetailOfCUser(WxOrder wxOrder); | ||||
| Map dayMicroPayAmountList(Map dateMap); | Map dayMicroPayAmountList(Map dateMap); | ||||
| List<WxOrder> findListOfMicroPayOrderByDate(Map dateMap); | |||||
| List<WxOrderPayVo> findListOfMicroPayOrderByDate(Map dateMap); | |||||
| } | } | ||||
| @@ -7,6 +7,7 @@ import com.iformall.common.IdWorker; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.vo.WxOrderCVo; | import com.iformall.domain.vo.WxOrderCVo; | ||||
| import com.iformall.domain.vo.WxOrderPayVo; | |||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| @@ -134,7 +135,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| Map resultMap = new HashMap(); | Map resultMap = new HashMap(); | ||||
| if (pageIndex == null || pageSize == null) { | if (pageIndex == null || pageSize == null) { | ||||
| List<WxOrder> list; | |||||
| List<WxOrderPayVo> list; | |||||
| list = wxOrderMapper.findListOfMicroPayOrderByDate(dateMap); | list = wxOrderMapper.findListOfMicroPayOrderByDate(dateMap); | ||||
| logger.info("find " + list.size() + " order from " + startDate + " to " + new Date()); | logger.info("find " + list.size() + " order from " + startDate + " to " + new Date()); | ||||
| int total_price = 0; | int total_price = 0; | ||||
| @@ -239,7 +239,7 @@ | |||||
| </select> | </select> | ||||
| <select id="dayMicroPayAmountList" parameterType="map" resultType="map"> | <select id="dayMicroPayAmountList" parameterType="map" resultType="map"> | ||||
| select count(*) as count, sum(payment) as total_price | |||||
| select count(*) as count, IFNULL(sum(payment), 0) as total_price | |||||
| from wx_order | from wx_order | ||||
| where `type` = 1 and `order_status` = 1 | where `type` = 1 and `order_status` = 1 | ||||
| <if test=" null != tenantId "> | <if test=" null != tenantId "> | ||||
| @@ -266,27 +266,59 @@ | |||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| <select id="findListOfMicroPayOrderByDate" parameterType="map" resultMap="BaseResultMap"> | |||||
| <resultMap id="PayVoResultMap" type="com.iformall.domain.vo.WxOrderPayVo"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="order_number" jdbcType="BIGINT" property="orderNumber"/> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||||
| <result column="c_user_id" jdbcType="BIGINT" property="cUserId"/> | |||||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId"/> | |||||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId"/> | |||||
| <result column="type" jdbcType="TINYINT" property="type"/> | |||||
| <result column="b_user_id" jdbcType="BIGINT" property="bUserId"/> | |||||
| <result column="payment_type" jdbcType="INTEGER" property="paymentType"/> | |||||
| <result column="payment" jdbcType="INTEGER" property="payment"/> | |||||
| <result column="payment_time" jdbcType="TIMESTAMP" property="paymentTime"/> | |||||
| <result column="order_status" jdbcType="INTEGER" property="orderStatus"/> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||||
| <result column="detail" jdbcType="VARCHAR" property="detail"/> | |||||
| <result column="merchant_name" jdbcType="VARCHAR" property="merchantName" /> | |||||
| <result column="name" jdbcType="VARCHAR" property="bUserName" /> | |||||
| <result column="bphone" jdbcType="VARCHAR" property="bUserPhone" /> | |||||
| <result column="phone" jdbcType="VARCHAR" property="cUserPhone" /> | |||||
| </resultMap> | |||||
| <sql id="allPayOrderColumns"> | |||||
| o.`id`,o.`order_number`,o.`tenant_id`,o.`c_user_id`,o.`merchant_id`,o.`coupon_id`,o.`type`,o.`b_user_id`, | |||||
| o.`payment_type`,o.`payment`,o.`payment_time`,o.`order_status`,o.`create_date`,o.`update_date`,o.`detail`, | |||||
| m.name as merchant_name, bu.name, bu.phone as bphone, cu.phone | |||||
| </sql> | |||||
| <select id="findListOfMicroPayOrderByDate" parameterType="map" resultMap="PayVoResultMap"> | |||||
| select | select | ||||
| <include refid="allColumns"/> | |||||
| from wx_order | |||||
| where order_status = '1' and `type` = 1 | |||||
| <include refid="allPayOrderColumns"/> | |||||
| from wx_order o | |||||
| inner JOIN wx_merchant m on m.id = o.merchant_id | |||||
| left join wx_merchant_b_user bu on bu.`merchant_id` = o.`merchant_id` and bu.id = o.`b_user_id` | |||||
| left JOIN wx_c_user cu on cu.id = o.c_user_id | |||||
| where o.order_status = '1' and o.`type` = 1 | |||||
| <if test=" null != tenantId "> | <if test=" null != tenantId "> | ||||
| and `tenant_id` = #{tenantId} | |||||
| and o.`tenant_id` = #{tenantId} | |||||
| </if> | </if> | ||||
| <if test=" null != merchantId "> | <if test=" null != merchantId "> | ||||
| and `merchant_id` = #{merchantId} | |||||
| and o.`merchant_id` = #{merchantId} | |||||
| </if> | </if> | ||||
| <if test=" null != bUserId "> | <if test=" null != bUserId "> | ||||
| and `b_user_id` = #{bUserId} | |||||
| and o.`b_user_id` = #{bUserId} | |||||
| </if> | </if> | ||||
| <if test="startDate != null"> | <if test="startDate != null"> | ||||
| AND create_date > #{startDate,jdbcType=TIMESTAMP} | |||||
| AND o.create_date > #{startDate,jdbcType=TIMESTAMP} | |||||
| </if> | </if> | ||||
| <if test="endDate != null"> | <if test="endDate != null"> | ||||
| AND create_date < #{endDate,jdbcType=TIMESTAMP} | |||||
| AND o.create_date < #{endDate,jdbcType=TIMESTAMP} | |||||
| </if> | </if> | ||||
| order by create_date desc | |||||
| order by o.create_date desc | |||||
| </select> | </select> | ||||