Quellcode durchsuchen

//activity v.2

release_toaliyun_real
xiaohu vor 1 Jahr
Ursprung
Commit
93357da0e9
8 geänderte Dateien mit 152 neuen und 12 gelöschten Zeilen
  1. +1
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxVtwoPrizeDrawActivityController.java
  2. +2
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxVtwoActivityGrant.java
  3. +5
    -5
      mallinkService/src/main/java/com/iformall/domain/po/WxVtwoActivityGrantExport.java
  4. +4
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxVtwoActivityGrantExportMapper.java
  5. +5
    -0
      mallinkService/src/main/java/com/iformall/service/WxVtwoActivityGrantExportService.java
  6. +92
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxVtwoActivityGrantExportServiceImpl.java
  7. +7
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxVtwoActivityGrantSettlementServiceImpl.java
  8. +36
    -7
      mallinkService/src/main/resources/mapper/WxVtwoActivityGrantExportMapper.xml

+ 1
- 0
mallinkAdmin/src/main/java/com/iformall/controller/market/WxVtwoPrizeDrawActivityController.java Datei anzeigen

@@ -301,6 +301,7 @@ public class WxVtwoPrizeDrawActivityController extends BaseController {
// return new ResultData(Result.ERROR,"签名为空");
// }
activityGrant.setCreateBy(getUserId());
activityGrant.setCreateByName(getUser().getName());
try{
wxVtwoPrizeDrawActivityService.grantAward(prizeDrawActivity, activityGrant);
return new ResultData();


+ 2
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxVtwoActivityGrant.java Datei anzeigen

@@ -140,6 +140,8 @@ public class WxVtwoActivityGrant extends TenantEntity {
*/
@TableField(value = "create_by")
private Long createBy;
@TableField(exist = false)
private String createByName;

/**
* 创建时间


+ 5
- 5
mallinkService/src/main/java/com/iformall/domain/po/WxVtwoActivityGrantExport.java Datei anzeigen

@@ -103,31 +103,31 @@ public class WxVtwoActivityGrantExport extends TenantEntity {
/**
* 审批状态
*/
@TableField(value = "order_audit_status")
@TableField(exist = false)
private Integer orderAuditStatus;

/**
* 审核人
*/
@TableField(value = "order_audit_by")
@TableField(exist = false)
private Long orderAuditBy;

/**
*
*/
@TableField(value = "order_audit_name")
@TableField(exist = false)
private String orderAuditName;

/**
* 审批意见
*/
@TableField(value = "order_audit_remark")
@TableField(exist = false)
private String orderAuditRemark;

/**
* 审核时间
*/
@TableField(value = "order_audit_time")
@TableField(exist = false)
private Date orderAuditTime;

/**


+ 4
- 0
mallinkService/src/main/java/com/iformall/mapper/WxVtwoActivityGrantExportMapper.java Datei anzeigen

@@ -3,6 +3,9 @@ package com.iformall.mapper;
import com.iformall.common.CommonMapper;
import com.iformall.domain.po.WxVtwoActivityGrantExport;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* @author xiaohu
@@ -12,6 +15,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface WxVtwoActivityGrantExportMapper extends CommonMapper<WxVtwoActivityGrantExport, Long> {

void insertList(@Param("grantExportList")List<WxVtwoActivityGrantExport> grantExportList);
}




+ 5
- 0
mallinkService/src/main/java/com/iformall/service/WxVtwoActivityGrantExportService.java Datei anzeigen

@@ -1,7 +1,11 @@
package com.iformall.service;

import com.iformall.domain.po.WxVtwoActivityGrant;
import com.iformall.domain.po.WxVtwoActivityGrantExport;
import com.baomidou.mybatisplus.extension.service.IService;
import com.iformall.domain.po.WxVtwoActivityGrantSettlement;

import java.util.List;

/**
* @author xiaohu
@@ -10,4 +14,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface WxVtwoActivityGrantExportService extends IService<WxVtwoActivityGrantExport> {

void saveGrantExport(WxVtwoActivityGrant activityGrant, List<WxVtwoActivityGrantSettlement> settlementList);
}

+ 92
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxVtwoActivityGrantExportServiceImpl.java Datei anzeigen

@@ -1,11 +1,25 @@
package com.iformall.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.iformall.common.IdWorker;
import com.iformall.domain.po.WxVtwoActivityGrant;
import com.iformall.domain.po.WxVtwoActivityGrantExport;
import com.iformall.domain.po.WxVtwoActivityGrantSettlement;
import com.iformall.domain.po.WxVtwoActivityOrder;
import com.iformall.service.WxVtwoActivityGrantExportService;
import com.iformall.mapper.WxVtwoActivityGrantExportMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
* @author xiaohu
* @description 针对表【wx_vtwo_activity_grant_export(线下活动发放奖励导出)】的数据库操作Service实现
@@ -15,6 +29,84 @@ import org.springframework.stereotype.Service;
public class WxVtwoActivityGrantExportServiceImpl extends ServiceImpl<WxVtwoActivityGrantExportMapper, WxVtwoActivityGrantExport>
implements WxVtwoActivityGrantExportService{

@Autowired
private WxVtwoActivityGrantExportMapper wxVtwoActivityGrantExportMapper;

@Override
public void saveGrantExport(WxVtwoActivityGrant activityGrant, List<WxVtwoActivityGrantSettlement> settlementList) {

Map<Long, List<WxVtwoActivityGrantSettlement>> orderSettlementMap = settlementList.stream().collect(Collectors.groupingBy(WxVtwoActivityGrantSettlement::getOrderId));
Map<Long, WxVtwoActivityOrder> orderMap = activityGrant.getOrderList().stream().collect(Collectors.toMap(WxVtwoActivityOrder::getId, Function.identity()));
List<WxVtwoActivityGrantExport> grantExportList = new ArrayList<>();
final IdWorker idWorker = IdWorker.get();
orderSettlementMap.keySet().forEach(orderId -> {
List<WxVtwoActivityGrantSettlement> orderSettlementList = orderSettlementMap.get(orderId);
WxVtwoActivityOrder order = orderMap.get(orderId);

WxVtwoActivityGrantExport grantExport = getGrantExport(order,orderSettlementList);
grantExport.setId(idWorker.nextId());
grantExport.setActivityId(activityGrant.getActivityId());
grantExport.setGrantId(activityGrant.getId());
grantExport.setGrantUserName(activityGrant.getRealName());
grantExport.setGrantUserCard(activityGrant.getRealCard());
grantExport.setGrantBy(activityGrant.getCreateBy());
grantExport.setGrantByName(activityGrant.getCreateByName());
grantExport.setGrantTime(activityGrant.getCreateDate());
grantExport.setGrantRemark(activityGrant.getRemark());
grantExport.setSignImg(activityGrant.getSignImg());


});
wxVtwoActivityGrantExportMapper.insertList(grantExportList);
}

private WxVtwoActivityGrantExport getGrantExport(WxVtwoActivityOrder order,List<WxVtwoActivityGrantSettlement> orderSettlementList){
WxVtwoActivityGrantExport grantExport = new WxVtwoActivityGrantExport();
grantExport.updateTenantInfo(order);
grantExport.setOrderId(order.getId());
grantExport.setOrderNo(order.getOrderNo());
grantExport.setOrderAmount(order.getOrderMoney());
grantExport.setMerchantId(order.getMerchantId());
grantExport.setMerchantName(order.getMerchantName());
grantExport.setMerchantShopNum(order.getShopNumber());
grantExport.setBusinessId(order.getBusinessId());
grantExport.setBusinessName(order.getBusinessName());
grantExport.setLotteryNum(order.getLotteryNumStr());
grantExport.setLotteryNum(order.getLotteryNum());
grantExport.setAnniversaryLotteryNum(order.getAnniversaryLotteryNum());
grantExport.setOrderCreateTime(order.getCreateDate());
grantExport.setVipNum(order.getVipNum());
grantExport.setCusName(order.getCusName());
grantExport.setCusPhone(order.getCusPhone());
grantExport.setCusAddress(order.getCusAddress());
grantExport.setLegionId(order.getLegionId());
grantExport.setLegionName(order.getLegionName());
grantExport.setUnionId(order.getUnionId());
grantExport.setUnionName(order.getUnionName());

grantExport.setGrantDetail(JSONObject.toJSONString(orderSettlementList));
BigDecimal grantPrice = BigDecimal.ZERO;
BigDecimal mallSharePrice = BigDecimal.ZERO;
BigDecimal merchantSharePrice = BigDecimal.ZERO;
BigDecimal taxAmount = BigDecimal.ZERO;
for (WxVtwoActivityGrantSettlement grantSettlement:orderSettlementList){
grantPrice = grantPrice.add(grantSettlement.getOrderGrantPrice());
mallSharePrice = mallSharePrice.add(grantSettlement.getOrderMallSharePrice());
merchantSharePrice = merchantSharePrice.add(grantSettlement.getOrderMerchantSharePrice());
if(grantSettlement.getTaxAmount() != null ){
taxAmount = taxAmount.add(grantSettlement.getTaxAmount());
}
}
grantExport.setGrantPrice(grantPrice);
grantExport.setMallSharePrice(mallSharePrice);
grantExport.setMerchantSharePrice(merchantSharePrice);
grantExport.setMallShareRate(mallSharePrice.divide(grantPrice,4, RoundingMode.HALF_UP)
.multiply(new BigDecimal(100)));
grantExport.setMerchantShareRate(merchantSharePrice.divide(grantPrice,4, RoundingMode.HALF_UP)
.multiply(new BigDecimal(100)));
grantExport.setTaxAmount(taxAmount);
return grantExport;
}
}




+ 7
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxVtwoActivityGrantSettlementServiceImpl.java Datei anzeigen

@@ -5,6 +5,8 @@ import com.iformall.common.IdWorker;
import com.iformall.domain.po.*;
import com.iformall.enums.EnumOfflineActivityAwardsModeType;
import com.iformall.enums.EnumYesOrNo;
import com.iformall.mapper.WxVtwoActivityGrantMapper;
import com.iformall.service.WxVtwoActivityGrantExportService;
import com.iformall.service.WxVtwoActivityGrantSettlementService;
import com.iformall.mapper.WxVtwoActivityGrantSettlementMapper;
import org.springframework.beans.factory.annotation.Autowired;
@@ -31,6 +33,9 @@ public class WxVtwoActivityGrantSettlementServiceImpl extends ServiceImpl<WxVtwo
@Autowired
private WxVtwoActivityGrantSettlementMapper wxVtwoActivityGrantSettlementMapper;

@Autowired
private WxVtwoActivityGrantExportService wxVtwoActivityGrantExportService;

@Override
public void saveGrantSettlement(WxVtwoActivityGrant activityGrant) {
List<WxVtwoActivityOrder> amountOrderList = activityGrant.getOrderList().stream().filter(o -> EnumYesOrNo.YES.getCode().equals(o.getIsAmount()))
@@ -70,6 +75,8 @@ public class WxVtwoActivityGrantSettlementServiceImpl extends ServiceImpl<WxVtwo
}

wxVtwoActivityGrantSettlementMapper.insertList(settlementList);

wxVtwoActivityGrantExportService.saveGrantExport(activityGrant,settlementList);
}

private void handleOrderRatio(List<WxVtwoActivityOrder> orderList){


+ 36
- 7
mallinkService/src/main/resources/mapper/WxVtwoActivityGrantExportMapper.xml Datei anzeigen

@@ -21,11 +21,6 @@
<result property="lotteryCount" column="lottery_count" jdbcType="INTEGER"/>
<result property="anniversaryLotteryNum" column="anniversary_lottery_num" jdbcType="VARCHAR"/>
<result property="orderCreateTime" column="order_create_time" jdbcType="TIMESTAMP"/>
<result property="orderAuditStatus" column="order_audit_status" jdbcType="INTEGER"/>
<result property="orderAuditBy" column="order_audit_by" jdbcType="BIGINT"/>
<result property="orderAuditName" column="order_audit_name" jdbcType="VARCHAR"/>
<result property="orderAuditRemark" column="order_audit_remark" jdbcType="VARCHAR"/>
<result property="orderAuditTime" column="order_audit_time" jdbcType="TIMESTAMP"/>
<result property="vipNum" column="vip_num" jdbcType="VARCHAR"/>
<result property="cusName" column="cus_name" jdbcType="VARCHAR"/>
<result property="cusPhone" column="cus_phone" jdbcType="VARCHAR"/>
@@ -59,8 +54,7 @@
order_amount,merchant_id,merchant_name,
merchant_shop_num,business_id,business_name,
lottery_num,lottery_count,anniversary_lottery_num,
order_create_time,order_audit_status,order_audit_by,
order_audit_name,order_audit_remark,order_audit_time,
order_create_time,
vip_num,cus_name,cus_phone,
cus_card,cus_address,legion_id,
legion_name,union_id,union_name,
@@ -110,4 +104,39 @@
select <include refid="allColumns" /> from wx_vtwo_activity_grant_export
where id = #{id} and tenant_id=#{tenantId}
</select>

<insert id="insertList" parameterType="java.util.List">
insert into wx_vtwo_activity_grant_export
(id,
activity_id,order_id,order_no,
order_amount,merchant_id,merchant_name,
merchant_shop_num,business_id,business_name,
lottery_num,lottery_count,anniversary_lottery_num,
order_create_time,
vip_num,cus_name,cus_phone,
cus_card,cus_address,legion_id,
legion_name,union_id,union_name,
grant_id,grant_user_name,grant_user_card,
grant_by,grant_by_name,grant_time,grant_remark,
sign_img,grant_detail,grant_price,
mall_share_price,merchant_share_price,mall_share_rate,
merchant_share_rate,tax_amount)
values
<foreach collection="grantExportList" item="item" index="index" separator=",">
(#{item.id,jdbcType=BIGINT},
#{item.activityId,jdbcType=BIGINT},#{item.orderId,jdbcType=BIGINT},#{item.orderNo,jdbcType=VARCHAR},
#{item.orderAmount,jdbcType=DECIMAL},#{item.merchantId,jdbcType=BIGINT},#{item.merchantName,jdbcType=VARCHAR},
#{item.merchantShopNum,jdbcType=VARCHAR},#{item.businessId,jdbcType=INTEGER},#{item.businessName,jdbcType=VARCHAR},
#{item.lotteryNum,jdbcType=VARCHAR},#{item.lotteryCount,jdbcType=INTEGER},#{item.anniversaryLotteryNum,jdbcType=VARCHAR},
#{item.orderCreateTime,jdbcType=TIMESTAMP},
#{item.vipNum,jdbcType=VARCHAR},#{item.cusName,jdbcType=VARCHAR},#{item.cusPhone,jdbcType=VARCHAR},
#{item.cusCard,jdbcType=VARCHAR},#{item.cusAddress,jdbcType=VARCHAR},#{itemLegionId,jdbcType=BIGINT},
#{item.legionName,jdbcType=VARCHAR},#{item.unionId,jdbcType=BIGINT},#{item.unionName,jdbcType=VARCHAR},
#{item.grantId,jdbcType=BIGINT},#{item.grantUserName,jdbcType=VARCHAR},#{item.grantUserCard,jdbcType=VARCHAR},
#{item.grantBy,jdbcType=BIGINT},#{item.grantByName,jdbcType=VARCHAR},#{item.grantTime,jdbcType=TIMESTAMP},#{item.grantRemark,jdbcType=VARCHAR},
#{item.signImg,jdbcType=VARCHAR},#{item.grantDetail,jdbcType=VARCHAR},#{item.grantPrice,jdbcType=DECIMAL},
#{item.mallSharePrice,jdbcType=DECIMAL},#{item.merchantSharePrice,jdbcType=DECIMAL},#{item.mallShareRate,jdbcType=DECIMAL},
#{item.merchantShareRate,jdbcType=DECIMAL},#{item.taxAmount,jdbcType=DECIMAL})
</foreach>
</insert>
</mapper>

Laden…
Abbrechen
Speichern