Browse Source

[A端][修复]:增加订单列表详情接口

release_toaliyun_real
hupeng 7 years ago
parent
commit
6482b3c8fd
5 changed files with 81 additions and 22 deletions
  1. +14
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/WxCouponOrderController.java
  2. +2
    -3
      mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java
  3. +3
    -0
      mallinkService/src/main/java/com/iformall/service/WxCouponOrderService.java
  4. +11
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java
  5. +51
    -16
      mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml

+ 14
- 1
mallinkAdmin/src/main/java/com/iformall/controller/WxCouponOrderController.java View File

@@ -55,13 +55,26 @@ public class WxCouponOrderController extends BaseController {
logger.debug("[" + getIpAddr() + "] WxCouponOrderController::list"); logger.debug("[" + getIpAddr() + "] WxCouponOrderController::list");
if (wxCouponOrder == null) wxCouponOrder = new WxCouponOrderBVo(); if (wxCouponOrder == null) wxCouponOrder = new WxCouponOrderBVo();
wxCouponOrder.setTenantId(getTenantId()); wxCouponOrder.setTenantId(getTenantId());
if (wxCouponOrder.getMerchantName().isEmpty()) {
if (wxCouponOrder.getMerchantName() != null &&
wxCouponOrder.getMerchantName().isEmpty()) {
wxCouponOrder.setMerchantName(null); wxCouponOrder.setMerchantName(null);
} }
wxCouponOrder.setSortColumns(WxCouponOrder.Field.Id_DESC); wxCouponOrder.setSortColumns(WxCouponOrder.Field.Id_DESC);
return wxCouponOrderService.listAdminAsPage(wxCouponOrder, pageNum, pageSize); return wxCouponOrderService.listAdminAsPage(wxCouponOrder, pageNum, pageSize);
} }


@ApiOperation(value = "卡券详情接口")
@GetMapping("detail")
@ApiImplicitParams({
@ApiImplicitParam(name = "couponOrderId", value = "券ID", dataType = "Long", paramType = "query", required = true)
})
public ResultData detail(@RequestParam("couponOrderId") Long couponOrderId) {
if(couponOrderId == null) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}
return wxCouponOrderService.detailAdminVo(couponOrderId);
}

@RequestMapping("/exportData") @RequestMapping("/exportData")
public void exportData( public void exportData(
@RequestParam("endDate") String endDate, @RequestParam("endDate") String endDate,


+ 2
- 3
mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java View File

@@ -26,11 +26,10 @@ public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> {
List<WxCouponOrderBVo> findListOfOrderedByDateForBUser(Map dateMap); List<WxCouponOrderBVo> findListOfOrderedByDateForBUser(Map dateMap);
List<WxCouponOrderBVo> findListOfVerifiedByDateForBUser(Map dateMap); List<WxCouponOrderBVo> findListOfVerifiedByDateForBUser(Map dateMap);


WxCouponOrderCVo findDetail(@Param("id")Long id);

List<WxCouponOrderCVo> findListOfCUser(WxCouponOrder wxCouponOrder); List<WxCouponOrderCVo> findListOfCUser(WxCouponOrder wxCouponOrder);
WxCouponOrderCVo findDetailOfCUser(@Param("id")Long id);
List<WxCouponOrderBVo> findListOfAdmin(WxCouponOrderBVo wxCouponOrder); List<WxCouponOrderBVo> findListOfAdmin(WxCouponOrderBVo wxCouponOrder);
WxCouponOrderBVo findDetailOfAdmin(@Param("id")Long id);
/** /**
* 查询用户核销/领券数 * 查询用户核销/领券数
* @param cUserId * @param cUserId


+ 3
- 0
mallinkService/src/main/java/com/iformall/service/WxCouponOrderService.java View File

@@ -138,6 +138,9 @@ public interface WxCouponOrderService {
*/ */
ResultData listAdminAsPage(WxCouponOrderBVo wxCouponOrder, Integer pageIndex, Integer pageSize); ResultData listAdminAsPage(WxCouponOrderBVo wxCouponOrder, Integer pageIndex, Integer pageSize);



ResultData detailAdminVo(Long couponOrderId);

void exportData(HttpServletRequest request, HttpServletResponse response, WxCouponOrderBVo wxCouponOrder); void exportData(HttpServletRequest request, HttpServletResponse response, WxCouponOrderBVo wxCouponOrder);




+ 11
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java View File

@@ -192,7 +192,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
throw new MallinkException(ErrorCode.USER_IS_EMPTY); throw new MallinkException(ErrorCode.USER_IS_EMPTY);
} }


WxCouponOrderCVo wxCouponOrderCVo = wxCouponOrderMapper.findDetail(Long.valueOf(couponOrderId));
WxCouponOrderCVo wxCouponOrderCVo = wxCouponOrderMapper.findDetailOfCUser(Long.valueOf(couponOrderId));
if (wxCouponOrderCVo == null) if (wxCouponOrderCVo == null)
return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL);
return new ResultData(wxCouponOrderCVo); return new ResultData(wxCouponOrderCVo);
@@ -223,7 +223,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_FOUND); throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_FOUND);
} }


