| @@ -263,7 +263,7 @@ public class WxVtwoCashBackActivityController extends BaseController { | |||||
| if(activityGrant.getOrderIdList() == null || activityGrant.getOrderIdList().isEmpty()){ | if(activityGrant.getOrderIdList() == null || activityGrant.getOrderIdList().isEmpty()){ | ||||
| return new ResultData(Result.ERROR,"请选择订单"); | return new ResultData(Result.ERROR,"请选择订单"); | ||||
| } | } | ||||
| WxVtwoCashBackActivity cashBackActivity = wxVtwoCashBackActivityService.getById(activityGrant.getActivityId(), activityGrant.getTenantId()); | |||||
| WxVtwoCashBackActivity cashBackActivity = wxVtwoCashBackActivityService.getInfoById(activityGrant.getActivityId(), activityGrant.getTenantId()); | |||||
| if(cashBackActivity == null){ | if(cashBackActivity == null){ | ||||
| return new ResultData(Result.ERROR,"查询不到活动"); | return new ResultData(Result.ERROR,"查询不到活动"); | ||||
| } | } | ||||
| @@ -65,7 +65,7 @@ public class WxVtwoActivityGrantAwardServiceImpl extends ServiceImpl<WxVtwoActiv | |||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| for(WxVtwoActivityGrantAward grantAward : grantAwardList){ | for(WxVtwoActivityGrantAward grantAward : grantAwardList){ | ||||
| grantAward.setAwardId(idWorker.nextId()); | |||||
| grantAward.setId(idWorker.nextId()); | |||||
| grantAward.updateTenantInfo(activityGrant); | grantAward.updateTenantInfo(activityGrant); | ||||
| grantAward.setActivityId(activityGrant.getActivityId()); | grantAward.setActivityId(activityGrant.getActivityId()); | ||||
| grantAward.setActivityName(activityGrant.getActivityName()); | grantAward.setActivityName(activityGrant.getActivityName()); | ||||
| @@ -61,7 +61,7 @@ public class WxVtwoActivityGrantExportServiceImpl extends ServiceImpl<WxVtwoActi | |||||
| grantExport.setGrantRemark(activityGrant.getRemark()); | grantExport.setGrantRemark(activityGrant.getRemark()); | ||||
| grantExport.setSignImg(activityGrant.getSignImg()); | grantExport.setSignImg(activityGrant.getSignImg()); | ||||
| grantExportList.add(grantExport); | |||||
| }); | }); | ||||
| wxVtwoActivityGrantExportMapper.insertList(grantExportList); | wxVtwoActivityGrantExportMapper.insertList(grantExportList); | ||||
| } | } | ||||
| @@ -137,6 +137,8 @@ public class WxVtwoActivityGrantExportServiceImpl extends ServiceImpl<WxVtwoActi | |||||
| grantExport.setGrantTime(activityGrant.getCreateDate()); | grantExport.setGrantTime(activityGrant.getCreateDate()); | ||||
| grantExport.setGrantRemark(activityGrant.getRemark()); | grantExport.setGrantRemark(activityGrant.getRemark()); | ||||
| grantExport.setSignImg(activityGrant.getSignImg()); | grantExport.setSignImg(activityGrant.getSignImg()); | ||||
| grantExportList.add(grantExport); | |||||
| }); | }); | ||||
| wxVtwoActivityGrantExportMapper.insertList(grantExportList); | wxVtwoActivityGrantExportMapper.insertList(grantExportList); | ||||
| } | } | ||||
| @@ -106,6 +106,7 @@ public class WxVtwoActivityGrantSettlementServiceImpl extends ServiceImpl<WxVtwo | |||||
| .multiply(settlement.getMallShareRate().divide(new BigDecimal(100))) | .multiply(settlement.getMallShareRate().divide(new BigDecimal(100))) | ||||
| .setScale(2, RoundingMode.HALF_UP)); | .setScale(2, RoundingMode.HALF_UP)); | ||||
| settlement.setOrderMerchantSharePrice(settlement.getOrderGrantPrice().subtract(settlement.getOrderMallSharePrice())); | settlement.setOrderMerchantSharePrice(settlement.getOrderGrantPrice().subtract(settlement.getOrderMallSharePrice())); | ||||
| settlement.setTaxAmount(BigDecimal.ZERO); | |||||
| settlement.setCreateDate(grant.getUpdateDate()); | settlement.setCreateDate(grant.getUpdateDate()); | ||||
| settlement.setUpdateDate(grant.getUpdateDate()); | settlement.setUpdateDate(grant.getUpdateDate()); | ||||
| return settlement; | return settlement; | ||||
| @@ -199,11 +200,9 @@ public class WxVtwoActivityGrantSettlementServiceImpl extends ServiceImpl<WxVtwo | |||||
| .multiply(settlement.getMallShareRate().divide(new BigDecimal(100))) | .multiply(settlement.getMallShareRate().divide(new BigDecimal(100))) | ||||
| .setScale(2, RoundingMode.HALF_UP)); | .setScale(2, RoundingMode.HALF_UP)); | ||||
| settlement.setOrderMerchantSharePrice(settlement.getOrderGrantPrice().subtract(settlement.getOrderMallSharePrice())); | settlement.setOrderMerchantSharePrice(settlement.getOrderGrantPrice().subtract(settlement.getOrderMallSharePrice())); | ||||
| if(grant.getTaxAmount() != null){ | |||||
| settlement.setTaxAmount(grant.getTaxAmount() | |||||
| .multiply(settlement.getOrderRatio().divide(new BigDecimal(100))) | |||||
| .setScale(2, RoundingMode.HALF_UP)); | |||||
| } | |||||
| settlement.setTaxAmount(grant.getTaxAmount() | |||||
| .multiply(settlement.getOrderRatio().divide(new BigDecimal(100))) | |||||
| .setScale(2, RoundingMode.HALF_UP)); | |||||
| settlement.setCreateDate(grant.getUpdateDate()); | settlement.setCreateDate(grant.getUpdateDate()); | ||||
| settlement.setUpdateDate(grant.getUpdateDate()); | settlement.setUpdateDate(grant.getUpdateDate()); | ||||
| return settlement; | return settlement; | ||||
| @@ -146,6 +146,7 @@ public class WxVtwoCashBackGrantAwardServiceImpl extends ServiceImpl<WxVtwoCashB | |||||
| BigDecimal taxAmount = BigDecimal.ZERO; | BigDecimal taxAmount = BigDecimal.ZERO; | ||||
| for (WxVtwoCashBackGrantAward grantAward:grantAwardList){ | for (WxVtwoCashBackGrantAward grantAward:grantAwardList){ | ||||
| grantAward.setTaxDeductionRules(cashBackActivity.getTaxDeductionRules()); | grantAward.setTaxDeductionRules(cashBackActivity.getTaxDeductionRules()); | ||||
| grantAward.setTaxAmount(BigDecimal.ZERO); | |||||
| WxVtwoActivityTaxDeductionRule taxDeductionRulesObject = cashBackActivity.getTaxDeductionRulesObject(); | WxVtwoActivityTaxDeductionRule taxDeductionRulesObject = cashBackActivity.getTaxDeductionRulesObject(); | ||||
| if(taxDeductionRulesObject.getStartingTax() != null && grantAward.getCashBack().compareTo(taxDeductionRulesObject.getStartingTax()) > 0 | if(taxDeductionRulesObject.getStartingTax() != null && grantAward.getCashBack().compareTo(taxDeductionRulesObject.getStartingTax()) > 0 | ||||
| && taxDeductionRulesObject.getTaxPoints() != null){ | && taxDeductionRulesObject.getTaxPoints() != null){ | ||||
| @@ -157,17 +158,17 @@ public class WxVtwoCashBackGrantAwardServiceImpl extends ServiceImpl<WxVtwoCashB | |||||
| activityGrant.setTaxAmount(taxAmount); | activityGrant.setTaxAmount(taxAmount); | ||||
| }else{ | }else{ | ||||
| activityGrant.setTaxDeductionRules(cashBackActivity.getTaxDeductionRules()); | activityGrant.setTaxDeductionRules(cashBackActivity.getTaxDeductionRules()); | ||||
| activityGrant.setTaxAmount(BigDecimal.ZERO); | |||||
| WxVtwoActivityTaxDeductionRule taxDeductionRulesObject = cashBackActivity.getTaxDeductionRulesObject(); | WxVtwoActivityTaxDeductionRule taxDeductionRulesObject = cashBackActivity.getTaxDeductionRulesObject(); | ||||
| if(taxDeductionRulesObject.getStartingTax() != null && activityGrant.getCashBack().compareTo(taxDeductionRulesObject.getStartingTax()) > 0 | if(taxDeductionRulesObject.getStartingTax() != null && activityGrant.getCashBack().compareTo(taxDeductionRulesObject.getStartingTax()) > 0 | ||||
| && taxDeductionRulesObject.getTaxPoints() != null){ | && taxDeductionRulesObject.getTaxPoints() != null){ | ||||
| activityGrant.setTaxAmount(activityGrant.getCashBack().multiply(taxDeductionRulesObject.getTaxPoints()) | activityGrant.setTaxAmount(activityGrant.getCashBack().multiply(taxDeductionRulesObject.getTaxPoints()) | ||||
| .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)); | .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)); | ||||
| //税点分摊到发奖上面 | |||||
| for (WxVtwoCashBackGrantAward grantAward:grantAwardList){ | |||||
| BigDecimal taxAmountProp = grantAward.getCashBack().divide(activityGrant.getCashBack(),4,RoundingMode.HALF_UP);; | |||||
| grantAward.setTaxAmount(activityGrant.getTaxAmount().multiply(taxAmountProp).setScale(2, RoundingMode.HALF_UP)); | |||||
| } | |||||
| } | |||||
| //税点分摊到发奖上面 | |||||
| for (WxVtwoCashBackGrantAward grantAward:grantAwardList){ | |||||
| BigDecimal taxAmountProp = grantAward.getCashBack().divide(activityGrant.getCashBack(),4,RoundingMode.HALF_UP);; | |||||
| grantAward.setTaxAmount(activityGrant.getTaxAmount().multiply(taxAmountProp).setScale(2, RoundingMode.HALF_UP)); | |||||
| } | } | ||||
| } | } | ||||
| activityGrant.setGrantAwardList(grantAwardList); | activityGrant.setGrantAwardList(grantAwardList); | ||||
| @@ -136,7 +136,7 @@ | |||||
| #{item.lotteryNum,jdbcType=VARCHAR},#{item.lotteryCount,jdbcType=INTEGER},#{item.anniversaryLotteryNum,jdbcType=VARCHAR}, | #{item.lotteryNum,jdbcType=VARCHAR},#{item.lotteryCount,jdbcType=INTEGER},#{item.anniversaryLotteryNum,jdbcType=VARCHAR}, | ||||
| #{item.orderCreateTime,jdbcType=TIMESTAMP}, | #{item.orderCreateTime,jdbcType=TIMESTAMP}, | ||||
| #{item.vipNum,jdbcType=VARCHAR},#{item.cusName,jdbcType=VARCHAR},#{item.cusPhone,jdbcType=VARCHAR}, | #{item.vipNum,jdbcType=VARCHAR},#{item.cusName,jdbcType=VARCHAR},#{item.cusPhone,jdbcType=VARCHAR}, | ||||
| #{item.cusCard,jdbcType=VARCHAR},#{item.cusAddress,jdbcType=VARCHAR},#{itemLegionId,jdbcType=BIGINT}, | |||||
| #{item.cusCard,jdbcType=VARCHAR},#{item.cusAddress,jdbcType=VARCHAR},#{item.legionId,jdbcType=BIGINT}, | |||||
| #{item.legionName,jdbcType=VARCHAR},#{item.unionId,jdbcType=BIGINT},#{item.unionName,jdbcType=VARCHAR}, | #{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.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.grantBy,jdbcType=BIGINT},#{item.grantByName,jdbcType=VARCHAR},#{item.grantTime,jdbcType=TIMESTAMP},#{item.grantRemark,jdbcType=VARCHAR}, | ||||
| @@ -69,12 +69,12 @@ | |||||
| insert into wx_vtwo_activity_grant_order | insert into wx_vtwo_activity_grant_order | ||||
| (id, | (id, | ||||
| grant_id,activity_id,order_id, | grant_id,activity_id,order_id, | ||||
| is_amount, status) | |||||
| is_amount) | |||||
| values | values | ||||
| <foreach collection="grantOrderList" item="item" index="index" separator=","> | <foreach collection="grantOrderList" item="item" index="index" separator=","> | ||||
| (#{item.id,jdbcType=BIGINT}, | (#{item.id,jdbcType=BIGINT}, | ||||
| #{item.grantId,jdbcType=BIGINT},#{item.activityId,jdbcType=BIGINT},#{item.orderId,jdbcType=BIGINT}, | #{item.grantId,jdbcType=BIGINT},#{item.activityId,jdbcType=BIGINT},#{item.orderId,jdbcType=BIGINT}, | ||||
| #{item.isAmount,jdbcType=SMALLINT},#{item.status,jdbcType=SMALLINT}) | |||||
| #{item.isAmount,jdbcType=SMALLINT}) | |||||
| </foreach> | </foreach> | ||||
| </insert> | </insert> | ||||
| </mapper> | </mapper> | ||||