| @@ -4,9 +4,12 @@ package com.iformall.controller; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.MallUserInfo; | import com.iformall.domain.po.MallUserInfo; | ||||
| import com.iformall.domain.po.WxCardInfo; | |||||
| import com.iformall.domain.po.WxCardSpend; | import com.iformall.domain.po.WxCardSpend; | ||||
| import com.iformall.domain.po.WxCouponOrder; | import com.iformall.domain.po.WxCouponOrder; | ||||
| import com.iformall.domain.vo.WxCardSpendVo; | import com.iformall.domain.vo.WxCardSpendVo; | ||||
| import com.iformall.domain.vo.WxCardVo; | |||||
| import com.iformall.service.WxCardInfoService; | |||||
| import com.iformall.service.WxCardSpendService; | import com.iformall.service.WxCardSpendService; | ||||
| import com.iformall.service.WxMerchantService; | import com.iformall.service.WxMerchantService; | ||||
| import com.iformall.service.WxOrderService; | import com.iformall.service.WxOrderService; | ||||
| @@ -14,6 +17,7 @@ import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -22,6 +26,9 @@ import org.springframework.web.bind.annotation.ModelAttribute; | |||||
| import org.springframework.web.bind.annotation.RequestMapping; | import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RestController; | import org.springframework.web.bind.annotation.RestController; | ||||
| import java.util.ArrayList; | |||||
| import java.util.List; | |||||
| /** | /** | ||||
| * @author Stormeye Wu wuguoqiang@iformall.com | * @author Stormeye Wu wuguoqiang@iformall.com | ||||
| */ | */ | ||||
| @@ -37,6 +44,9 @@ public class WxCardPayController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| WxOrderService wxOrderService; | WxOrderService wxOrderService; | ||||
| @Autowired | |||||
| WxCardInfoService wxCardInfoService; | |||||
| @Autowired | @Autowired | ||||
| WxCardSpendService wxCardSpendService; | WxCardSpendService wxCardSpendService; | ||||
| @@ -45,13 +55,23 @@ public class WxCardPayController extends BaseController { | |||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @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 cardOrderList(@ModelAttribute WxCouponOrder wxCouponOrder, Integer pageNum, Integer pageSize) { | |||||
| public ResultData cardOrderList(@ModelAttribute WxCardVo wxCardVo, Integer pageNum, Integer pageSize) { | |||||
| String ipStr = getIpAddr(); | String ipStr = getIpAddr(); | ||||
| logger.info("cardOrderList: " + ipStr); | logger.info("cardOrderList: " + ipStr); | ||||
| if (wxCouponOrder == null) wxCouponOrder = new WxCouponOrder(); | |||||
| if (wxCardVo == null) wxCardVo = new WxCardVo(); | |||||
| MallUserInfo user = getUser(); | MallUserInfo user = getUser(); | ||||
| wxCouponOrder.setTenantId(user.getTenantId()); | |||||
| //final PageInfo<WxCardSpendVo> page = wxCardSpendService.listAsPage(wxCardSpend, pageNum, pageSize); | |||||
| wxCardVo.setTenantId(user.getTenantId()); | |||||
| if(StringUtils.isNotBlank(wxCardVo.getStatusStr())) { | |||||
| String [] statusAttr = wxCardVo.getStatusStr().split(","); | |||||
| List<Integer> tmpList = new ArrayList<Integer>(); | |||||
| for(String status: statusAttr) { | |||||
| tmpList.add(Integer.valueOf(status)); | |||||
| } | |||||
| if(!tmpList.isEmpty()) { | |||||
| wxCardVo.setStatusS(tmpList); | |||||
| } | |||||
| } | |||||
| final PageInfo<WxCardVo> page = wxCardInfoService.listAsPage(wxCardVo, pageNum, pageSize); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -0,0 +1,76 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |||||
| import com.iformall.domain.po.WxCardInfo; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.NoArgsConstructor; | |||||
| import lombok.ToString; | |||||
| import javax.persistence.Transient; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @JsonIgnoreProperties(value = {"handler"}) | |||||
| @Data | |||||
| @NoArgsConstructor | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class WxCardVo extends WxCardInfo { | |||||
| /** 券类型信息 */ | |||||
| /**封面图**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="封面图",name="coverImg") | |||||
| private String coverImg; | |||||
| /**券名称**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="券名称",name="title") | |||||
| private String title; | |||||
| /**副标题**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="副标题",name="subTitle") | |||||
| private String subTitle; | |||||
| /**单位**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="单位0:钱分,1:小时",name="unit") | |||||
| private Integer unit; | |||||
| /**须知**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="须知",name="detail") | |||||
| private String detail; | |||||
| /**购买须知**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="购买须知",name="remark") | |||||
| private String remark; | |||||
| /**面额**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "面额", name = "price") | |||||
| private Integer price; | |||||
| /**购买金额**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "购买金额", name = "salePrice") | |||||
| private Integer salePrice; | |||||
| /**购买人ID*/ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "购买人ID", name = "cUserId") | |||||
| private Long cUserId; | |||||
| /**持有者ID*/ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "持有者ID", name = "ownerId") | |||||
| private Long ownerId; | |||||
| /**该订单对应券的实际过期时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "该订单对应券的实际过期时间 ", name = "expiredTime") | |||||
| private Date expiredTime; | |||||
| /**购买人昵称*/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="购买人昵称",name="cNickName") | |||||
| private String cNickName; | |||||
| /**持有人昵称*/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="持有人昵称",name="oNickName") | |||||
| private String oNickName; | |||||
| /**持有人绑定的手机号**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="持有人绑定的手机号",name="oPhone") | |||||
| private String oPhone; | |||||
| @Transient | |||||
| protected List<Integer> statusS; | |||||
| @Transient | |||||
| protected String statusStr; | |||||
| } | |||||
| @@ -3,10 +3,13 @@ package com.iformall.mapper; | |||||
| import java.util.*; | import java.util.*; | ||||
| import com.iformall.common.CommonMapper; | import com.iformall.common.CommonMapper; | ||||
| import com.iformall.domain.po.WxCardInfo; | import com.iformall.domain.po.WxCardInfo; | ||||
| import com.iformall.domain.vo.WxCardVo; | |||||
| public interface WxCardInfoMapper extends CommonMapper<WxCardInfo, Long> { | public interface WxCardInfoMapper extends CommonMapper<WxCardInfo, Long> { | ||||
| List<WxCardInfo> findList(WxCardInfo wxCardInfo); | List<WxCardInfo> findList(WxCardInfo wxCardInfo); | ||||
| List<WxCardVo> findVoList(WxCardVo wxCardVo); | |||||
| @@ -2,6 +2,7 @@ package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.po.WxCardInfo; | import com.iformall.domain.po.WxCardInfo; | ||||
| import com.iformall.domain.vo.WxCardVo; | |||||
| public interface WxCardInfoService { | public interface WxCardInfoService { | ||||
| @@ -13,7 +14,7 @@ public interface WxCardInfoService { | |||||
| * @param pageSize | * @param pageSize | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<WxCardInfo> listAsPage(WxCardInfo record, Integer pageIndex, Integer pageSize); | |||||
| PageInfo<WxCardVo> listAsPage(WxCardVo record, Integer pageIndex, Integer pageSize); | |||||
| /** | /** | ||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| @@ -3,6 +3,7 @@ package com.iformall.service.impl; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.po.WxCardInfo; | import com.iformall.domain.po.WxCardInfo; | ||||
| import com.iformall.domain.vo.WxCardVo; | |||||
| import com.iformall.mapper.WxCardInfoMapper; | import com.iformall.mapper.WxCardInfoMapper; | ||||
| import com.iformall.service.WxCardInfoService; | import com.iformall.service.WxCardInfoService; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -17,8 +18,8 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { | |||||
| @Override | @Override | ||||
| public PageInfo<WxCardInfo> listAsPage(WxCardInfo record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCardInfoMapper.findList(record)); | |||||
| public PageInfo<WxCardVo> listAsPage(WxCardVo record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCardInfoMapper.findVoList(record)); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -71,6 +71,116 @@ | |||||
| select <include refid="allColumns" /> from wx_card_info | select <include refid="allColumns" /> from wx_card_info | ||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| <resultMap id="VoBaseResultMap" type="com.iformall.domain.vo.WxCardVo"> | |||||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId" /> | |||||
| <result column="transaction_id" jdbcType="VARCHAR" property="transactionId" /> | |||||
| <result column="amount" jdbcType="INTEGER" property="amount" /> | |||||
| <result column="sale_amount" jdbcType="INTEGER" property="saleAmount" /> | |||||
| <result column="remaining_amount" jdbcType="INTEGER" property="remainingAmount" /> | |||||
| <result column="service_fee_amount" jdbcType="INTEGER" property="serviceFeeAmount" /> | |||||
| <result column="share_fee_amount" jdbcType="INTEGER" property="shareFeeAmount" /> | |||||
| <result column="remaining_share_fee_amount" jdbcType="INTEGER" property="remainingShareFeeAmount" /> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||||
| <result column="cover_img" jdbcType="VARCHAR" property="coverImg" /> | |||||
| <result column="title" jdbcType="VARCHAR" property="title" /> | |||||
| <result column="sub_title" jdbcType="VARCHAR" property="subTitle" /> | |||||
| <result column="detail" jdbcType="VARCHAR" property="detail" /> | |||||
| <result column="unit" jdbcType="INTEGER" property="unit" /> | |||||
| <result column="remark" jdbcType="VARCHAR" property="remark" /> | |||||
| <result column="sale_price" jdbcType="INTEGER" property="salePrice"/> | |||||
| <result column="price" jdbcType="INTEGER" property="price"/> | |||||
| <result column="c_user_id" jdbcType="BIGINT" property="cUserId" /> | |||||
| <result column="owner_id" jdbcType="BIGINT" property="ownerId" /> | |||||
| <result column="expired_time" jdbcType="TIMESTAMP" property="expiredTime" /> | |||||
| <result column="c_nick_name" jdbcType="VARCHAR" property="cNickName"/> | |||||
| <result column="o_nick_name" jdbcType="VARCHAR" property="oNickName"/> | |||||
| <result column="o_phone" jdbcType="VARCHAR" property="oPhone"/> | |||||
| </resultMap> | |||||
| <sql id="allVoColumns"> | |||||
| ci.`id`,ci.`tenant_id`,ci.`coupon_id`,ci.`transaction_id`,ci.`amount`,ci.`sale_amount`,ci.`remaining_amount`,ci.`service_fee_amount`,ci.`share_fee_amount`,ci.`remaining_share_fee_amount`, | |||||
| ci.`create_date`,ci.`update_date`, | |||||
| c.`cover_img`, c.`title`, c.`sub_title`, c.`detail`, c.`unit`, c.`remark`, c.`sale_price`, c.`price`, c.`status` | |||||
| co.`c_user_id`, co.`owner_id`, co.`expired_time`, | |||||
| cu.`nick_name` as c_nick_name, ow.`nick_name` as o_nick_name, ow.`phone` as o_phone | |||||
| </sql> | |||||
| <sql id="dynamicVoWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and ci.`id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId "> | |||||
| and ci.`tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != couponId "> | |||||
| and ci.`coupon_id` = #{couponId} | |||||
| </if> | |||||
| <if test=" null != transactionId "> | |||||
| and ci.`transaction_id` = #{transactionId} | |||||
| </if> | |||||
| <if test=" null != amount "> | |||||
| and ci.`amount` = #{amount} | |||||
| </if> | |||||
| <if test=" null != saleAmount "> | |||||
| and ci.`sale_amount` = #{saleAmount} | |||||
| </if> | |||||
| <if test=" null != remainingAmount "> | |||||
| and ci.`remaining_amount` = #{remainingAmount} | |||||
| </if> | |||||
| <if test=" null != serviceFeeAmount "> | |||||
| and ci.`service_fee_amount` = #{serviceFeeAmount} | |||||
| </if> | |||||
| <if test=" null != shareFeeAmount "> | |||||
| and ci.`share_fee_amount` = #{shareFeeAmount} | |||||
| </if> | |||||
| <if test=" null != remaingShareFeeAmount "> | |||||
| and ci.`remaining_share_fee_amount` = #{remainingShareFeeAmount} | |||||
| </if> | |||||
| <if test=" null != createDate "> | |||||
| and ci.`create_date` = #{createDate} | |||||
| </if> | |||||
| <if test=" null != updateDate "> | |||||
| and ci.`update_date` = #{updateDate} | |||||
| </if> | |||||
| <if test=" null != status "> | |||||
| and `status` = #{status} | |||||
| </if> | |||||
| <if test=" null != oPhone "> | |||||
| and o_phone = #{oPhone} | |||||
| </if> | |||||
| <if test=" null != statusS "> | |||||
| and `status` in in | |||||
| <foreach collection="statusS" index="index" item="sItem" open="(" separator="," close=")"> | |||||
| #{sItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and ci.id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| order by ci.id desc | |||||
| </sql> | |||||
| <select id="findVoList" parameterType="com.iformall.domain.vo.WxCardVo" resultMap="VoBaseResultMap"> | |||||
| select <include refid="allVoColumns" /> | |||||
| from wx_card_info ci | |||||
| left join wx_coupon c on c.id = ci.coupon_id | |||||
| left join wx_coupon_order co on co.id = ci.id | |||||
| left join wx_c_user cu on cu.id = co.c_user_id | |||||
| left join wx_c_user ou on ou.id = co.owner_id | |||||
| <include refid="dynamicVoWhereConditions" /> | |||||
| </select> | |||||
| @@ -166,7 +166,7 @@ | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | <if test=" null != sortColumns"> order by ${sortColumns} </if> | ||||
| </sql> | </sql> | ||||
| <select id="findVoList" parameterType="com.iformall.domain.po.WxMerchantSubsidy" resultMap="BaseResultMap"> | |||||
| <select id="findVoList" parameterType="com.iformall.domain.po.WxMerchantSubsidy" resultMap="VoBaseResultMap"> | |||||
| select <include refid="allVoColumns" /> | select <include refid="allVoColumns" /> | ||||
| from wx_merchant_subsidy ms | from wx_merchant_subsidy ms | ||||
| left join wx_coupon_order co on co.id = ms.coupon_order_id | left join wx_coupon_order co on co.id = ms.coupon_order_id | ||||