WxCouponOrderCVo wxCouponOrderCVo = wxCouponOrderMapper.findDetail(Long.valueOf(couponOrderId));
WxCouponOrderCVo wxCouponOrderCVo = wxCouponOrderMapper.findDetailOfCUser(Long.valueOf(couponOrderId));
if (wxCouponOrderCVo == null) if (wxCouponOrderCVo == null)
return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL);
return new ResultData(wxCouponOrderCVo); return new ResultData(wxCouponOrderCVo);
@@ -235,6 +235,15 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
return new ResultData(pageInfo); return new ResultData(pageInfo);
} }


@Override
public ResultData detailAdminVo(Long couponOrderId) {

WxCouponOrderBVo wxCouponOrderBVo = wxCouponOrderMapper.findDetailOfAdmin(couponOrderId);
if (wxCouponOrderBVo == null)
return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL);
return new ResultData(wxCouponOrderBVo);
}

@Override @Override
public void exportData(HttpServletRequest request, HttpServletResponse response, WxCouponOrderBVo wxCouponOrder) { public void exportData(HttpServletRequest request, HttpServletResponse response, WxCouponOrderBVo wxCouponOrder) {




+ 51
- 16
mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml View File

@@ -320,21 +320,36 @@
</collection> </collection>
</resultMap> </resultMap>


<sql id="allAdminCouponOrderColumns">
<sql id="allAdminCouponOrderListColumns">
co.id,co.tenant_id,co.coupon_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,
c.title,c.sale_price,c.use_price,c.price,c.unit,
m.name as merchant_name
</sql>

<sql id="allAdminCouponOrderDetailColumns">
co.id,co.tenant_id,co.coupon_id,co.c_user_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price, co.id,co.tenant_id,co.coupon_id,co.c_user_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,
c.type,c.title,c.sale_price,c.use_price,c.price,c.unit, c.type,c.title,c.sale_price,c.use_price,c.price,c.unit,
bu.name, bu.phone as bphone, cu.phone, m.name as merchant_name
bu.name, bu.phone as bphone,
cu.phone,
m.name as merchant_name
</sql> </sql>


<select id="findListOfAdmin" parameterType="com.iformall.domain.vo.WxCouponOrderBVo" resultMap="BVoResultMap"> <select id="findListOfAdmin" parameterType="com.iformall.domain.vo.WxCouponOrderBVo" resultMap="BVoResultMap">
select <include refid="allAdminCouponOrderColumns" />
from wx_coupon_order co
inner JOIN wx_coupon c on c.id = co.coupon_id
inner JOIN wx_c_user cu on cu.id = co.c_user_id
left JOIN wx_merchant_b_user bu on bu.id = co.b_user_id
left JOIN wx_merchant m on m.id = bu.merchant_id
where 1 = 1

select <include refid="allAdminCouponOrderListColumns" />
from wx_coupon_merchant cm,
(select tco.id as tcoid,
(select count(*) from wx_coupon_merchant tcm
where tcm.product_id = tco.coupon_id) as mc
from wx_coupon_order tco) com,
wx_coupon c,
wx_merchant m,
wx_coupon_order co
where com.mc = 1
and com.tcoid = co.id
and cm.product_id = c.id
and cm.status = 0
and c.id = co.coupon_id
and m.id = cm.merchant_id
<if test=" null != tenantId "> <if test=" null != tenantId ">
and co.tenant_id = #{tenantId} and co.tenant_id = #{tenantId}
</if> </if>
@@ -360,6 +375,28 @@
</select> </select>




<select id="findDetailOfAdmin" parameterType="java.lang.Long" resultMap="BVoResultMap">
select <include refid="allAdminCouponOrderDetailColumns" />
from wx_coupon_merchant cm,
(select tco.id as tcoid,
(select count(*) from wx_coupon_merchant tcm
where tcm.product_id = tco.coupon_id) as mc
from wx_coupon_order tco) com,
wx_coupon c,
wx_c_user cu,
wx_merchant m,
wx_coupon_order co
left join wx_merchant_b_user bu on co.b_user_id = bu.id
where co.id = #{id}
and com.mc = 1
and com.tcoid = co.id
and cm.product_id = c.id
and cm.status = 0
and c.id = co.coupon_id
and cu.id = co.c_user_id
and m.id = cm.merchant_id
</select>

<sql id="allBUserVerifiedCouponOrderColumns"> <sql id="allBUserVerifiedCouponOrderColumns">
co.id,co.tenant_id,co.coupon_id,co.c_user_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price, co.id,co.tenant_id,co.coupon_id,co.c_user_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,
c.type,c.title,c.sale_price,c.use_price,c.price,c.unit, c.type,c.title,c.sale_price,c.use_price,c.price,c.unit,
@@ -376,14 +413,13 @@


<select id="findListOfOrderedByDateForBUser" parameterType="map" resultMap="BVoResultMap"> <select id="findListOfOrderedByDateForBUser" parameterType="map" resultMap="BVoResultMap">
select <include refid="allBUserOrderedCouponOrderColumns" /> select <include refid="allBUserOrderedCouponOrderColumns" />
from wx_coupon_order co,wx_order o,wx_coupon c,wx_c_user cu,wx_coupon_merchant cm,
from wx_coupon_order co,wx_coupon c,wx_c_user cu,wx_coupon_merchant cm,
(select tco.id as tcoid, (select tco.id as tcoid,
(select count(*) from wx_coupon_merchant tcm (select count(*) from wx_coupon_merchant tcm
where tcm.product_id = tco.coupon_id) as mc where tcm.product_id = tco.coupon_id) as mc
from wx_coupon_order tco) com from wx_coupon_order tco) com
where com.mc = 1 where com.mc = 1
and com.tcoid = co.id and com.tcoid = co.id
and o.id = co.order_id
and cm.merchant_id = #{merchantId} and cm.merchant_id = #{merchantId}
and cm.product_id = c.id and cm.product_id = c.id
and cm.status = 0 and cm.status = 0
@@ -401,9 +437,8 @@


<select id="findListOfVerifiedByDateForBUser" parameterType="map" resultMap="BVoResultMap"> <select id="findListOfVerifiedByDateForBUser" parameterType="map" resultMap="BVoResultMap">
select <include refid="allBUserVerifiedCouponOrderColumns" /> select <include refid="allBUserVerifiedCouponOrderColumns" />
from wx_coupon_order co,wx_order o,wx_coupon c,wx_c_user cu,wx_merchant_b_user bu
where o.id = co.order_id
and co.coupon_id = c.id
from wx_coupon_order co,wx_coupon c,wx_c_user cu,wx_merchant_b_user bu
where co.coupon_id = c.id
and cu.id = co.c_user_id and cu.id = co.c_user_id
and bu.id = co.b_user_id and bu.id = co.b_user_id
and bu.merchant_id = #{merchantId} and bu.merchant_id = #{merchantId}
@@ -518,7 +553,7 @@
</select> </select>




<select id="findDetail" parameterType="java.lang.Long" resultMap="CVoResultMap">
<select id="findDetailOfCUser" parameterType="java.lang.Long" resultMap="CVoResultMap">
select <include refid="allCUserCouponOrderDetailColumns" /> select <include refid="allCUserCouponOrderDetailColumns" />
from wx_coupon_order co,wx_coupon c from wx_coupon_order co,wx_coupon c
where co.coupon_id = c.id where co.coupon_id = c.id


Loading…
Cancel
Save