| @@ -325,7 +325,7 @@ public class WxVtwoAmountGiftActivityController extends BaseController { | |||
| throw new MallinkException(Result.ERROR,"活动ID 为空"); | |||
| } | |||
| activityGrant.updateTenantInfo(getTenantInfo()); | |||
| wxVtwoAmountGiftActivityService.grantExport(request,response,activityGrant); | |||
| wxVtwoAmountGiftActivityService.grantExportTwo(request,response,activityGrant); | |||
| } | |||
| } | |||
| @@ -366,7 +366,7 @@ public class WxVtwoCashBackActivityController extends BaseController { | |||
| throw new MallinkException(Result.ERROR,"活动ID 为空"); | |||
| } | |||
| activityGrant.updateTenantInfo(getTenantInfo()); | |||
| wxVtwoCashBackActivityService.grantExport(request,response,activityGrant); | |||
| wxVtwoCashBackActivityService.grantExportTwo(request,response,activityGrant); | |||
| } | |||
| } | |||
| @@ -326,7 +326,7 @@ public class WxVtwoPrizeDrawActivityController extends BaseController { | |||
| throw new MallinkException(Result.ERROR,"活动ID 为空"); | |||
| } | |||
| activityGrant.updateTenantInfo(getTenantInfo()); | |||
| wxVtwoPrizeDrawActivityService.grantExport(request,response,activityGrant); | |||
| wxVtwoPrizeDrawActivityService.grantExportTwo(request,response,activityGrant); | |||
| } | |||
| } | |||
| @@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import lombok.Data; | |||
| /** | |||
| @@ -104,12 +106,18 @@ public class WxVtwoActivityGrantAward extends TenantEntity { | |||
| @TableField(value = "mall_share_rate") | |||
| private BigDecimal mallShareRate; | |||
| @TableField(exist = false) | |||
| private BigDecimal mallSharePrice; | |||
| /** | |||
| * 商户分担比例 | |||
| */ | |||
| @TableField(value = "merchant_share_rate") | |||
| private BigDecimal merchantShareRate; | |||
| @TableField(exist = false) | |||
| private BigDecimal merchantSharePrice; | |||
| /** | |||
| * | |||
| */ | |||
| @@ -132,4 +140,7 @@ public class WxVtwoActivityGrantAward extends TenantEntity { | |||
| */ | |||
| @TableField(value = "update_date") | |||
| private Date updateDate; | |||
| @TableField(exist = false) | |||
| private List<WxVtwoActivityGrantSettlement> grantSettlementList; | |||
| } | |||
| @@ -0,0 +1,197 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.IdType; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableId; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import lombok.Data; | |||
| /** | |||
| * 线下活动发奖导出 | |||
| * @TableName wx_vtwo_activity_grant_export_two | |||
| */ | |||
| @TableName(value ="wx_vtwo_activity_grant_export_two") | |||
| @Data | |||
| public class WxVtwoActivityGrantExportTwo extends TenantEntity { | |||
| /** | |||
| * 主键ID | |||
| */ | |||
| @TableId(value = "id") | |||
| private Long id; | |||
| /** | |||
| * 活动ID | |||
| */ | |||
| @TableField(value = "activity_id") | |||
| private Long activityId; | |||
| /** | |||
| * | |||
| */ | |||
| @TableField(value = "activity_type") | |||
| private Integer activityType; | |||
| /** | |||
| * | |||
| */ | |||
| @TableField(value = "activity_name") | |||
| private String activityName; | |||
| /** | |||
| * 订单总金额 | |||
| */ | |||
| @TableField(value = "order_money_sum") | |||
| private BigDecimal orderMoneySum; | |||
| /** | |||
| * 订单数量 | |||
| */ | |||
| @TableField(value = "order_count") | |||
| private Integer orderCount; | |||
| /** | |||
| * 客户姓名 | |||
| */ | |||
| @TableField(value = "cus_name") | |||
| private String cusName; | |||
| /** | |||
| * 客户电话 | |||
| */ | |||
| @TableField(value = "cus_phone") | |||
| private String cusPhone; | |||
| /** | |||
| * 抽奖券编码 | |||
| */ | |||
| @TableField(value = "lottery_num") | |||
| private String lotteryNum; | |||
| /** | |||
| * 抽奖券数量 | |||
| */ | |||
| @TableField(value = "lottery_count") | |||
| private Integer lotteryCount; | |||
| /** | |||
| * 周年庆抽奖编码 | |||
| */ | |||
| @TableField(value = "anniversary_lottery_num") | |||
| private String anniversaryLotteryNum; | |||
| /** | |||
| * 实际领奖人 | |||
| */ | |||
| @TableField(value = "real_name") | |||
| private String realName; | |||
| /** | |||
| * 实际领奖人身份证号 | |||
| */ | |||
| @TableField(value = "real_card") | |||
| private String realCard; | |||
| /** | |||
| * | |||
| */ | |||
| @TableField(value = "remark") | |||
| private String remark; | |||
| /** | |||
| * 签名图片 | |||
| */ | |||
| @TableField(value = "sign_img") | |||
| private String signImg; | |||
| /** | |||
| * | |||
| */ | |||
| @TableField(value = "status") | |||
| private Integer status; | |||
| /** | |||
| * | |||
| */ | |||
| @TableField(value = "grant_by") | |||
| private Long grantBy; | |||
| /** | |||
| * | |||
| */ | |||
| @TableField(value = "grant_by_name") | |||
| private String grantByName; | |||
| /** | |||
| * 创建时间 | |||
| */ | |||
| @TableField(value = "grant_time") | |||
| private Date grantTime; | |||
| /** | |||
| * 订单信息 | |||
| */ | |||
| @TableField(value = "order_detail") | |||
| private String orderDetail; | |||
| @TableField(exist = false) | |||
| private List<WxVtwoActivityOrder> orderList; | |||
| /** | |||
| * 订单发奖 | |||
| */ | |||
| @TableField(value = "order_grant_detail") | |||
| private String orderGrantDetail; | |||
| @TableField(exist = false) | |||
| private List<WxVtwoActivityGrantAward> orderGrantList; | |||
| /** | |||
| * | |||
| */ | |||
| @TableField(value = "order_grant_count") | |||
| private Integer orderGrantCount; | |||
| /** | |||
| * 联单发奖 | |||
| */ | |||
| @TableField(value = "joint_grant_detail") | |||
| private String jointGrantDetail; | |||
| @TableField(exist = false) | |||
| private List<WxVtwoActivityGrantAward> jointGrantList; | |||
| /** | |||
| * | |||
| */ | |||
| @TableField(value = "joint_grant_count") | |||
| private Integer jointGrantCount; | |||
| /** | |||
| * 返现金额限制 | |||
| */ | |||
| @TableField(value = "cash_back_limit") | |||
| private BigDecimal cashBackLimit; | |||
| /** | |||
| * 返现金额 | |||
| */ | |||
| @TableField(value = "cash_back") | |||
| private BigDecimal cashBack; | |||
| /** | |||
| * 扣税规则 | |||
| */ | |||
| @TableField(value = "tax_deduction_rules") | |||
| private String taxDeductionRules; | |||
| /** | |||
| * 税点金额 | |||
| */ | |||
| @TableField(value = "tax_amount") | |||
| private BigDecimal taxAmount; | |||
| } | |||
| @@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import lombok.Data; | |||
| /** | |||
| @@ -122,12 +124,18 @@ public class WxVtwoCashBackGrantAward extends TenantEntity { | |||
| @TableField(value = "mall_share_rate") | |||
| private BigDecimal mallShareRate; | |||
| @TableField(exist = false) | |||
| private BigDecimal mallSharePrice; | |||
| /** | |||
| * 商户分担比例 | |||
| */ | |||
| @TableField(value = "merchant_share_rate") | |||
| private BigDecimal merchantShareRate; | |||
| @TableField(exist = false) | |||
| private BigDecimal merchantSharePrice; | |||
| /** | |||
| * 扣税规则 | |||
| */ | |||
| @@ -162,4 +170,7 @@ public class WxVtwoCashBackGrantAward extends TenantEntity { | |||
| */ | |||
| @TableField(value = "update_date") | |||
| private Date updateDate; | |||
| @TableField(exist = false) | |||
| private List<WxVtwoActivityGrantSettlement> grantSettlementList; | |||
| } | |||
| @@ -0,0 +1,26 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxVtwoActivityGrantExportTwo; | |||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
| import java.util.List; | |||
| /** | |||
| * @author xiaohu | |||
| * @description 针对表【wx_vtwo_activity_grant_export_two(线下活动发奖)】的数据库操作Mapper | |||
| * @createDate 2025-07-30 17:31:55 | |||
| * @Entity com.iformall.domain.po.WxVtwoActivityGrantExportTwo | |||
| */ | |||
| public interface WxVtwoActivityGrantExportTwoMapper extends CommonMapper<WxVtwoActivityGrantExportTwo,Long> { | |||
| List<WxVtwoActivityGrantExportTwo> findList(WxVtwoActivityGrantExportTwo wxVtwoActivityGrantExportTwo); | |||
| Integer selectMaxOrderGrantCount(WxVtwoActivityGrantExportTwo wxVtwoActivityGrantExportTwo); | |||
| Integer selectMaxJointGrantCount(WxVtwoActivityGrantExportTwo wxVtwoActivityGrantExportTwo); | |||
| } | |||
| @@ -18,6 +18,8 @@ public interface WxVtwoActivityGrantOrderMapper extends CommonMapper<WxVtwoActiv | |||
| void insertList(@Param("grantOrderList")List<WxVtwoActivityGrantOrder> grantOrderList); | |||
| List<WxVtwoActivityGrantOrder> findOrderNoList(@Param("grantId")Long grantId, @Param("tenantId")String tenantId); | |||
| List<Long> findIdList(WxVtwoActivityGrantOrder grantOrderQ); | |||
| } | |||
| @@ -0,0 +1,30 @@ | |||
| package com.iformall.service; | |||
| import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; | |||
| import com.iformall.domain.po.WxVtwoActivityGrant; | |||
| import com.iformall.domain.po.WxVtwoActivityGrantExportTwo; | |||
| import com.baomidou.mybatisplus.extension.service.IService; | |||
| import com.iformall.domain.po.WxVtwoActivityGrantSettlement; | |||
| import com.iformall.domain.po.WxVtwoCashBackGrant; | |||
| import java.util.List; | |||
| /** | |||
| * @author xiaohu | |||
| * @description 针对表【wx_vtwo_activity_grant_export_two(线下活动发奖)】的数据库操作Service | |||
| * @createDate 2025-07-30 17:31:55 | |||
| */ | |||
| public interface WxVtwoActivityGrantExportTwoService extends IService<WxVtwoActivityGrantExportTwo> { | |||
| void saveGrantExport(WxVtwoActivityGrant activityGrant, List<WxVtwoActivityGrantSettlement> settlementList); | |||
| void saveGrantExport(WxVtwoCashBackGrant activityGrant, List<WxVtwoActivityGrantSettlement> settlementList); | |||
| List<ExcelExportEntity> getExportHeadList(); | |||
| List<WxVtwoActivityGrantExportTwo> findActivityGrantList(Long activityId, String tenantId); | |||
| Integer selectMaxOrderGrantCount(Long activityId, String tenantId); | |||
| Integer selectMaxJointGrantCount(Long activityId, String tenantId); | |||
| } | |||
| @@ -28,4 +28,6 @@ public interface WxVtwoAmountGiftActivityService extends IService<WxVtwoAmountGi | |||
| void grantAward(WxVtwoAmountGiftActivity amountGiftActivity,WxVtwoActivityGrant activityGrant); | |||
| void grantExport(HttpServletRequest request, HttpServletResponse response, WxVtwoActivityGrant activityGrant); | |||
| void grantExportTwo(HttpServletRequest request, HttpServletResponse response, WxVtwoActivityGrant activityGrant); | |||
| } | |||
| @@ -30,4 +30,5 @@ public interface WxVtwoCashBackActivityService extends IService<WxVtwoCashBackAc | |||
| void grantExport(HttpServletRequest request, HttpServletResponse response, WxVtwoCashBackGrant activityGrant); | |||
| void grantExportTwo(HttpServletRequest request, HttpServletResponse response, WxVtwoCashBackGrant activityGrant); | |||
| } | |||
| @@ -32,4 +32,6 @@ public interface WxVtwoPrizeDrawActivityService extends IService<WxVtwoPrizeDraw | |||
| void grantAward(WxVtwoPrizeDrawActivity prizeDrawActivity,WxVtwoActivityGrant activityGrant); | |||
| void grantExport(HttpServletRequest request, HttpServletResponse response, WxVtwoActivityGrant activityGrant); | |||
| void grantExportTwo(HttpServletRequest request, HttpServletResponse response, WxVtwoActivityGrant activityGrant); | |||
| } | |||
| @@ -1588,7 +1588,7 @@ public class WxOfflineActivityGrantAwardServiceImpl implements WxOfflineActivity | |||
| entity14_list.add(entity14_6); | |||
| ExcelExportEntity entity14_7 = new ExcelExportEntity("商管承担金额","mallSharePrice",20); | |||
| entity14_list.add(entity14_7); | |||
| ExcelExportEntity entity14_8 = new ExcelExportEntity("商户承担比例","merchantSharePrice",20); | |||
| ExcelExportEntity entity14_8 = new ExcelExportEntity("商户承担金额","merchantSharePrice",20); | |||
| entity14_list.add(entity14_8); | |||
| entity14.setList(entity14_list); | |||
| headList.add(entity14); | |||
| @@ -77,8 +77,8 @@ public class WxVtwoActivityGrantExportServiceImpl extends ServiceImpl<WxVtwoActi | |||
| grantExport.setMerchantShopNum(order.getShopNumber()); | |||
| grantExport.setBusinessId(order.getBusinessId()); | |||
| grantExport.setBusinessName(order.getBusinessName()); | |||
| grantExport.setLotteryNum(order.getLotteryNumStr()); | |||
| grantExport.setLotteryNum(order.getLotteryNum()); | |||
| grantExport.setLotteryCount(order.getLotteryCount()); | |||
| grantExport.setAnniversaryLotteryNum(order.getAnniversaryLotteryNum()); | |||
| grantExport.setOrderCreateTime(order.getCreateDate()); | |||
| grantExport.setVipNum(order.getVipNum()); | |||
| @@ -0,0 +1,278 @@ | |||
| package com.iformall.service.impl; | |||
| import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.enums.EnumOfflineActivityAwardsModeType; | |||
| import com.iformall.mapper.WxVtwoActivityGrantOrderMapper; | |||
| import com.iformall.service.WxVtwoActivityGrantExportTwoService; | |||
| import com.iformall.mapper.WxVtwoActivityGrantExportTwoMapper; | |||
| import com.iformall.service.WxVtwoActivityOrderService; | |||
| import org.springframework.beans.BeanUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.lang.reflect.InvocationTargetException; | |||
| import java.util.ArrayList; | |||
| import java.util.Collections; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.function.Function; | |||
| import java.util.stream.Collectors; | |||
| import static java.util.stream.Collectors.counting; | |||
| import static java.util.stream.Collectors.groupingBy; | |||
| /** | |||
| * @author xiaohu | |||
| * @description 针对表【wx_vtwo_activity_grant_export_two(线下活动发奖)】的数据库操作Service实现 | |||
| * @createDate 2025-07-30 17:31:55 | |||
| */ | |||
| @Service | |||
| public class WxVtwoActivityGrantExportTwoServiceImpl extends ServiceImpl<WxVtwoActivityGrantExportTwoMapper, WxVtwoActivityGrantExportTwo> | |||
| implements WxVtwoActivityGrantExportTwoService{ | |||
| @Autowired | |||
| private WxVtwoActivityGrantExportTwoMapper wxVtwoActivityGrantExportTwoMapper; | |||
| @Autowired | |||
| private WxVtwoActivityGrantOrderMapper wxVtwoActivityGrantOrderMapper; | |||
| @Autowired | |||
| private WxVtwoActivityOrderService wxVtwoActivityOrderService; | |||
| @Override | |||
| public void saveGrantExport(WxVtwoActivityGrant activityGrant, List<WxVtwoActivityGrantSettlement> settlementList) { | |||
| WxVtwoActivityGrantExportTwo wxVtwoActivityGrantExportTwo = new WxVtwoActivityGrantExportTwo(); | |||
| BeanUtils.copyProperties(activityGrant, wxVtwoActivityGrantExportTwo); | |||
| wxVtwoActivityGrantExportTwo.setGrantBy(activityGrant.getCreateBy()); | |||
| wxVtwoActivityGrantExportTwo.setGrantByName(activityGrant.getCreateByName()); | |||
| wxVtwoActivityGrantExportTwo.setGrantTime(activityGrant.getCreateDate()); | |||
| wxVtwoActivityGrantExportTwo.setOrderDetail(JSONObject.toJSONString(activityGrant.getOrderList())); | |||
| Map<Integer, List<WxVtwoActivityGrantAward>> grantAwardMap = activityGrant.getGrantAwardList().stream().collect(groupingBy(WxVtwoActivityGrantAward::getModeType)); | |||
| Map<Long, List<WxVtwoActivityGrantSettlement>> grantSettlementMap = settlementList.stream().collect(groupingBy(WxVtwoActivityGrantSettlement::getGrantAwardId)); | |||
| List<WxVtwoActivityGrantAward> orderGrantAwardList = grantAwardMap.get(EnumOfflineActivityAwardsModeType.AMOUNT.getCode()); | |||
| Integer orderGrantCount = 0; | |||
| if(orderGrantAwardList != null && !orderGrantAwardList.isEmpty()){ | |||
| Long value = orderGrantAwardList.stream().collect(groupingBy(orderGrantAward -> String.valueOf(orderGrantAward.getModeType()) + String.valueOf(orderGrantAward.getOrderId()), counting())) | |||
| .entrySet().stream().max(Map.Entry.comparingByValue()).get().getValue(); | |||
| orderGrantCount = value.intValue(); | |||
| orderGrantAwardList.forEach(orderGrantAward -> { | |||
| orderGrantAward.setGrantSettlementList(grantSettlementMap.get(orderGrantAward.getId())); | |||
| }); | |||
| } | |||
| List<WxVtwoActivityGrantAward> jointGrantAwardList = grantAwardMap.get(EnumOfflineActivityAwardsModeType.COUNT.getCode()); | |||
| Integer jointGrantCount = 0; | |||
| if (jointGrantAwardList != null && !jointGrantAwardList.isEmpty()){ | |||
| jointGrantCount = jointGrantAwardList.size(); | |||
| jointGrantAwardList.forEach(jointGrantAward -> { | |||
| jointGrantAward.setGrantSettlementList(grantSettlementMap.get(jointGrantAward.getId())); | |||
| }); | |||
| } | |||
| wxVtwoActivityGrantExportTwo.setOrderGrantDetail(JSONObject.toJSONString(orderGrantAwardList)); | |||
| wxVtwoActivityGrantExportTwo.setOrderGrantCount(orderGrantCount); | |||
| wxVtwoActivityGrantExportTwo.setJointGrantDetail(JSONObject.toJSONString(jointGrantAwardList)); | |||
| wxVtwoActivityGrantExportTwo.setJointGrantCount(jointGrantCount); | |||
| wxVtwoActivityGrantExportTwoMapper.insert(wxVtwoActivityGrantExportTwo); | |||
| } | |||
| @Override | |||
| public void saveGrantExport(WxVtwoCashBackGrant activityGrant, List<WxVtwoActivityGrantSettlement> settlementList) { | |||
| WxVtwoActivityGrantExportTwo wxVtwoActivityGrantExportTwo = new WxVtwoActivityGrantExportTwo(); | |||
| BeanUtils.copyProperties(activityGrant, wxVtwoActivityGrantExportTwo); | |||
| wxVtwoActivityGrantExportTwo.setGrantBy(activityGrant.getCreateBy()); | |||
| wxVtwoActivityGrantExportTwo.setGrantByName(activityGrant.getCreateByName()); | |||
| wxVtwoActivityGrantExportTwo.setGrantTime(activityGrant.getCreateDate()); | |||
| wxVtwoActivityGrantExportTwo.setOrderDetail(JSONObject.toJSONString(activityGrant.getOrderList())); | |||
| Map<Integer, List<WxVtwoCashBackGrantAward>> grantAwardMap = activityGrant.getGrantAwardList().stream().collect(groupingBy(WxVtwoCashBackGrantAward::getModeType)); | |||
| Map<Long, List<WxVtwoActivityGrantSettlement>> grantSettlementMap = settlementList.stream().collect(groupingBy(WxVtwoActivityGrantSettlement::getGrantAwardId)); | |||
| List<WxVtwoCashBackGrantAward> orderGrantAwardList = grantAwardMap.get(EnumOfflineActivityAwardsModeType.AMOUNT.getCode()); | |||
| Integer orderGrantCount = 0; | |||
| if(orderGrantAwardList != null && !orderGrantAwardList.isEmpty()){ | |||
| orderGrantCount = 1; | |||
| // Long value = orderGrantAwardList.stream().collect(groupingBy(orderGrantAward -> String.valueOf(orderGrantAward.getModeType()) + String.valueOf(orderGrantAward.getOrderId()), counting())) | |||
| // .entrySet().stream().max(Map.Entry.comparingByValue()).get().getValue(); | |||
| // orderGrantCount = value.intValue(); | |||
| orderGrantAwardList.forEach(orderGrantAward -> { | |||
| orderGrantAward.setGrantSettlementList(grantSettlementMap.get(orderGrantAward.getId())); | |||
| }); | |||
| } | |||
| List<WxVtwoCashBackGrantAward> jointGrantAwardList = grantAwardMap.get(EnumOfflineActivityAwardsModeType.COUNT.getCode()); | |||
| Integer jointGrantCount = 0; | |||
| if (jointGrantAwardList != null && !jointGrantAwardList.isEmpty()){ | |||
| jointGrantCount = jointGrantAwardList.size(); | |||
| jointGrantAwardList.forEach(jointGrantAward -> { | |||
| jointGrantAward.setGrantSettlementList(grantSettlementMap.get(jointGrantAward.getId())); | |||
| }); | |||
| } | |||
| wxVtwoActivityGrantExportTwo.setOrderGrantDetail(JSONObject.toJSONString(orderGrantAwardList)); | |||
| wxVtwoActivityGrantExportTwo.setOrderGrantCount(orderGrantCount); | |||
| wxVtwoActivityGrantExportTwo.setJointGrantDetail(JSONObject.toJSONString(jointGrantAwardList)); | |||
| wxVtwoActivityGrantExportTwo.setJointGrantCount(jointGrantCount); | |||
| wxVtwoActivityGrantExportTwoMapper.insert(wxVtwoActivityGrantExportTwo); | |||
| } | |||
| @Override | |||
| public List<ExcelExportEntity> getExportHeadList() { | |||
| List<ExcelExportEntity> headList = new ArrayList<>(); | |||
| ExcelExportEntity entity1 = new ExcelExportEntity("客户姓名","cusName",20); | |||
| entity1.setNeedMerge(true); | |||
| headList.add(entity1); | |||
| ExcelExportEntity entity2 = new ExcelExportEntity("客户电话","cusPhone",20); | |||
| entity2.setNeedMerge(true); | |||
| headList.add(entity2); | |||
| ExcelExportEntity entity3 = new ExcelExportEntity("订单数量","orderCount",20); | |||
| entity3.setNeedMerge(true); | |||
| headList.add(entity3); | |||
| ExcelExportEntity entity4 = new ExcelExportEntity("订单总金额","orderMoneySum",20); | |||
| entity4.setNeedMerge(true); | |||
| headList.add(entity4); | |||
| ExcelExportEntity entity5 = new ExcelExportEntity("领奖人","realName",20); | |||
| entity5.setNeedMerge(true); | |||
| headList.add(entity5); | |||
| ExcelExportEntity entity6 = new ExcelExportEntity("领奖人身份证号","realCard",20); | |||
| entity6.setNeedMerge(true); | |||
| headList.add(entity6); | |||
| ExcelExportEntity entity7 = new ExcelExportEntity("发奖人","grantByName",20); | |||
| entity7.setNeedMerge(true); | |||
| headList.add(entity7); | |||
| ExcelExportEntity entity8 = new ExcelExportEntity("发奖时间","grantTime",20); | |||
| entity8.setNeedMerge(true); | |||
| headList.add(entity8); | |||
| ExcelExportEntity entity9 = new ExcelExportEntity("抽奖券编码","lotteryNum",20); | |||
| entity9.setNeedMerge(true); | |||
| headList.add(entity9); | |||
| ExcelExportEntity entity10 = new ExcelExportEntity("抽奖券数量","lotteryCount",20); | |||
| entity10.setNeedMerge(true); | |||
| headList.add(entity10); | |||
| ExcelExportEntity entity11 = new ExcelExportEntity("周年庆抽奖编码","anniversaryLotteryNum",20); | |||
| entity11.setNeedMerge(true); | |||
| headList.add(entity11); | |||
| ExcelExportEntity entity12 = new ExcelExportEntity("签名图片","signImg",40); | |||
| // entity12.setType(BaseEntityTypeConstants.IMAGE_TYPE); | |||
| // entity12.setExportImageType(1); | |||
| // entity12.setHeight(20); | |||
| entity12.setNeedMerge(true); | |||
| headList.add(entity12); | |||
| ExcelExportEntity entity13 = new ExcelExportEntity("发奖备注","remark",20); | |||
| entity11.setNeedMerge(true); | |||
| headList.add(entity13); | |||
| //订单 | |||
| ExcelExportEntity entity20 = new ExcelExportEntity(null,"orderList",160); | |||
| List<ExcelExportEntity> entity20_list = new ArrayList<>(); | |||
| ExcelExportEntity entity20_1 = new ExcelExportEntity("订单编号","orderNo",20); | |||
| entity20_list.add(entity20_1); | |||
| ExcelExportEntity entity20_2 = new ExcelExportEntity("订单金额","orderAmount",20); | |||
| entity20_list.add(entity20_2); | |||
| ExcelExportEntity entity20_3 = new ExcelExportEntity("客户姓名","cusName",20); | |||
| entity20_list.add(entity20_3); | |||
| ExcelExportEntity entity20_4 = new ExcelExportEntity("客户电话","cusPhone",20); | |||
| entity20_list.add(entity20_4); | |||
| ExcelExportEntity entity20_5 = new ExcelExportEntity("vip卡","vipNum",20); | |||
| entity20_list.add(entity20_5); | |||
| ExcelExportEntity entity20_6 = new ExcelExportEntity("所属军团","legionName",20); | |||
| entity20_list.add(entity20_6); | |||
| ExcelExportEntity entity20_7 = new ExcelExportEntity("所属联盟","unionName",20); | |||
| entity20_list.add(entity20_7); | |||
| ExcelExportEntity entity20_8_ = new ExcelExportEntity("订单地址","cusAddress",20); | |||
| entity20_list.add(entity20_8_); | |||
| ExcelExportEntity entity20_9 = new ExcelExportEntity("商户名称","merchantName",20); | |||
| entity20_list.add(entity20_9); | |||
| ExcelExportEntity entity20_10 = new ExcelExportEntity("铺位号","merchantShopNum",20); | |||
| entity20_list.add(entity20_10); | |||
| ExcelExportEntity entity20_11 = new ExcelExportEntity("业态","businessName",20); | |||
| entity20_list.add(entity20_11); | |||
| ExcelExportEntity entity20_12 = new ExcelExportEntity("抽奖券编码","lotteryNum",20); | |||
| entity20_list.add(entity20_12); | |||
| ExcelExportEntity entity20_13 = new ExcelExportEntity("抽奖券数量","lotteryCount",20); | |||
| entity20_list.add(entity20_13); | |||
| ExcelExportEntity entity20_14 = new ExcelExportEntity("周年庆抽奖编码","anniversaryLotteryNum",20); | |||
| entity20_list.add(entity20_14); | |||
| ExcelExportEntity entity20_15 = new ExcelExportEntity("提交时间","createDate",20); | |||
| entity20_15.setFormat("yyyy-MM-dd HH:mm:ss"); | |||
| entity20_list.add(entity20_15); | |||
| ExcelExportEntity entity20_16 = new ExcelExportEntity("订单状态","auditStatus",20); | |||
| entity20_16.setReplace(new String[]{"审核中_0", "已审批_1", "已驳回_2", "已退单_3", "已发奖_10"}); | |||
| entity20_list.add(entity20_16); | |||
| ExcelExportEntity entity20_17 = new ExcelExportEntity("审核人","auditByName",20); | |||
| entity20_list.add(entity20_17); | |||
| ExcelExportEntity entity20_18 = new ExcelExportEntity("审核时间","auditTime",20); | |||
| entity20_18.setFormat("yyyy-MM-dd HH:mm:ss"); | |||
| entity20_list.add(entity20_18); | |||
| entity20.setList(entity20_list); | |||
| headList.add(entity20); | |||
| return headList; | |||
| } | |||
| @Override | |||
| public List<WxVtwoActivityGrantExportTwo> findActivityGrantList(Long activityId, String tenantId) { | |||
| WxVtwoActivityGrantExportTwo exportQ = new WxVtwoActivityGrantExportTwo(); | |||
| exportQ.setTenantId(tenantId); | |||
| exportQ.setActivityId(activityId); | |||
| List<WxVtwoActivityGrantExportTwo> exportList = wxVtwoActivityGrantExportTwoMapper.findList(exportQ); | |||
| if(exportList != null && !exportList.isEmpty()){ | |||
| WxVtwoActivityGrantOrder grantOrderQ = new WxVtwoActivityGrantOrder(); | |||
| exportQ.setTenantId(tenantId); | |||
| exportQ.setActivityId(activityId); | |||
| List<Long> orderIds = wxVtwoActivityGrantOrderMapper.findIdList(grantOrderQ); | |||
| Map<Long,WxVtwoActivityOrder> auditDetailMap = wxVtwoActivityOrderService.findAuditDetailMap(orderIds,tenantId); | |||
| for(WxVtwoActivityGrantExportTwo export : exportList){ | |||
| export.setOrderList(JSONObject.parseArray(export.getOrderDetail(),WxVtwoActivityOrder.class)); | |||
| export.getOrderList().forEach(e -> { | |||
| WxVtwoActivityOrder order = auditDetailMap.get(e.getId()); | |||
| e.setAuditStatus(order.getAuditStatus()); | |||
| e.setAuditRemark(order.getAuditRemark()); | |||
| e.setAuditBy(order.getAuditBy()); | |||
| e.setAuditByName(order.getAuditByName()); | |||
| e.setAuditTime(order.getAuditTime()); | |||
| }); | |||
| } | |||
| } | |||
| return exportList; | |||
| } | |||
| @Override | |||
| public Integer selectMaxOrderGrantCount(Long activityId, String tenantId) { | |||
| WxVtwoActivityGrantExportTwo exportQ = new WxVtwoActivityGrantExportTwo(); | |||
| exportQ.setTenantId(tenantId); | |||
| exportQ.setActivityId(activityId); | |||
| Integer count = wxVtwoActivityGrantExportTwoMapper.selectMaxOrderGrantCount(exportQ); | |||
| if(count == null || count == 0){ | |||
| return 1; | |||
| } | |||
| return count; | |||
| } | |||
| @Override | |||
| public Integer selectMaxJointGrantCount(Long activityId, String tenantId) { | |||
| WxVtwoActivityGrantExportTwo exportQ = new WxVtwoActivityGrantExportTwo(); | |||
| exportQ.setTenantId(tenantId); | |||
| exportQ.setActivityId(activityId); | |||
| Integer count = wxVtwoActivityGrantExportTwoMapper.selectMaxJointGrantCount(exportQ); | |||
| if(count == null || count == 0){ | |||
| return 1; | |||
| } | |||
| return count; | |||
| } | |||
| } | |||
| @@ -9,6 +9,7 @@ import com.iformall.domain.vo.WxVtwoSettlementStatistics; | |||
| import com.iformall.enums.EnumOfflineActivityAwardsModeType; | |||
| import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.service.WxVtwoActivityGrantExportService; | |||
| import com.iformall.service.WxVtwoActivityGrantExportTwoService; | |||
| import com.iformall.service.WxVtwoActivityGrantSettlementService; | |||
| import com.iformall.mapper.WxVtwoActivityGrantSettlementMapper; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -35,6 +36,9 @@ public class WxVtwoActivityGrantSettlementServiceImpl extends ServiceImpl<WxVtwo | |||
| @Autowired | |||
| private WxVtwoActivityGrantExportService wxVtwoActivityGrantExportService; | |||
| @Autowired | |||
| private WxVtwoActivityGrantExportTwoService wxVtwoActivityGrantExportTwoService; | |||
| @Override | |||
| public void saveGrantSettlement(WxVtwoActivityGrant activityGrant) { | |||
| List<WxVtwoActivityOrder> amountOrderList = activityGrant.getOrderList().stream().filter(o -> EnumYesOrNo.YES.getCode().equals(o.getIsAmount())) | |||
| @@ -76,6 +80,9 @@ public class WxVtwoActivityGrantSettlementServiceImpl extends ServiceImpl<WxVtwo | |||
| wxVtwoActivityGrantSettlementMapper.insertList(settlementList); | |||
| wxVtwoActivityGrantExportService.saveGrantExport(activityGrant,settlementList); | |||
| wxVtwoActivityGrantExportTwoService.saveGrantExport(activityGrant,settlementList); | |||
| } | |||
| private WxVtwoActivityGrantSettlement getGrantSettlement(WxVtwoActivityGrantAward grant,WxVtwoActivityOrder order,IdWorker idWorker,boolean isOneOrder){ | |||
| @@ -178,6 +185,8 @@ public class WxVtwoActivityGrantSettlementServiceImpl extends ServiceImpl<WxVtwo | |||
| wxVtwoActivityGrantSettlementMapper.insertList(settlementList); | |||
| wxVtwoActivityGrantExportService.saveGrantExport(activityGrant,settlementList); | |||
| wxVtwoActivityGrantExportTwoService.saveGrantExport(activityGrant,settlementList); | |||
| } | |||
| private WxVtwoActivityGrantSettlement getGrantSettlement(WxVtwoCashBackGrantAward grant,WxVtwoActivityOrder order,IdWorker idWorker,boolean isOneOrder){ | |||
| @@ -80,6 +80,9 @@ public class WxVtwoAmountGiftActivityServiceImpl extends ServiceImpl<WxVtwoAmoun | |||
| @Autowired | |||
| private WxVtwoActivityGrantExportService wxVtwoActivityGrantExportService; | |||
| @Autowired | |||
| private WxVtwoActivityGrantExportTwoService wxVtwoActivityGrantExportTwoService; | |||
| @Autowired | |||
| private ExcelService excelService; | |||
| @@ -386,6 +389,185 @@ public class WxVtwoAmountGiftActivityServiceImpl extends ServiceImpl<WxVtwoAmoun | |||
| excelService.exportExcel(headList, grantObjectList, null, "赠礼活动发放明细", "赠礼活动发放明细.xlsx",true, response); | |||
| } | |||
| @Override | |||
| public void grantExportTwo(HttpServletRequest request, HttpServletResponse response, WxVtwoActivityGrant activityGrant) { | |||
| WxVtwoAmountGiftActivity activity = this.getById(activityGrant.getActivityId(), activityGrant.getTenantId()); | |||
| if(activity == null){ | |||
| throw new MallinkException(Result.ERROR,"未查询到活动"); | |||
| } | |||
| List<ExcelExportEntity> headList = wxVtwoActivityGrantExportTwoService.getExportHeadList(); | |||
| if(EnumOfflineActivityMode.ONE.getCode().equals(activity.getAmountModel())){ | |||
| ExcelExportEntity entity14 = new ExcelExportEntity(null,"orderGrantList",220); | |||
| List<ExcelExportEntity> entity14_list = new ArrayList<>(); | |||
| ExcelExportEntity entity14_2 = new ExcelExportEntity("订单奖项名称","awardName",20); | |||
| entity14_list.add(entity14_2); | |||
| // ExcelExportEntity entity14_3 = new ExcelExportEntity("奖品数量","awardsItemCount",20); | |||
| // entity14_list.add(entity14_3); | |||
| ExcelExportEntity entity14_4 = new ExcelExportEntity("订单奖项价值","grantPrice",20); | |||
| entity14_list.add(entity14_4); | |||
| ExcelExportEntity entity14_5 = new ExcelExportEntity("商管承担比例(%)","mallShareRate",20); | |||
| entity14_list.add(entity14_5); | |||
| ExcelExportEntity entity14_6 = new ExcelExportEntity("商户承担比例(%)","merchantShareRate",20); | |||
| entity14_list.add(entity14_6); | |||
| ExcelExportEntity entity14_7 = new ExcelExportEntity("商管承担金额","mallSharePrice",20); | |||
| entity14_list.add(entity14_7); | |||
| ExcelExportEntity entity14_8 = new ExcelExportEntity("商户承担金额","merchantSharePrice",20); | |||
| entity14_list.add(entity14_8); | |||
| entity14.setList(entity14_list); | |||
| headList.add(entity14); | |||
| }else{ | |||
| // ExcelExportEntity entity14 = new ExcelExportEntity("活动名称", | |||
| // "activityName_o",20); | |||
| // entity14.setNeedMerge(true); | |||
| // headList.add(entity14); | |||
| ExcelExportEntity entity16 = new ExcelExportEntity("订单奖项名称", | |||
| "awardName_o",20); | |||
| entity16.setNeedMerge(true); | |||
| headList.add(entity16); | |||
| ExcelExportEntity entity17 = new ExcelExportEntity("订单奖项价值", | |||
| "grantPrice_o",20); | |||
| entity17.setNeedMerge(true); | |||
| headList.add(entity17); | |||
| ExcelExportEntity entity18 = new ExcelExportEntity("商管承担比例(%)", | |||
| "mallShareRate_o",20); | |||
| entity18.setNeedMerge(true); | |||
| headList.add(entity18); | |||
| ExcelExportEntity entity19 = new ExcelExportEntity("商户承担比例(%)", | |||
| "merchantShareRate_o",20); | |||
| entity19.setNeedMerge(true); | |||
| headList.add(entity19); | |||
| ExcelExportEntity entity20 = new ExcelExportEntity(null, | |||
| "sharePriceList_o",40); | |||
| List<ExcelExportEntity> entity20_list = new ArrayList<>(); | |||
| ExcelExportEntity entity20_1 = new ExcelExportEntity("商管承担金额","mallSharePrice",20); | |||
| entity20_list.add(entity20_1); | |||
| ExcelExportEntity entity20_2 = new ExcelExportEntity("商户承担金额","merchantSharePrice",20); | |||
| entity20_list.add(entity20_2); | |||
| entity20.setList(entity20_list); | |||
| headList.add(entity20); | |||
| } | |||
| //联单 | |||
| // ExcelExportEntity entity14_c = new ExcelExportEntity("活动名称", | |||
| // "activityName_c",20); | |||
| // entity14_c.setNeedMerge(true); | |||
| // headList.add(entity14_c); | |||
| ExcelExportEntity entity15_c = new ExcelExportEntity("联单奖项名称", | |||
| "awardName_c",20); | |||
| entity15_c.setNeedMerge(true); | |||
| headList.add(entity15_c); | |||
| ExcelExportEntity entity17_c = new ExcelExportEntity("联单奖项价值", | |||
| "grantPrice_c",20); | |||
| entity17_c.setNeedMerge(true); | |||
| headList.add(entity17_c); | |||
| ExcelExportEntity entity18_c = new ExcelExportEntity("商管承担比例(%)", | |||
| "mallShareRate_c",20); | |||
| entity18_c.setNeedMerge(true); | |||
| headList.add(entity18_c); | |||
| ExcelExportEntity entity19_c = new ExcelExportEntity("商户承担比例(%)", | |||
| "merchantShareRate_c",20); | |||
| entity19_c.setNeedMerge(true); | |||
| headList.add(entity19_c); | |||
| ExcelExportEntity entity20_c = new ExcelExportEntity(null, | |||
| "_sharePriceList_c",40); | |||
| List<ExcelExportEntity> entity20_c_list = new ArrayList<>(); | |||
| ExcelExportEntity entity20_c_1 = new ExcelExportEntity("商管承担金额","mallSharePrice",20); | |||
| entity20_c_list.add(entity20_c_1); | |||
| ExcelExportEntity entity20_c_2 = new ExcelExportEntity("商户承担金额","merchantSharePrice",20); | |||
| entity20_c_list.add(entity20_c_2); | |||
| entity20_c.setList(entity20_c_list); | |||
| headList.add(entity20_c); | |||
| List<WxVtwoActivityGrantExportTwo> activityGrantExportList = wxVtwoActivityGrantExportTwoService.findActivityGrantList(activityGrant.getActivityId(),activityGrant.getTenantId()); | |||
| List<Map<String, Object>> grantObjectList = new ArrayList<>(); | |||
| if(activityGrantExportList != null && !activityGrantExportList.isEmpty()){ | |||
| grantObjectList = activityGrantExportList.stream().map(e -> { | |||
| Map<String, Object> map = new HashMap<>(); | |||
| try { | |||
| map = BeanUtils.toMap(e); | |||
| } catch (Exception ex) { | |||
| } | |||
| List<WxVtwoActivityGrantAward> orderGrantAward = JSONObject.parseArray(e.getOrderGrantDetail(), WxVtwoActivityGrantAward.class); | |||
| if(EnumOfflineActivityMode.ONE.getCode().equals(activity.getAmountModel())){ | |||
| Map<Long, WxVtwoActivityGrantAward> orderGrantAwardMap = orderGrantAward.stream().collect(toMap(WxVtwoActivityGrantAward::getOrderId, Function.identity())); | |||
| List<WxVtwoActivityGrantAward> sortList = new ArrayList<>(); | |||
| e.getOrderList().forEach(order -> { | |||
| WxVtwoActivityGrantAward grantAward = orderGrantAwardMap.get(order.getId()); | |||
| if(grantAward != null){ | |||
| WxVtwoActivityGrantSettlement grantSettlement = grantAward.getGrantSettlementList().get(0); | |||
| grantAward.setMallSharePrice(grantSettlement.getOrderMallSharePrice()); | |||
| grantAward.setMerchantSharePrice(grantSettlement.getOrderMerchantSharePrice()); | |||
| sortList.add(grantAward); | |||
| } else{ | |||
| sortList.add(new WxVtwoActivityGrantAward()); | |||
| } | |||
| }); | |||
| map.put("orderGrantList",sortList); | |||
| }else{ | |||
| WxVtwoActivityGrantAward one = orderGrantAward.get(0); | |||
| map.put("awardName_o",one.getAwardName()); | |||
| map.put("grantPrice_o",one.getGrantPrice()); | |||
| map.put("mallShareRate_o",one.getMallShareRate()); | |||
| map.put("merchantShareRate_o",one.getMerchantShareRate()); | |||
| List<Map<String,Object>> sharePriceList = new ArrayList<>(); | |||
| Map<Long, WxVtwoActivityGrantSettlement> grantSettlementMap = one.getGrantSettlementList().stream().collect(toMap(WxVtwoActivityGrantSettlement::getOrderId, Function.identity())); | |||
| e.getOrderList().forEach(order -> { | |||
| WxVtwoActivityGrantSettlement grantSettlement = grantSettlementMap.get(order.getId()); | |||
| Map<String,Object> sharePriceObject = new HashMap<>(); | |||
| if(grantSettlement != null){ | |||
| sharePriceObject.put("mallSharePrice",grantSettlement.getOrderMallSharePrice()); | |||
| sharePriceObject.put("merchantSharePrice",grantSettlement.getOrderMerchantSharePrice()); | |||
| }else{ | |||
| sharePriceObject.put("mallSharePrice",0); | |||
| sharePriceObject.put("merchantSharePrice",0); | |||
| } | |||
| sharePriceList.add(sharePriceObject); | |||
| }); | |||
| map.put("sharePriceList_o",sharePriceList); | |||
| } | |||
| List<WxVtwoActivityGrantAward> jointGrantAward = JSONObject.parseArray(e.getJointGrantDetail(), WxVtwoActivityGrantAward.class); | |||
| WxVtwoActivityGrantAward jointOne = jointGrantAward.get(0); | |||
| map.put("awardName_c",jointOne.getAwardName()); | |||
| map.put("grantPrice_c",jointOne.getGrantPrice()); | |||
| map.put("mallShareRate_c",jointOne.getMallShareRate()); | |||
| map.put("merchantShareRate_c",jointOne.getMerchantShareRate()); | |||
| List<Map<String,Object>> jointSharePriceList = new ArrayList<>(); | |||
| Map<Long, WxVtwoActivityGrantSettlement> grantSettlementMap = jointOne.getGrantSettlementList().stream().collect(toMap(WxVtwoActivityGrantSettlement::getOrderId, Function.identity())); | |||
| e.getOrderList().forEach(order -> { | |||
| WxVtwoActivityGrantSettlement grantSettlement = grantSettlementMap.get(order.getId()); | |||
| Map<String,Object> jointSharePriceObject = new HashMap<>(); | |||
| if(grantSettlement != null){ | |||
| jointSharePriceObject.put("mallSharePrice",grantSettlement.getOrderMallSharePrice()); | |||
| jointSharePriceObject.put("merchantSharePrice",grantSettlement.getOrderMerchantSharePrice()); | |||
| }else{ | |||
| jointSharePriceObject.put("mallSharePrice",0); | |||
| jointSharePriceObject.put("merchantSharePrice",0); | |||
| } | |||
| jointSharePriceList.add(jointSharePriceObject); | |||
| }); | |||
| map.put("sharePriceList_c",jointSharePriceList); | |||
| return map; | |||
| }).collect(toList()); | |||
| } | |||
| excelService.exportExcel(headList, grantObjectList, null, "赠礼活动发放明细", "赠礼活动发放明细.xlsx",true, response); | |||
| } | |||
| } | |||
| @@ -81,6 +81,9 @@ public class WxVtwoCashBackActivityServiceImpl extends ServiceImpl<WxVtwoCashBac | |||
| @Autowired | |||
| private WxVtwoActivityGrantExportService wxVtwoActivityGrantExportService; | |||
| @Autowired | |||
| private WxVtwoActivityGrantExportTwoService wxVtwoActivityGrantExportTwoService; | |||
| @Autowired | |||
| private ExcelService excelService; | |||
| @@ -329,6 +332,236 @@ public class WxVtwoCashBackActivityServiceImpl extends ServiceImpl<WxVtwoCashBac | |||
| excelService.exportExcel(headList, grantObjectList, null, "返现活动发放明细", "返现活动发放明细.xlsx",true, response); | |||
| } | |||
| @Override | |||
| public void grantExportTwo(HttpServletRequest request, HttpServletResponse response, WxVtwoCashBackGrant activityGrant) { | |||
| WxVtwoCashBackActivity activity = this.getById(activityGrant.getActivityId(), activityGrant.getTenantId()); | |||
| if(activity == null){ | |||
| throw new MallinkException(Result.ERROR,"未查询到活动"); | |||
| } | |||
| List<ExcelExportEntity> headList = wxVtwoActivityGrantExportTwoService.getExportHeadList(); | |||
| if(EnumOfflineActivityMode.ONE.getCode().equals(activity.getAmountModel())){ | |||
| ExcelExportEntity entity14 = new ExcelExportEntity(null,"orderGrantList",220); | |||
| List<ExcelExportEntity> entity14_list = new ArrayList<>(); | |||
| ExcelExportEntity entity14_2 = new ExcelExportEntity("订单奖项名称","awardName",20); | |||
| entity14_list.add(entity14_2); | |||
| ExcelExportEntity entity14_3 = new ExcelExportEntity("订单返现比例(%)","cashBackRatio",20); | |||
| entity14_list.add(entity14_3); | |||
| // ExcelExportEntity entity14_3 = new ExcelExportEntity("奖品数量","awardsItemCount",20); | |||
| // entity14_list.add(entity14_3); | |||
| ExcelExportEntity entity14_4 = new ExcelExportEntity("订单返现金额","cashBack",20); | |||
| entity14_list.add(entity14_4); | |||
| ExcelExportEntity entity14_5 = new ExcelExportEntity("商管承担比例(%)","mallShareRate",20); | |||
| entity14_list.add(entity14_5); | |||
| ExcelExportEntity entity14_6 = new ExcelExportEntity("商户承担比例(%)","merchantShareRate",20); | |||
| entity14_list.add(entity14_6); | |||
| ExcelExportEntity entity14_7 = new ExcelExportEntity("商管承担金额","mallSharePrice",20); | |||
| entity14_list.add(entity14_7); | |||
| ExcelExportEntity entity14_8 = new ExcelExportEntity("商户承担金额","merchantSharePrice",20); | |||
| entity14_list.add(entity14_8); | |||
| // ExcelExportEntity entity14_9 = new ExcelExportEntity("税点金额起点","startingTaxPoint",20); | |||
| // entity14_list.add(entity14_9); | |||
| // ExcelExportEntity entity14_10 = new ExcelExportEntity("税点比例(%)","taxPoints",20); | |||
| // entity14_list.add(entity14_10); | |||
| ExcelExportEntity entity14_11 = new ExcelExportEntity("订单返现税点金额","taxAmount",20); | |||
| entity14_list.add(entity14_11); | |||
| // ExcelExportEntity entity14_12 = new ExcelExportEntity("订单实际返现金额","realCashBackPrice",20); | |||
| // entity14_list.add(entity14_12); | |||
| entity14.setList(entity14_list); | |||
| headList.add(entity14); | |||
| }else{ | |||
| // ExcelExportEntity entity14 = new ExcelExportEntity("返现活动名称", | |||
| // "activityName_o",20); | |||
| // entity14.setNeedMerge(true); | |||
| // headList.add(entity14); | |||
| ExcelExportEntity entity16 = new ExcelExportEntity("订单奖项名称", | |||
| "awardName_o",20); | |||
| entity16.setNeedMerge(true); | |||
| headList.add(entity16); | |||
| ExcelExportEntity entity16_ = new ExcelExportEntity("订单返现比例(%)", | |||
| "cashBackRatio_o",20); | |||
| entity16_.setNeedMerge(true); | |||
| headList.add(entity16_); | |||
| ExcelExportEntity entity17 = new ExcelExportEntity("返现金额", | |||
| "cashBack_o",20); | |||
| entity17.setNeedMerge(true); | |||
| headList.add(entity17); | |||
| ExcelExportEntity entity18 = new ExcelExportEntity("商管承担比例(%)", | |||
| "mallShareRate_o",20); | |||
| entity18.setNeedMerge(true); | |||
| headList.add(entity18); | |||
| ExcelExportEntity entity19 = new ExcelExportEntity("商户承担比例(%)", | |||
| "merchantShareRate_o",20); | |||
| entity19.setNeedMerge(true); | |||
| headList.add(entity19); | |||
| ExcelExportEntity entity20 = new ExcelExportEntity(null, | |||
| "sharePriceList_o",40); | |||
| List<ExcelExportEntity> entity20_list = new ArrayList<>(); | |||
| ExcelExportEntity entity20_1 = new ExcelExportEntity("商管承担金额","mallSharePrice",20); | |||
| entity20_list.add(entity20_1); | |||
| ExcelExportEntity entity20_2 = new ExcelExportEntity("商户承担金额","merchantSharePrice",20); | |||
| entity20_list.add(entity20_2); | |||
| entity20.setList(entity20_list); | |||
| headList.add(entity20); | |||
| } | |||
| //联单 | |||
| // ExcelExportEntity entity14_c = new ExcelExportEntity("返现活动名称", | |||
| // "activityName_c",20); | |||
| // entity14_c.setNeedMerge(true); | |||
| // headList.add(entity14_c); | |||
| ExcelExportEntity entity15_c = new ExcelExportEntity("联单奖项名称", | |||
| "awardName_c",20); | |||
| entity15_c.setNeedMerge(true); | |||
| headList.add(entity15_c); | |||
| ExcelExportEntity entity16_c = new ExcelExportEntity("联单返现比例(%)", | |||
| "cashBackRatio_c",20); | |||
| entity16_c.setNeedMerge(true); | |||
| headList.add(entity16_c); | |||
| ExcelExportEntity entity17_c = new ExcelExportEntity("联单返现金额", | |||
| "cashBack_c",20); | |||
| entity17_c.setNeedMerge(true); | |||
| headList.add(entity17_c); | |||
| ExcelExportEntity entity18_c = new ExcelExportEntity("商管承担比例(%)", | |||
| "mallShareRate_c",20); | |||
| entity18_c.setNeedMerge(true); | |||
| headList.add(entity18_c); | |||
| ExcelExportEntity entity19_c = new ExcelExportEntity("商户承担比例(%)", | |||
| "merchantShareRate_c",20); | |||
| entity19_c.setNeedMerge(true); | |||
| headList.add(entity19_c); | |||
| ExcelExportEntity entity20_c = new ExcelExportEntity(null, | |||
| "_sharePriceList_c",40); | |||
| List<ExcelExportEntity> entity20_c_list = new ArrayList<>(); | |||
| ExcelExportEntity entity20_c_1 = new ExcelExportEntity("商管承担金额","mallSharePrice",20); | |||
| entity20_c_list.add(entity20_c_1); | |||
| ExcelExportEntity entity20_c_2 = new ExcelExportEntity("商户承担金额","merchantSharePrice",20); | |||
| entity20_c_list.add(entity20_c_2); | |||
| entity20_c.setList(entity20_c_list); | |||
| headList.add(entity20_c); | |||
| if(EnumOfflineActivityMode.ONE.getCode().equals(activity.getAmountModel())){ | |||
| // ExcelExportEntity entity22 = new ExcelExportEntity("起征税点金额", | |||
| // "startingTaxPoint_c",20); | |||
| // entity22.setNeedMerge(true); | |||
| // headList.add(entity22); | |||
| // ExcelExportEntity entity23 = new ExcelExportEntity("税点比例(%)", | |||
| // "taxPoints_c",20); | |||
| // entity23.setNeedMerge(true); | |||
| // headList.add(entity23); | |||
| ExcelExportEntity entity24 = new ExcelExportEntity("联单返现税点金额", | |||
| "taxAmount_c",20); | |||
| entity24.setNeedMerge(true); | |||
| headList.add(entity24); | |||
| // ExcelExportEntity entity25 = new ExcelExportEntity("联单实际返现金额", | |||
| // "realCashBackPrice_c",20); | |||
| // entity25.setNeedMerge(true); | |||
| // headList.add(entity25); | |||
| } | |||
| ExcelExportEntity entity26 = new ExcelExportEntity("返现总额", | |||
| "cashBack",20); | |||
| entity26.setNeedMerge(true); | |||
| headList.add(entity26); | |||
| ExcelExportEntity entity29 = new ExcelExportEntity("税点总额", | |||
| "taxAmount",20); | |||
| entity29.setNeedMerge(true); | |||
| headList.add(entity29); | |||
| List<WxVtwoActivityGrantExportTwo> activityGrantExportList = wxVtwoActivityGrantExportTwoService.findActivityGrantList(activityGrant.getActivityId(),activityGrant.getTenantId()); | |||
| List<Map<String, Object>> grantObjectList = new ArrayList<>(); | |||
| if(activityGrantExportList != null && !activityGrantExportList.isEmpty()){ | |||
| grantObjectList = activityGrantExportList.stream().map(e -> { | |||
| Map<String, Object> map = new HashMap<>(); | |||
| try { | |||
| map = BeanUtils.toMap(e); | |||
| } catch (Exception ex) { | |||
| } | |||
| List<WxVtwoCashBackGrantAward> orderGrantAward = JSONObject.parseArray(e.getOrderGrantDetail(), WxVtwoCashBackGrantAward.class); | |||
| if(EnumOfflineActivityMode.ONE.getCode().equals(activity.getAmountModel())){ | |||
| Map<Long, WxVtwoCashBackGrantAward> orderGrantAwardMap = orderGrantAward.stream().collect(toMap(WxVtwoCashBackGrantAward::getOrderId, Function.identity())); | |||
| List<WxVtwoCashBackGrantAward> sortList = new ArrayList<>(); | |||
| e.getOrderList().forEach(order -> { | |||
| WxVtwoCashBackGrantAward grantAward = orderGrantAwardMap.get(order.getId()); | |||
| if(grantAward != null){ | |||
| WxVtwoActivityGrantSettlement grantSettlement = grantAward.getGrantSettlementList().get(0); | |||
| grantAward.setMallSharePrice(grantSettlement.getOrderMallSharePrice()); | |||
| grantAward.setMerchantSharePrice(grantSettlement.getOrderMerchantSharePrice()); | |||
| grantAward.setTaxAmount(grantSettlement.getTaxAmount()); | |||
| sortList.add(grantAward); | |||
| } else{ | |||
| sortList.add(new WxVtwoCashBackGrantAward()); | |||
| } | |||
| }); | |||
| map.put("orderGrantList",sortList); | |||
| }else{ | |||
| WxVtwoCashBackGrantAward one = orderGrantAward.get(0); | |||
| map.put("awardName_o",one.getAwardName()); | |||
| map.put("cashBackRatio_o",one.getCashBackRatio()); | |||
| map.put("cashBack_o",one.getCashBack()); | |||
| map.put("mallShareRate_o",one.getMallShareRate()); | |||
| map.put("merchantShareRate_o",one.getMerchantShareRate()); | |||
| List<Map<String,Object>> sharePriceList = new ArrayList<>(); | |||
| Map<Long, WxVtwoActivityGrantSettlement> grantSettlementMap = one.getGrantSettlementList().stream().collect(toMap(WxVtwoActivityGrantSettlement::getOrderId, Function.identity())); | |||
| e.getOrderList().forEach(order -> { | |||
| WxVtwoActivityGrantSettlement grantSettlement = grantSettlementMap.get(order.getId()); | |||
| Map<String,Object> sharePriceObject = new HashMap<>(); | |||
| if(grantSettlement != null){ | |||
| sharePriceObject.put("mallSharePrice",grantSettlement.getOrderMallSharePrice()); | |||
| sharePriceObject.put("merchantSharePrice",grantSettlement.getOrderMerchantSharePrice()); | |||
| }else{ | |||
| sharePriceObject.put("mallSharePrice",0); | |||
| sharePriceObject.put("merchantSharePrice",0); | |||
| } | |||
| sharePriceList.add(sharePriceObject); | |||
| }); | |||
| map.put("sharePriceList_o",sharePriceList); | |||
| } | |||
| List<WxVtwoCashBackGrantAward> jointGrantAward = JSONObject.parseArray(e.getJointGrantDetail(), WxVtwoCashBackGrantAward.class); | |||
| WxVtwoCashBackGrantAward jointOne = jointGrantAward.get(0); | |||
| map.put("awardName_c",jointOne.getAwardName()); | |||
| map.put("cashBackRatio_c",jointOne.getCashBackRatio()); | |||
| map.put("cashBack_c",jointOne.getCashBack()); | |||
| map.put("mallShareRate_c",jointOne.getMallShareRate()); | |||
| map.put("merchantShareRate_c",jointOne.getMerchantShareRate()); | |||
| List<Map<String,Object>> jointSharePriceList = new ArrayList<>(); | |||
| Map<Long, WxVtwoActivityGrantSettlement> grantSettlementMap = jointOne.getGrantSettlementList().stream().collect(toMap(WxVtwoActivityGrantSettlement::getOrderId, Function.identity())); | |||
| e.getOrderList().forEach(order -> { | |||
| WxVtwoActivityGrantSettlement grantSettlement = grantSettlementMap.get(order.getId()); | |||
| Map<String,Object> jointSharePriceObject = new HashMap<>(); | |||
| if(grantSettlement != null){ | |||
| jointSharePriceObject.put("mallSharePrice",grantSettlement.getOrderMallSharePrice()); | |||
| jointSharePriceObject.put("merchantSharePrice",grantSettlement.getOrderMerchantSharePrice()); | |||
| }else{ | |||
| jointSharePriceObject.put("mallSharePrice",0); | |||
| jointSharePriceObject.put("merchantSharePrice",0); | |||
| } | |||
| jointSharePriceList.add(jointSharePriceObject); | |||
| }); | |||
| map.put("sharePriceList_c",jointSharePriceList); | |||
| if(EnumOfflineActivityMode.ONE.getCode().equals(activity.getAmountModel())){ | |||
| map.put("taxAmount_c",jointOne.getTaxAmount()); | |||
| } | |||
| return map; | |||
| }).collect(toList()); | |||
| } | |||
| excelService.exportExcel(headList, grantObjectList, null, "返现活动发放明细", "返现活动发放明细.xlsx",true, response); | |||
| } | |||
| } | |||
| @@ -82,6 +82,9 @@ public class WxVtwoPrizeDrawActivityServiceImpl extends ServiceImpl<WxVtwoPrizeD | |||
| @Autowired | |||
| private WxVtwoActivityGrantExportService wxVtwoActivityGrantExportService; | |||
| @Autowired | |||
| private WxVtwoActivityGrantExportTwoService wxVtwoActivityGrantExportTwoService; | |||
| @Autowired | |||
| private ExcelService excelService; | |||
| @@ -405,6 +408,208 @@ public class WxVtwoPrizeDrawActivityServiceImpl extends ServiceImpl<WxVtwoPrizeD | |||
| excelService.exportExcel(headList, grantObjectList, null, "抽奖活动发放明细", "抽奖活动发放明细.xlsx",true, response); | |||
| } | |||
| @Override | |||
| public void grantExportTwo(HttpServletRequest request, HttpServletResponse response, WxVtwoActivityGrant activityGrant) { | |||
| WxVtwoPrizeDrawActivity activity = this.getById(activityGrant.getActivityId(), activityGrant.getTenantId()); | |||
| if(activity == null){ | |||
| throw new MallinkException(Result.ERROR,"未查询到活动"); | |||
| } | |||
| List<ExcelExportEntity> headList = wxVtwoActivityGrantExportTwoService.getExportHeadList(); | |||
| //获得最大奖项数量 | |||
| Integer orderGrantCount = wxVtwoActivityGrantExportTwoService.selectMaxOrderGrantCount(activityGrant.getActivityId(),activityGrant.getTenantId()); | |||
| Integer jointGrantCount = wxVtwoActivityGrantExportTwoService.selectMaxJointGrantCount(activityGrant.getActivityId(),activityGrant.getTenantId()); | |||
| for(int i=1;i<=orderGrantCount;i++){ | |||
| if(EnumOfflineActivityMode.ONE.getCode().equals(activity.getAmountModel())){ | |||
| ExcelExportEntity entity14 = new ExcelExportEntity(null,"orderGrantList"+i,220); | |||
| List<ExcelExportEntity> entity14_list = new ArrayList<>(); | |||
| ExcelExportEntity entity14_2 = new ExcelExportEntity("订单奖项名称","awardName",20); | |||
| entity14_list.add(entity14_2); | |||
| ExcelExportEntity entity14_3 = new ExcelExportEntity("订单奖项数量","awardCount",20); | |||
| entity14_list.add(entity14_3); | |||
| ExcelExportEntity entity14_4 = new ExcelExportEntity("订单奖项价值","grantPrice",20); | |||
| entity14_list.add(entity14_4); | |||
| ExcelExportEntity entity14_5 = new ExcelExportEntity("商管承担比例(%)","mallShareRate",20); | |||
| entity14_list.add(entity14_5); | |||
| ExcelExportEntity entity14_6 = new ExcelExportEntity("商户承担比例(%)","merchantShareRate",20); | |||
| entity14_list.add(entity14_6); | |||
| ExcelExportEntity entity14_7 = new ExcelExportEntity("商管承担金额","mallSharePrice",20); | |||
| entity14_list.add(entity14_7); | |||
| ExcelExportEntity entity14_8 = new ExcelExportEntity("商户承担金额","merchantSharePrice",20); | |||
| entity14_list.add(entity14_8); | |||
| entity14.setList(entity14_list); | |||
| headList.add(entity14); | |||
| }else{ | |||
| // ExcelExportEntity entity14 = new ExcelExportEntity("活动名称", | |||
| // "activityName_o",20); | |||
| // entity14.setNeedMerge(true); | |||
| // headList.add(entity14); | |||
| ExcelExportEntity entity16 = new ExcelExportEntity("订单奖项名称", | |||
| "awardName_o"+i,20); | |||
| entity16.setNeedMerge(true); | |||
| headList.add(entity16); | |||
| ExcelExportEntity entity16_ = new ExcelExportEntity("订单奖项数量", | |||
| "awardCount_o"+i,20); | |||
| entity16_.setNeedMerge(true); | |||
| headList.add(entity16_); | |||
| ExcelExportEntity entity17 = new ExcelExportEntity("订单奖项价值", | |||
| "grantPrice_o"+i,20); | |||
| entity17.setNeedMerge(true); | |||
| headList.add(entity17); | |||
| ExcelExportEntity entity18 = new ExcelExportEntity("商管承担比例(%)", | |||
| "mallShareRate_o"+i,20); | |||
| entity18.setNeedMerge(true); | |||
| headList.add(entity18); | |||
| ExcelExportEntity entity19 = new ExcelExportEntity("商户承担比例(%)", | |||
| "merchantShareRate_o"+i,20); | |||
| entity19.setNeedMerge(true); | |||
| headList.add(entity19); | |||
| ExcelExportEntity entity20 = new ExcelExportEntity(null, | |||
| "sharePriceList_o"+i,40); | |||
| List<ExcelExportEntity> entity20_list = new ArrayList<>(); | |||
| ExcelExportEntity entity20_1 = new ExcelExportEntity("商管承担金额","mallSharePrice",20); | |||
| entity20_list.add(entity20_1); | |||
| ExcelExportEntity entity20_2 = new ExcelExportEntity("商户承担金额","merchantSharePrice",20); | |||
| entity20_list.add(entity20_2); | |||
| entity20.setList(entity20_list); | |||
| headList.add(entity20); | |||
| } | |||
| } | |||
| //联单 | |||
| for(int j=1;j<=jointGrantCount;j++){ | |||
| ExcelExportEntity entity15_c = new ExcelExportEntity("联单奖项名称", | |||
| "awardName_c"+j,20); | |||
| entity15_c.setNeedMerge(true); | |||
| headList.add(entity15_c); | |||
| ExcelExportEntity entity16_c = new ExcelExportEntity("联单奖项数量", | |||
| "awardCount_c"+j,20); | |||
| entity16_c.setNeedMerge(true); | |||
| headList.add(entity16_c); | |||
| ExcelExportEntity entity17_c = new ExcelExportEntity("联单奖项价值", | |||
| "grantPrice_c"+j,20); | |||
| entity17_c.setNeedMerge(true); | |||
| headList.add(entity17_c); | |||
| ExcelExportEntity entity18_c = new ExcelExportEntity("商管承担比例(%)", | |||
| "mallShareRate_c"+j,20); | |||
| entity18_c.setNeedMerge(true); | |||
| headList.add(entity18_c); | |||
| ExcelExportEntity entity19_c = new ExcelExportEntity("商户承担比例(%)", | |||
| "merchantShareRate_c"+j,20); | |||
| entity19_c.setNeedMerge(true); | |||
| headList.add(entity19_c); | |||
| ExcelExportEntity entity20_c = new ExcelExportEntity(null, | |||
| "_sharePriceList_c"+j,40); | |||
| List<ExcelExportEntity> entity20_c_list = new ArrayList<>(); | |||
| ExcelExportEntity entity20_c_1 = new ExcelExportEntity("商管承担金额","mallSharePrice",20); | |||
| entity20_c_list.add(entity20_c_1); | |||
| ExcelExportEntity entity20_c_2 = new ExcelExportEntity("商户承担金额","merchantSharePrice",20); | |||
| entity20_c_list.add(entity20_c_2); | |||
| entity20_c.setList(entity20_c_list); | |||
| headList.add(entity20_c); | |||
| } | |||
| List<WxVtwoActivityGrantExportTwo> activityGrantExportList = wxVtwoActivityGrantExportTwoService.findActivityGrantList(activityGrant.getActivityId(),activityGrant.getTenantId()); | |||
| List<Map<String, Object>> grantObjectList = new ArrayList<>(); | |||
| if(activityGrantExportList != null && !activityGrantExportList.isEmpty()){ | |||
| grantObjectList = activityGrantExportList.stream().map(e -> { | |||
| Map<String, Object> map = new HashMap<>(); | |||
| try { | |||
| map = BeanUtils.toMap(e); | |||
| } catch (Exception ex) { | |||
| } | |||
| List<WxVtwoActivityGrantAward> orderGrantAward = JSONObject.parseArray(e.getOrderGrantDetail(), WxVtwoActivityGrantAward.class); | |||
| if(EnumOfflineActivityMode.ONE.getCode().equals(activity.getAmountModel())){ | |||
| Map<Long, List<WxVtwoActivityGrantAward>> orderGrantAwardMap = orderGrantAward.stream().collect(groupingBy(WxVtwoActivityGrantAward::getOrderId)); | |||
| for(int i=1;i<=orderGrantCount;i++){ | |||
| List<WxVtwoActivityGrantAward> sortList = new ArrayList<>(); | |||
| int finalI = i-1; | |||
| e.getOrderList().forEach(order -> { | |||
| List<WxVtwoActivityGrantAward> grantAwardList = orderGrantAwardMap.get(order.getId()); | |||
| WxVtwoActivityGrantAward grantAward = null; | |||
| if(grantAwardList != null && !grantAwardList.isEmpty() && grantAwardList.size() <= finalI){ | |||
| grantAward = grantAwardList.get(finalI); | |||
| } | |||
| if(grantAward != null){ | |||
| WxVtwoActivityGrantSettlement grantSettlement = grantAward.getGrantSettlementList().get(0); | |||
| grantAward.setMallSharePrice(grantSettlement.getOrderMallSharePrice()); | |||
| grantAward.setMerchantSharePrice(grantSettlement.getOrderMerchantSharePrice()); | |||
| sortList.add(grantAward); | |||
| } else{ | |||
| sortList.add(new WxVtwoActivityGrantAward()); | |||
| } | |||
| }); | |||
| map.put("orderGrantList"+i,sortList); | |||
| } | |||
| }else{ | |||
| for(int i=1;i<=orderGrantAward.size();i++){ | |||
| WxVtwoActivityGrantAward grantAward = orderGrantAward.get(i - 1); | |||
| map.put("awardName_o"+i,grantAward.getAwardName()); | |||
| map.put("awardCount_o"+i,grantAward.getAwardCount()); | |||
| map.put("grantPrice_o"+i,grantAward.getGrantPrice()); | |||
| map.put("mallShareRate_o"+i,grantAward.getMallShareRate()); | |||
| map.put("merchantShareRate_o"+i,grantAward.getMerchantShareRate()); | |||
| List<Map<String,Object>> sharePriceList = new ArrayList<>(); | |||
| Map<Long, WxVtwoActivityGrantSettlement> grantSettlementMap = grantAward.getGrantSettlementList().stream().collect(toMap(WxVtwoActivityGrantSettlement::getOrderId, Function.identity())); | |||
| e.getOrderList().forEach(order -> { | |||
| WxVtwoActivityGrantSettlement grantSettlement = grantSettlementMap.get(order.getId()); | |||
| Map<String,Object> sharePriceObject = new HashMap<>(); | |||
| if(grantSettlement != null){ | |||
| sharePriceObject.put("mallSharePrice",grantSettlement.getOrderMallSharePrice()); | |||
| sharePriceObject.put("merchantSharePrice",grantSettlement.getOrderMerchantSharePrice()); | |||
| }else{ | |||
| sharePriceObject.put("mallSharePrice",0); | |||
| sharePriceObject.put("merchantSharePrice",0); | |||
| } | |||
| sharePriceList.add(sharePriceObject); | |||
| }); | |||
| map.put("sharePriceList_o"+i,sharePriceList); | |||
| } | |||
| } | |||
| List<WxVtwoActivityGrantAward> jointGrantAward = JSONObject.parseArray(e.getJointGrantDetail(), WxVtwoActivityGrantAward.class); | |||
| for(int j=1;j<=jointGrantAward.size();j++){ | |||
| WxVtwoActivityGrantAward jointOne = jointGrantAward.get(j-1); | |||
| map.put("awardName_c"+j,jointOne.getAwardName()); | |||
| map.put("awardCount_c"+j,jointOne.getAwardCount()); | |||
| map.put("grantPrice_c"+j,jointOne.getGrantPrice()); | |||
| map.put("mallShareRate_c"+j,jointOne.getMallShareRate()); | |||
| map.put("merchantShareRate_c"+j,jointOne.getMerchantShareRate()); | |||
| List<Map<String,Object>> jointSharePriceList = new ArrayList<>(); | |||
| Map<Long, WxVtwoActivityGrantSettlement> grantSettlementMap = jointOne.getGrantSettlementList().stream().collect(toMap(WxVtwoActivityGrantSettlement::getOrderId, Function.identity())); | |||
| e.getOrderList().forEach(order -> { | |||
| WxVtwoActivityGrantSettlement grantSettlement = grantSettlementMap.get(order.getId()); | |||
| Map<String,Object> jointSharePriceObject = new HashMap<>(); | |||
| if(grantSettlement != null){ | |||
| jointSharePriceObject.put("mallSharePrice",grantSettlement.getOrderMallSharePrice()); | |||
| jointSharePriceObject.put("merchantSharePrice",grantSettlement.getOrderMerchantSharePrice()); | |||
| }else{ | |||
| jointSharePriceObject.put("mallSharePrice",0); | |||
| jointSharePriceObject.put("merchantSharePrice",0); | |||
| } | |||
| jointSharePriceList.add(jointSharePriceObject); | |||
| }); | |||
| map.put("sharePriceList_c"+j,jointSharePriceList); | |||
| } | |||
| return map; | |||
| }).collect(toList()); | |||
| } | |||
| excelService.exportExcel(headList, grantObjectList, null, "抽奖活动发放明细", "抽奖活动发放明细.xlsx",true, response); | |||
| } | |||
| } | |||
| @@ -0,0 +1,94 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper | |||
| PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
| "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.iformall.mapper.WxVtwoActivityGrantExportTwoMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxVtwoActivityGrantExportTwo"> | |||
| <id property="id" column="id" jdbcType="BIGINT"/> | |||
| <result property="tenantId" column="tenant_id" jdbcType="VARCHAR"/> | |||
| <result property="parentTenantId" column="parent_tenant_id" jdbcType="VARCHAR"/> | |||
| <result property="activityId" column="activity_id" jdbcType="BIGINT"/> | |||
| <result property="activityType" column="activity_type" jdbcType="SMALLINT"/> | |||
| <result property="activityName" column="activity_name" jdbcType="VARCHAR"/> | |||
| <result property="orderMoneySum" column="order_money_sum" jdbcType="DECIMAL"/> | |||
| <result property="orderCount" column="order_count" jdbcType="INTEGER"/> | |||
| <result property="cusName" column="cus_name" jdbcType="VARCHAR"/> | |||
| <result property="cusPhone" column="cus_phone" jdbcType="VARCHAR"/> | |||
| <result property="lotteryNum" column="lottery_num" jdbcType="VARCHAR"/> | |||
| <result property="lotteryCount" column="lottery_count" jdbcType="INTEGER"/> | |||
| <result property="anniversaryLotteryNum" column="anniversary_lottery_num" jdbcType="VARCHAR"/> | |||
| <result property="realName" column="real_name" jdbcType="VARCHAR"/> | |||
| <result property="realCard" column="real_card" jdbcType="VARCHAR"/> | |||
| <result property="remark" column="remark" jdbcType="VARCHAR"/> | |||
| <result property="signImg" column="sign_img" jdbcType="VARCHAR"/> | |||
| <result property="status" column="status" jdbcType="SMALLINT"/> | |||
| <result property="grantBy" column="grant_by" jdbcType="BIGINT"/> | |||
| <result property="grantByName" column="grant_by_name" jdbcType="VARCHAR"/> | |||
| <result property="grantTime" column="grant_time" jdbcType="TIMESTAMP"/> | |||
| <result property="orderDetail" column="order_detail" jdbcType="VARCHAR"/> | |||
| <result property="orderGrantDetail" column="order_grant_detail" jdbcType="VARCHAR"/> | |||
| <result property="orderGrantCount" column="order_grant_count" jdbcType="INTEGER"/> | |||
| <result property="jointGrantDetail" column="joint_grant_detail" jdbcType="VARCHAR"/> | |||
| <result property="jointGrantCount" column="joint_grant_count" jdbcType="INTEGER"/> | |||
| <result property="cashBackLimit" column="cash_back_limit" jdbcType="DECIMAL"/> | |||
| <result property="cashBack" column="cash_back" jdbcType="DECIMAL"/> | |||
| <result property="taxDeductionRules" column="tax_deduction_rules" jdbcType="VARCHAR"/> | |||
| <result property="taxAmount" column="tax_amount" jdbcType="DECIMAL"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| id,tenant_id,parent_tenant_id, | |||
| activity_id,activity_type,activity_name, | |||
| order_money_sum,order_count,cus_name, | |||
| cus_phone,lottery_num,lottery_count, | |||
| anniversary_lottery_num,real_name,real_card, | |||
| remark,sign_img,status, | |||
| grant_by,grant_by_name,grant_time, | |||
| order_detail,order_grant_detail,order_grant_count, | |||
| joint_grant_detail,joint_grant_count,cash_back_limit, | |||
| cash_back,tax_deduction_rules,tax_amount | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != activityId "> | |||
| and `activity_id` = #{activityId} | |||
| </if> | |||
| <if test=" null != activityType "> | |||
| and `activity_type` = #{activityType} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <!--<if test=" null != sortColumns"> order by ${sortColumns} </if>--> | |||
| order by grant_time desc | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxVtwoActivityGrantExportTwo" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_vtwo_activity_grant_export | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="selectMaxOrderGrantCount" parameterType="com.iformall.domain.po.WxVtwoActivityGrantExportTwo" resultType="java.lang.Integer"> | |||
| select max(order_grant_count) from wx_vtwo_activity_grant_export | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="selectMaxJointGrantCount" parameterType="com.iformall.domain.po.WxVtwoActivityGrantExportTwo" resultType="java.lang.Integer"> | |||
| select max(joint_grant_count) from wx_vtwo_activity_grant_export | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| </mapper> | |||
| @@ -71,6 +71,10 @@ | |||
| select <include refid="allColumns" /> from wx_vtwo_activity_grant_order | |||
| where id = #{id} and tenant_id=#{tenantId} | |||
| </select> | |||
| <select id="findIdList" parameterType="com.iformall.domain.po.WxVtwoActivityGrantOrder" resultType="java.lang.Long"> | |||
| select id from wx_vtwo_activity_grant_order | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <insert id="insertList" parameterType="java.util.List"> | |||
| insert into wx_vtwo_activity_grant_order | |||