Просмотр исходного кода

Merge branch 'release_toaliyun_real_2022_02' of https://git.malls.iformall.com/server/formallProject into release_toaliyun_real_2022_02

release_toaliyun_real
xhxu 4 лет назад
Родитель
Сommit
2a4bce9f9f
4 измененных файлов: 99 добавлений и 75 удалений
  1. +29
    -30
      mallinkBApi/src/main/java/com/iformall/controller/WxCouponOrderController.java
  2. +8
    -0
      mallinkSchedule/src/main/java/com/iformall/schedule/DaliyAmountSchedule.java
  3. +27
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java
  4. +35
    -43
      mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml

+ 29
- 30
mallinkBApi/src/main/java/com/iformall/controller/WxCouponOrderController.java Просмотреть файл

@@ -109,7 +109,6 @@ public class WxCouponOrderController extends BaseController {
return new ResultData();
}

//TODO 待优化数据
@ApiOperation("交易流水分页列表接口")
@GetMapping("listUnverified")
@ApiImplicitParams({
@@ -119,35 +118,35 @@ public class WxCouponOrderController extends BaseController {
public ResultData listUnverified(String date, Integer pageNum, Integer pageSize) {
return wxCouponOrderService.listOnDateAsPage(getLoginBUser().getId(), date, pageNum, pageSize, false);
}
//
// @ApiOperation("核销流水分页列表接口")
// @GetMapping("listVerified")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "date", value = "日期yyyy-MM-dd", dataType = "string", paramType = "query"),
// @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
// @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
// public ResultData listVerified(String date, Integer pageNum, Integer pageSize) {
// return wxCouponOrderService.listOnDateAsPage(getLoginBUser().getId(), date, pageNum, pageSize, true);
// }
//
//
// @RedisCache
// @ApiOperation("某日期交易总流水")
// @GetMapping("getUnverifiedAmountOnDate")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "date", value = "日期yyyy-MM-dd", dataType = "string", paramType = "query")})
// public ResultData getUnverifiedAmountOnDate(String date) {
// return wxCouponOrderService.listOnDateAsPage(getLoginBUser().getId(), date, null, null, false);
// }
// @RedisCache
// @ApiOperation("某日期核销总流水")
// @GetMapping("getVerifiedAmountOnDate")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "date", value = "日期yyyy-MM-dd", dataType = "string", paramType = "query")})
// public ResultData getVerifiedAmountOnDate(String date) {
// return wxCouponOrderService.listOnDateAsPage(getLoginBUser().getId(), date, null, null, true);
// }
@ApiOperation("核销流水分页列表接口")
@GetMapping("listVerified")
@ApiImplicitParams({
@ApiImplicitParam(name = "date", value = "日期yyyy-MM-dd", dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
public ResultData listVerified(String date, Integer pageNum, Integer pageSize) {
return wxCouponOrderService.listOnDateAsPage(getLoginBUser().getId(), date, pageNum, pageSize, true);
}
@RedisCache
@ApiOperation("某日期交易总流水")
@GetMapping("getUnverifiedAmountOnDate")
@ApiImplicitParams({
@ApiImplicitParam(name = "date", value = "日期yyyy-MM-dd", dataType = "string", paramType = "query")})
public ResultData getUnverifiedAmountOnDate(String date) {
return wxCouponOrderService.listOnDateAsPage(getLoginBUser().getId(), date, null, null, false);
}
@RedisCache
@ApiOperation("某日期核销总流水")
@GetMapping("getVerifiedAmountOnDate")
@ApiImplicitParams({
@ApiImplicitParam(name = "date", value = "日期yyyy-MM-dd", dataType = "string", paramType = "query")})
public ResultData getVerifiedAmountOnDate(String date) {
return wxCouponOrderService.listOnDateAsPage(getLoginBUser().getId(), date, null, null, true);
}


@ApiOperation(value = "卡券详情接口")


+ 8
- 0
mallinkSchedule/src/main/java/com/iformall/schedule/DaliyAmountSchedule.java Просмотреть файл

@@ -38,6 +38,9 @@ public class DaliyAmountSchedule {

@Autowired
private WxOrderMapper wxOrderMapper;
@Autowired
WxMerchantBUserMapper wxMerchantBUserMapper;


@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class})
@@ -47,6 +50,11 @@ public class DaliyAmountSchedule {
dateMap.put("endDate", endDate);
dateMap.put("merchantId", merchant.getId());
dateMap.put("tenantId", merchant.getTenantId());
WxMerchantBUser merchantBUserQ = new WxMerchantBUser();
merchantBUserQ.updateTenantInfo(merchant);
merchantBUserQ.setMerchantId(merchant.getId());
List<Long> bUserIds = wxMerchantBUserMapper.findIdList(merchantBUserQ);
dateMap.put("bUserIds", bUserIds);

List<WxCouponOrder> list = wxCouponOrderMapper.findListOfOrderedByDate(dateMap);
logger.info("find " + list.size() + " coupon order from " + startDate + " to " + endDate);


+ 27
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java Просмотреть файл

@@ -258,10 +258,35 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {

if (pageIndex == null || pageSize == null) {
List<WxCouponOrder> list;
if (isVerified)
if (isVerified) {
WxMerchantBUser merchantBUserQ = new WxMerchantBUser();
merchantBUserQ.updateTenantInfo(wxMerchant);
merchantBUserQ.setMerchantId(wxMerchant.getId());
List<Long> bUserIds = wxMerchantBUserMapper.findIdList(merchantBUserQ);
dateMap.put("bUserIds", bUserIds);
list = wxCouponOrderMapper.findListOfVerifiedByDate(dateMap);
else
}else {
dateMap.put("startDateTimes", startDate.getTime());
dateMap.put("endDateTimes", endDate.getTime());
List<Long> merchantIdList = new ArrayList<Long>();
merchantIdList.add(wxMerchant.getId());
List<WxMerchantProductVo> merchantProductVos = wxCouponMerchantMapper.findMerchantProduct(wxMerchant.getTenantId(), merchantIdList);
if (null != merchantProductVos) {
List<Long> couponIds = new ArrayList<Long>();
for (int i = 0 ; i < merchantProductVos.size(); i ++) {
WxMerchantProductVo mp = merchantProductVos.get(i);
if (mp.getMc() == 1) {
if (!couponIds.contains(mp.getProductId())) {
couponIds.add(mp.getProductId());
}
}
}
if (couponIds.size() > 0 ) {
dateMap.put("couponIds", couponIds);
}
}
list = wxCouponOrderMapper.findListOfOrderedByDate(dateMap);
}
//logger.info("find " + list.size() + " coupon order from " + /startDate + " to " + new Date());
resultMap.put("amount", list.stream().mapToInt(p -> p.getCouponPrice()).sum());
resultMap.put("orderCount", list.size());


+ 35
- 43
mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml Просмотреть файл

@@ -878,8 +878,17 @@
co.create_date,co.update_date,co.coupon_price, co.verify_type, co.verify_remark,co.pay_vendor,
co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,co.send_merchant_id,co.subsidy
FROM wx_coupon_order co where co.`tenant_id` = #{tenantId}
<if test=" null != id and '' != id">
and co.`id` = #{id}
<if test=" null != id ">
and co.id = #{id}
</if>
<if test=" null != orderId ">
and co.order_id = #{orderId}
</if>
<if test=" null != couponId ">
and c.id = #{couponId}
</if>
<if test=" null != cUserId and '' != cUserId">
and co.c_user_id = #{cUserId}
</if>
<choose>
<when test=" null != couponType">
@@ -932,19 +941,6 @@
AND co.update_date &lt; #{verifyEndDate,jdbcType=TIMESTAMP}
</if>
<if test=" null != id ">
and co.id = #{id}
</if>
<if test=" null != orderId ">
and co.order_id = #{orderId}
</if>
<if test=" null != couponId ">
and c.id = #{couponId}
</if>
<if test=" null != cUserId and '' != cUserId">
and co.c_user_id = #{cUserId}
</if>
<if test=" null != couponIds">
and co.coupon_id in
<foreach collection="couponIds" index="index" item="couponIdItem" open="(" separator="," close=")">
@@ -1058,42 +1054,39 @@

</select>

<sql id="allCouponOrderColumns">
<select id="findListOfOrderedByDate" parameterType="map" resultMap="BaseResultMap">
co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_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.verify_type,co.verify_remark,co.pay_vendor,
co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`
</sql>

<select id="findListOfOrderedByDate" parameterType="map" resultMap="BaseResultMap">
select <include refid="allCouponOrderColumns" />
from wx_coupon_order co,wx_coupon_merchant cm,
(select tco.id as tcoid,
(select count(*) from wx_coupon_merchant tcm
where tcm.product_id = tco.coupon_id
and tcm.status = 0)
as mc
from wx_coupon_order tco) com
where com.mc = 1
and co.tenant_id = #{tenantId}
and com.tcoid = co.id
and cm.status = 0
and cm.merchant_id = #{merchantId}
and cm.product_id = co.coupon_id
<if test="startDate != null">
AND co.create_date &gt; #{startDate,jdbcType=TIMESTAMP}
from wx_coupon_order co
where co.tenant_id = #{tenantId}
<if test="startDateTimes != null">
AND co.create_date_times &gt; #{startDateTimes}
</if>
<if test="endDate != null">
AND co.create_date &lt; #{endDate,jdbcType=TIMESTAMP}
<if test="endDateTimes != null">
AND co.create_date_times &lt; #{endDateTimes}
</if>
<if test=" null != couponIds">
and co.coupon_id in
<foreach collection="couponIds" index="index" item="couponIdItem" open="(" separator="," close=")">
#{couponIdItem}
</foreach>
</if>

</select>

<select id="findListOfVerifiedByDate" parameterType="map" resultMap="BaseResultMap">
select <include refid="allCouponOrderColumns" />
from wx_coupon_order co, wx_merchant_b_user mbu
where mbu.id = co.b_user_id
co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_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.verify_type,co.verify_remark,co.pay_vendor,
co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`
from wx_coupon_order co
where co.coupon_order_status = '1'
and co.tenant_id = #{tenantId}
<if test="merchantId != null">
and mbu.merchant_id = #{merchantId}
<if test=" null != bUserIdList">
and co.b_user_id in
<foreach collection="bUserIdList" index="index" item="bUserIdItem" open="(" separator="," close=")">
#{bUserIdItem}
</foreach>
</if>
<if test="startDate != null">
AND co.update_date &gt; #{startDate,jdbcType=TIMESTAMP}
@@ -1101,7 +1094,6 @@
<if test="endDate != null">
AND co.update_date &lt; #{endDate,jdbcType=TIMESTAMP}
</if>
AND co.coupon_order_status = '1'
</select>




Загрузка…
Отмена
Сохранить