Browse Source

jifen

release_toaliyun_real
xhxu 5 years ago
parent
commit
fe92cec8c2
10 changed files with 38 additions and 31 deletions
  1. +1
    -1
      mallinkBApi/src/main/java/com/iformall/controller/WxCouponSendController.java
  2. +2
    -2
      mallinkSchedule/src/main/java/com/iformall/schedule/CouponSendSchedule.java
  3. +5
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCouponActionLog.java
  4. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxCouponActionLogService.java
  5. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxCouponSendService.java
  6. +11
    -10
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponActionLogServiceImpl.java
  7. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponInjectServiceImpl.java
  8. +13
    -13
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java
  9. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java
  10. +2
    -1
      mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml

+ 1
- 1
mallinkBApi/src/main/java/com/iformall/controller/WxCouponSendController.java View File

@@ -102,7 +102,7 @@ public class WxCouponSendController extends BaseController {
wxCouponSend.setSendType(EnumCouponSendSendType.MERCHANT.getCode());
wxCouponSend.setStatus(EnumCouponSendStatus.VALID.getCode());
try {
wxCouponSendService.handSel(wxCouponSend, Long.parseLong(cUserId),EnumPayWay.PAY_WAY_NOT_UNPAY_MERCHANT);
wxCouponSendService.handSel(wxCouponSend, Long.parseLong(cUserId),EnumPayWay.PAY_WAY_NOT_UNPAY_MERCHANT,getWxBuserId());
} catch (MallinkException e) {
logger.error("注券异常: ", e);
return new ResultData(e.getErrorCode(), e.getMessage());


+ 2
- 2
mallinkSchedule/src/main/java/com/iformall/schedule/CouponSendSchedule.java View File

@@ -192,7 +192,7 @@ public class CouponSendSchedule {
// 发放免费券
try {
WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(cu.getId(), cs,cs.getCouponId(), null,EnumPayWay.PAY_WAY_NOT_UNPAY_SYSTEM_SEND);
wxCouponActionLogService.addOne(tenantEntity, cs.getCouponId(), couponOrder.getId(), cs.getSendType(), cs.getId());
wxCouponActionLogService.addOne(tenantEntity, cs.getCouponId(), couponOrder.getId(), cs.getSendType(), cs.getId(),0L);
} catch (Exception e) {
logger.error("定时发券:发券失败 levelId=" + l.getId() + " couponId=" + cs.getCouponId() + " userId=" + cu.getId() + e.getMessage());
continue;
@@ -322,7 +322,7 @@ public class CouponSendSchedule {
// 发放生日券
try {
WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(cu.getId(),cs, cs.getCouponId(), null,EnumPayWay.PAY_WAY_NOT_UNPAY_SYSTEM_SEND);
wxCouponActionLogService.addOne(tenantEntity, cs.getCouponId(), couponOrder.getId(), cs.getSendType(), cs.getId());
wxCouponActionLogService.addOne(tenantEntity, cs.getCouponId(), couponOrder.getId(), cs.getSendType(), cs.getId(), 0L);
couponSendedUsers.add(cu);
} catch (Exception e) {
logger.error("定时发券:发券失败 levelId=" + cu.getId() + " couponId=" + cs.getCouponId() + " userId=" + cu.getId() + e.getMessage());


+ 5
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxCouponActionLog.java View File

@@ -2,6 +2,7 @@ package com.iformall.domain.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.iformall.domain.po.base.TenantEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -36,4 +37,8 @@ public class WxCouponActionLog extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value="月日",name="createTimeMd")
private String createTimeMd;

@JsonIgnore
@io.swagger.annotations.ApiModelProperty(value="操作人ID",name="operatorId")
private Long operatorId;

}

+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxCouponActionLogService.java View File

@@ -42,7 +42,7 @@ public interface WxCouponActionLogService {
void deleteById(Long id,String tenantId);


void addOne(TenantEntity tenantEntity,Long couponId,Long coupon_order_id,int channelType,Long channelId);
void addOne(TenantEntity tenantEntity,Long couponId,Long coupon_order_id,int channelType,Long channelId,Long bUserId);


int getCountByChannelId(TenantEntity tenantEntity, int channelType, Long channelId);


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxCouponSendService.java View File

@@ -96,7 +96,7 @@ public interface WxCouponSendService {
*
* @param wxCouponSend
*/
void handSel(WxCouponSend wxCouponSend,Long cUserId,EnumPayWay payWay) ;
void handSel(WxCouponSend wxCouponSend,Long cUserId,EnumPayWay payWay,Long bUserId) ;


}

+ 11
- 10
mallinkService/src/main/java/com/iformall/service/impl/WxCouponActionLogServiceImpl.java View File

@@ -56,17 +56,18 @@ public class WxCouponActionLogServiceImpl implements WxCouponActionLogService {
}

@Override
public void addOne(TenantEntity tenantEntity, Long couponId, Long coupon_order_id, int channelType, Long channelId) {
public void addOne(TenantEntity tenantEntity, Long couponId, Long coupon_order_id, int channelType, Long channelId,Long bUserId) {
Date curDate = new Date();
WxCouponActionLog actionLog = new WxCouponActionLog() {{
updateTenantInfo(tenantEntity);
setCouponId(couponId);
setChannelId(channelId);
setCouponOrderId(coupon_order_id);
setChannelType(channelType);
setCreateTime(curDate);
setCreateTimeMd(new SimpleDateFormat("MM/dd").format(curDate));
}};
WxCouponActionLog actionLog = new WxCouponActionLog();
actionLog.updateTenantInfo(tenantEntity);
actionLog.setCouponId(couponId);
actionLog.setChannelId(channelId);
actionLog.setCouponOrderId(coupon_order_id);
actionLog.setChannelType(channelType);
actionLog.setCreateTime(curDate);
actionLog.setCreateTimeMd(new SimpleDateFormat("MM/dd").format(curDate));
actionLog.setOperatorId(bUserId);

saveOrUpdate(actionLog);
}



+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxCouponInjectServiceImpl.java View File

@@ -276,7 +276,7 @@ public class WxCouponInjectServiceImpl implements WxCouponInjectService {
try {
couponOrder = wxOrderService.sendFreeCouponToUser(tempCUser.getId(),wxCoupon, wxCoupon.getId(),null,EnumPayWay.PAY_WAY_NOT_UNPAY_BATCH_SEND);
if (couponOrder != null) {
wxCouponActionLogService.addOne(couponOrder, wxCoupon.getId(), couponOrder.getId(), EnumCouponSendSendType.INJECT.getCode(), couponInjectId);
wxCouponActionLogService.addOne(couponOrder, wxCoupon.getId(), couponOrder.getId(), EnumCouponSendSendType.INJECT.getCode(), couponInjectId,0L);
}
} catch (MallinkException e) {
logger.error(e.getMessage());


+ 13
- 13
mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java View File

@@ -72,21 +72,21 @@ public class WxCouponSendServiceImpl implements WxCouponSendService {
@Override
public PageInfo<WxCouponSendVo> listAsPage(WxCouponSend record, Integer pageIndex, Integer pageSize) {
PageInfo<WxCouponSendVo> pageInfo;
/**
* 设置商户购买券数
* 前端排序:时间、商户总库存、商户已发数、商户剩余
*/
/**
* 设置商户购买券数
* 前端排序:时间、商户总库存、商户已发数、商户剩余
*/
if (Objects.equals(EnumCouponSendSendType.MERCHANT.getCode(), record.getSendType())) {
String sortStr = null;
if (Objects.equals(record.getSortColumn(), WxCouponSend.SORT_MERCHANT_LNVENTORY) ||
Objects.equals(record.getSortColumn(), WxCouponSend.SORT_MERCHANT_SEND) ||
if (Objects.equals(record.getSortColumn(), WxCouponSend.SORT_MERCHANT_LNVENTORY) ||
Objects.equals(record.getSortColumn(), WxCouponSend.SORT_MERCHANT_SEND) ||
Objects.equals(record.getSortColumn(), WxCouponSend.SORT_REMAIN)) {
sortStr = record.getSortColumn() + " " + record.getSortOrder();
} else if (Objects.equals(record.getSortColumn(), "createDate")) {
sortStr = "create_date" + " " + record.getSortOrder();
}
record.setSortColumn(null);
record.setSortCol(sortStr);
record.setSortColumn(null);
record.setSortCol(sortStr);
pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponSendMapper.findListVoByValidType(record));
for (WxCouponSendVo cs : pageInfo.getList()) {
JSONObject jo = JSONObject.parseObject(cs.getConditions());
@@ -375,7 +375,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService {
if (couponOrder != null) {
bRet = true;

wxCouponActionLogService.addOne(couponOrder, send.getCouponId(), couponOrder.getId(), type.getCode(), send.getId());
wxCouponActionLogService.addOne(couponOrder, send.getCouponId(), couponOrder.getId(), type.getCode(), send.getId(),0L);

// 发送消息
if (couponOrder != null) {
@@ -430,8 +430,8 @@ public class WxCouponSendServiceImpl implements WxCouponSendService {
List<WxAppinfo> appList = wxAppinfoService.getList(appinfoQ);
appName = appList.get(0).getName();
}else {
WxAppinfo appInfo = wxAppinfoService.getCAppInfo(tenantEntity,payw);
appName = appInfo.getName();
WxAppinfo appInfo = wxAppinfoService.getCAppInfo(tenantEntity,payw);
appName = appInfo.getName();
}
Map<String, String> msgReplaceMap = new HashMap();
msgReplaceMap.put("title", title);
@@ -628,7 +628,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService {

@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class})
public void handSel(WxCouponSend wxCouponSend, Long cUserId,EnumPayWay payWay) {
public void handSel(WxCouponSend wxCouponSend, Long cUserId,EnumPayWay payWay,Long bUserId) {

WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(cUserId,wxCouponSend.getFinalTenantId());
if (Objects.isNull(wxCUserBasicInfo)) {
@@ -643,7 +643,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService {
// 发放免费券
WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(cUserId,cs, cs.getCouponId(), cs,payWay);
if (couponOrder != null) {
wxCouponActionLogService.addOne(couponOrder, cs.getCouponId(), couponOrder.getId(), cs.getSendType(), cs.getId());
wxCouponActionLogService.addOne(couponOrder, cs.getCouponId(), couponOrder.getId(), cs.getSendType(), cs.getId(),bUserId);
sendMsgForSendCoupon(couponOrder, cs, couponOrder, wxCUserBasicInfo);
} else {
logger.warn("handSel couponOrder is null");


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java View File

@@ -2017,7 +2017,7 @@ public class WxOrderServiceImpl implements WxOrderService {
}
// couponActionLog
try {
wxCouponActionLogService.addOne(order, order.getProductId(), order.getOrderNumber(), EnumCouponSendSendType.ACTIVE.getCode(), orderSaveDto.getCouponChannelId());
wxCouponActionLogService.addOne(order, order.getProductId(), order.getOrderNumber(), EnumCouponSendSendType.ACTIVE.getCode(), orderSaveDto.getCouponChannelId(),0L);
} catch (Exception e) {
// 库存恢复
stockBack(order);


+ 2
- 1
mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml View File

@@ -346,7 +346,8 @@
LEFT JOIN wx_coupon_order co ON cal.coupon_order_id = co.id
LEFT JOIN wx_coupon c ON cal.coupon_id = c.id
LEFT JOIN wx_c_user_basic_info cu ON cu.id = co.c_user_id
LEFT JOIN wx_merchant_b_user mbu ON concat(mbu.merchant_id,'') = JSON_EXTRACT(cs.conditions , '$.id')
LEFT JOIN wx_merchant_b_user mbu ON mbu.id = cal.operator_id
<!-- and concat(mbu.merchant_id,'') = JSON_EXTRACT(cs.conditions , '$.id') -->
WHERE cal.channel_type = #{channelType}
AND cs.conditions -> '$.id' = concat(#{merchantId},'')
<if test=" null != beginDate ">


Loading…
Cancel
Save