| @@ -13,6 +13,8 @@ import com.iformall.domain.po.WxCashBackActivityRecord; | |||
| import com.iformall.domain.po.WxCashOut; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxRaffleActivityItem; | |||
| import com.iformall.domain.po.WxRaffleActivityRecord; | |||
| import com.iformall.domain.po.base.BaseEntity.SortField; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumCashBackActivityItemRule; | |||
| @@ -231,7 +233,7 @@ public class WxCashBackActivityController extends BaseController { | |||
| TenantEntity tenantInfo = getTenantInfo(); | |||
| wxCashBackActivityRecord.updateTenantInfo(tenantInfo); | |||
| wxCashBackActivityRecord.setSortColumns(SortField.CreateDate_DESC); | |||
| final PageInfo<WxCashBackActivityRecord> page = wxCashBackActivityService.listActivityRecordAsPage(wxCashBackActivityRecord, pageNum, pageSize); | |||
| final PageInfo<WxCashBackActivityRecord> page = wxCashBackActivityService.listActivityRecordAsPage(wxCashBackActivityRecord, pageNum, pageSize,null); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -241,14 +243,26 @@ public class WxCashBackActivityController extends BaseController { | |||
| TenantEntity tenantInfo = getTenantInfo(); | |||
| wxCashBackActivityRecord.updateTenantInfo(tenantInfo); | |||
| wxCashBackActivityRecord.setSortColumns(SortField.CreateDate_DESC); | |||
| PageInfo<WxCashBackActivityRecord> page = wxCashBackActivityService.listActivityRecordAsPage(wxCashBackActivityRecord, 1, 10000); | |||
| List<WxCashBackActivityRecord> result = null; | |||
| if (null != page && null != page.getList()) { | |||
| result = page.getList(); | |||
| if (null != wxCashBackActivityRecord.getActivityId()) { | |||
| //List<Long> _aids = new ArrayList<Long>(); | |||
| //_aids.add(wxCashBackActivityRecord.getActivityId()); | |||
| //Map<Long,WxCashBackActivityItem> itemMap = wxCashBackActivityService.getItemMap(wxCashBackActivityRecord,_aids); | |||
| List<Map<String,Object>> oneActivityExeclList = new ArrayList<Map<String,Object>>(); | |||
| PageInfo<WxCashBackActivityRecord> page = wxCashBackActivityService.listActivityRecordAsPage(wxCashBackActivityRecord, 1, 10000,oneActivityExeclList); | |||
| Integer maxExtendsSize = wxCashBackActivityService.getMaxRecordExtendsSize(wxCashBackActivityRecord); | |||
| wxCashBackActivityService.exportData(WxCashBackActivityRecord.generateExcelTitle(maxExtendsSize),oneActivityExeclList, "返现活动记录.xlsx","sheet1", request, response); | |||
| }else { | |||
| result = new ArrayList<WxCashBackActivityRecord>(); | |||
| PageInfo<WxCashBackActivityRecord> page = wxCashBackActivityService.listActivityRecordAsPage(wxCashBackActivityRecord, 1, 10000,null); | |||
| List<WxCashBackActivityRecord> result = null; | |||
| if (null != page && null != page.getList()) { | |||
| result = page.getList(); | |||
| }else { | |||
| result = new ArrayList<WxCashBackActivityRecord>(); | |||
| } | |||
| wxCashBackActivityService.exportData(result,"现金返现记录",WxCashBackActivityRecord.class, request, response); | |||
| } | |||
| wxCashBackActivityService.exportData(result,"现金返现记录",WxCashBackActivityRecord.class, request, response); | |||
| } | |||
| @ApiOperation("查询当前提现信息") | |||
| @@ -265,7 +279,7 @@ public class WxCashBackActivityController extends BaseController { | |||
| activity.setActivityName(a.getName()); | |||
| } | |||
| } | |||
| activity.setRecordExtends(wxCashBackActivityService.getRecordExtends(activity)); | |||
| if (null != activity.getMerchantId()) { | |||
| WxMerchant m = new WxMerchant(); | |||
| m.updateTenantInfo(activity); | |||
| @@ -250,7 +250,8 @@ public class WxRaffleActivityController extends BaseController { | |||
| Map<Long,WxRaffleActivityItem> itemMap = wxCashBackActivityService.getItemMap(wxCashBackActivityRecord,_aids); | |||
| List<Map<String,Object>> oneActivityExeclList = new ArrayList<Map<String,Object>>(); | |||
| PageInfo<WxRaffleActivityRecord> page = wxCashBackActivityService.listActivityRecordAsPage(wxCashBackActivityRecord, 1, 10000,oneActivityExeclList); | |||
| wxCashBackActivityService.exportData(WxRaffleActivityRecord.generateExcelTitle(itemMap),oneActivityExeclList, "线下抽奖记录.xlsx","sheet1", request, response); | |||
| Integer maxExtendsSize = wxCashBackActivityService.getMaxRecordExtendsSize(wxCashBackActivityRecord); | |||
| wxCashBackActivityService.exportData(WxRaffleActivityRecord.generateExcelTitle(itemMap,maxExtendsSize),oneActivityExeclList, "线下抽奖记录.xlsx","sheet1", request, response); | |||
| }else { | |||
| PageInfo<WxRaffleActivityRecord> page = wxCashBackActivityService.listActivityRecordAsPage(wxCashBackActivityRecord, 1, 10000,null); | |||
| List<WxRaffleActivityRecord> result = null; | |||
| @@ -281,7 +282,7 @@ public class WxRaffleActivityController extends BaseController { | |||
| aids.add(activity.getActivityId()); | |||
| activity.setRecordItemList(wxCashBackActivityService.getActivityRecordItemListByRecordId(aids, id, tenantInfo)); | |||
| activity.setItemDetail(activity.generateItemDetaiJson(wxCashBackActivityService.getMallUserInfoMap(activity))); | |||
| activity.setRecordExtends(wxCashBackActivityService.getRecordExtends(activity)); | |||
| if (null != activity.getMerchantId()) { | |||
| WxMerchant m = new WxMerchant(); | |||
| m.updateTenantInfo(activity); | |||
| @@ -109,7 +109,7 @@ public class WxCashBackActivityController extends BaseController { | |||
| wxCashBackActivityRecord.updateTenantInfo(tenantInfo); | |||
| wxCashBackActivityRecord.setMerchantId(getLoginBUser().getMerchantId()); | |||
| wxCashBackActivityRecord.setSortColumns(SortField.CreateDate_DESC); | |||
| final PageInfo<WxCashBackActivityRecord> page = wxCashBackActivityService.listActivityRecordAsPage(wxCashBackActivityRecord, pageNum, pageSize); | |||
| final PageInfo<WxCashBackActivityRecord> page = wxCashBackActivityService.listActivityRecordAsPage(wxCashBackActivityRecord, pageNum, pageSize,null); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -127,7 +127,7 @@ public class WxCashBackActivityController extends BaseController { | |||
| activity.setActivityName(a.getName()); | |||
| } | |||
| } | |||
| activity.setRecordExtends(wxCashBackActivityService.getRecordExtends(activity)); | |||
| WxCashBackActivityItem item = wxCashBackActivityService.getActivityItemById(activity.getItemId(), tenantInfo.getTenantId()); | |||
| if (null != item) { | |||
| activity.setItemName(item.getName()); | |||
| @@ -136,6 +136,7 @@ public class WxRaffleActivityController extends BaseController { | |||
| aids.add(activity.getActivityId()); | |||
| activity.setRecordItemList(wxCashBackActivityService.getActivityRecordItemListByRecordId(aids, id, tenantInfo)); | |||
| activity.setItemDetail(activity.generateItemDetaiJson(wxCashBackActivityService.getMallUserInfoMap(activity))); | |||
| activity.setRecordExtends(wxCashBackActivityService.getRecordExtends(activity)); | |||
| if (null != activity.getMerchantId()) { | |||
| WxMerchant m = new WxMerchant(); | |||
| m.updateTenantInfo(activity); | |||
| @@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @TableName(value = "wx_cash_back_activity_item") | |||
| @Data | |||
| @@ -37,5 +38,8 @@ public class WxCashBackActivityItem extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "商户返现比例", name = "merchantBackRate") | |||
| private BigDecimal merchantBackRate; | |||
| @TableField(exist = false) | |||
| private List<Long> activityIdList; | |||
| } | |||
| @@ -3,6 +3,8 @@ package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumCashBackActivityRecordStatus; | |||
| import com.iformall.utils.DateUtils; | |||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||
| import lombok.Data; | |||
| @@ -11,7 +13,11 @@ import lombok.ToString; | |||
| import java.math.BigDecimal; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.Iterator; | |||
| import java.util.LinkedHashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @TableName(value = "wx_cash_back_activity_record") | |||
| @Data | |||
| @@ -31,6 +37,9 @@ public class WxCashBackActivityRecord extends TenantEntity { | |||
| @Excel(name="商户名称",width = 20,orderNum = "2") | |||
| @TableField(exist = false) | |||
| private String merchantName; | |||
| @Excel(name="商铺号",width = 20,orderNum = "3") | |||
| @TableField(exist = false) | |||
| private String shopNumber; | |||
| @io.swagger.annotations.ApiModelProperty(value = "选项", name = "itemId") | |||
| private Long itemId; | |||
| @Excel(name="选项名称",width = 20,orderNum = "3") | |||
| @@ -92,4 +101,57 @@ public class WxCashBackActivityRecord extends TenantEntity { | |||
| @TableField(exist = false) | |||
| private List<Long> merchantIdList; | |||
| @TableField(exist = false) | |||
| private List<WxCashBackActivityRecordExtends> recordExtends; | |||
| public static Map<String,String> generateExcelTitle(Integer recordExtendsSize) { | |||
| Map<String,String> excelTitle = new LinkedHashMap<String,String>(); | |||
| excelTitle.put("activityName", "活动名称"); | |||
| excelTitle.put("merchantName", "商户名称"); | |||
| excelTitle.put("shopNumber", "商铺号"); | |||
| excelTitle.put("orderNo", "订单号"); | |||
| excelTitle.put("orderMoney", "订单金额"); | |||
| excelTitle.put("cusName", "客户姓名"); | |||
| excelTitle.put("phone", "客户电话"); | |||
| excelTitle.put("address", "客户地址"); | |||
| excelTitle.put("createDate", "提交时间"); | |||
| excelTitle.put("itemName", "选项名称"); | |||
| excelTitle.put("auditStatus", "状态"); | |||
| excelTitle.put("auditRemark", "审核内容"); | |||
| if (null != recordExtendsSize && recordExtendsSize > 0 ) { | |||
| for (int i = 0 ; i < recordExtendsSize ; i++) { | |||
| excelTitle.put("remark_"+i, "备注_"+(i+1)); | |||
| } | |||
| } | |||
| return excelTitle; | |||
| } | |||
| public Map<String,Object> generateExcelData() { | |||
| Map<String,Object> excelObject = new HashMap<String,Object>(); | |||
| excelObject.put("activityName", activityName); | |||
| excelObject.put("merchantName", merchantName); | |||
| excelObject.put("shopNumber", shopNumber); | |||
| excelObject.put("orderNo", orderNo); | |||
| excelObject.put("orderMoney", orderMoney); | |||
| excelObject.put("cusName", cusName); | |||
| excelObject.put("phone", phone); | |||
| excelObject.put("address", address); | |||
| excelObject.put("createDate", DateUtils.date2String(createDate)); | |||
| excelObject.put("itemName", this.itemName); | |||
| EnumCashBackActivityRecordStatus status = EnumCashBackActivityRecordStatus.getEnum(auditStatus); | |||
| if (null != status ) { | |||
| excelObject.put("auditStatus", status.getMessage()); | |||
| } | |||
| excelObject.put("auditRemark", auditRemark); | |||
| if (null != recordExtends && recordExtends.size() > 0 ) { | |||
| for (int i = 0 ; i < recordExtends.size() ; i++) { | |||
| WxCashBackActivityRecordExtends re = recordExtends.get(i); | |||
| excelObject.put("remark_"+i, re.getRemark()); | |||
| } | |||
| } | |||
| return excelObject; | |||
| } | |||
| } | |||
| @@ -0,0 +1,32 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.util.Date; | |||
| @TableName(value = "wx_cash_back_activity_record_extends") | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxCashBackActivityRecordExtends extends TenantEntity { | |||
| private static final long serialVersionUID = 1608288407081146149L; | |||
| private Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value = "活动", name = "activityId") | |||
| private Long activityId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "记录ID", name = "recordId") | |||
| private Long recordId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "备注", name = "remark") | |||
| private String remark; | |||
| @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createDate") | |||
| private Date createDate; | |||
| @io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updateDate") | |||
| private Date updateDate; | |||
| } | |||
| @@ -109,6 +109,9 @@ public class WxRaffleActivityRecord extends TenantEntity { | |||
| @TableField(exist = false) | |||
| private Map<String,String> recordItemJiangQuanCountMap; | |||
| @TableField(exist = false) | |||
| private List<WxRaffleActivityRecordExtends> recordExtends; | |||
| public String generateItemDetaiJson(Map<Long,MallUserInfo> userMap) { | |||
| if(null != auditBy) { | |||
| MallUserInfo au = userMap.get(auditBy); | |||
| @@ -159,9 +162,10 @@ public class WxRaffleActivityRecord extends TenantEntity { | |||
| } | |||
| } | |||
| } | |||
| } | |||
| public static Map<String,String> generateExcelTitle(Map<Long,WxRaffleActivityItem> itemMap) { | |||
| public static Map<String,String> generateExcelTitle(Map<Long,WxRaffleActivityItem> itemMap,Integer recordExtendsSize) { | |||
| Map<String,String> excelTitle = new LinkedHashMap<String,String>(); | |||
| excelTitle.put("activityName", "活动名称"); | |||
| excelTitle.put("merchantName", "商户名称"); | |||
| @@ -188,6 +192,13 @@ public class WxRaffleActivityRecord extends TenantEntity { | |||
| excelTitle.put("sendTime", "发奖时间"); | |||
| excelTitle.put("sendByName", "发奖人"); | |||
| if (null != recordExtendsSize && recordExtendsSize > 0 ) { | |||
| for (int i = 0 ; i < recordExtendsSize ; i++) { | |||
| excelTitle.put("remark_"+i, "备注_"+(i+1)); | |||
| } | |||
| } | |||
| return excelTitle; | |||
| } | |||
| @@ -243,6 +254,13 @@ public class WxRaffleActivityRecord extends TenantEntity { | |||
| excelObject.put("sendByName", mu.getName()); | |||
| } | |||
| } | |||
| if (null != recordExtends && recordExtends.size() > 0 ) { | |||
| for (int i = 0 ; i < recordExtends.size() ; i++) { | |||
| WxRaffleActivityRecordExtends re = recordExtends.get(i); | |||
| excelObject.put("remark_"+i, re.getRemark()); | |||
| } | |||
| } | |||
| return excelObject; | |||
| } | |||
| @@ -0,0 +1,32 @@ | |||
| package com.iformall.domain.po; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.util.Date; | |||
| @TableName(value = "wx_raffle_activity_record_extends") | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxRaffleActivityRecordExtends extends TenantEntity { | |||
| private static final long serialVersionUID = 1608288407081146149L; | |||
| private Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value = "活动", name = "activityId") | |||
| private Long activityId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "记录ID", name = "recordId") | |||
| private Long recordId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "备注", name = "remark") | |||
| private String remark; | |||
| @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createDate") | |||
| private Date createDate; | |||
| @io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updateDate") | |||
| private Date updateDate; | |||
| } | |||
| @@ -0,0 +1,22 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxCashBackActivityRecordExtends; | |||
| import com.iformall.domain.po.WxRaffleActivityRecordExtends; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.List; | |||
| public interface WxCashBackActivityRecordExtendsMapper extends CommonMapper<WxCashBackActivityRecordExtends, Long> { | |||
| WxCashBackActivityRecordExtends selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| List<WxCashBackActivityRecordExtends> findList(WxCashBackActivityRecordExtends recordExtends); | |||
| Integer findMaxRecordExtendsSize(WxCashBackActivityRecordExtends recordExtends); | |||
| void deleteExtendsByRecordId(WxCashBackActivityRecordExtends recordExtends); | |||
| } | |||
| @@ -0,0 +1,25 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxRaffleActivityRecord; | |||
| import com.iformall.domain.po.WxRaffleActivityRecordExtends; | |||
| import com.iformall.domain.po.WxRaffleActivityRecordItem; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.math.BigDecimal; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| public interface WxRaffleActivityRecordExtendsMapper extends CommonMapper<WxRaffleActivityRecordExtends, Long> { | |||
| WxRaffleActivityRecordExtends selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| List<WxRaffleActivityRecordExtends> findList(WxRaffleActivityRecordExtends recordExtends); | |||
| Integer findMaxRecordExtendsSize(WxRaffleActivityRecordExtends recordExtends); | |||
| void deleteExtendsByRecordId(WxRaffleActivityRecordExtends recordExtends); | |||
| } | |||
| @@ -12,6 +12,11 @@ import com.iformall.domain.po.WxCashBackActivity; | |||
| import com.iformall.domain.po.WxCashBackActivityItem; | |||
| import com.iformall.domain.po.WxCashBackActivityMerchant; | |||
| import com.iformall.domain.po.WxCashBackActivityRecord; | |||
| import com.iformall.domain.po.WxCashBackActivityRecordExtends; | |||
| import com.iformall.domain.po.WxRaffleActivityItem; | |||
| import com.iformall.domain.po.WxRaffleActivityRecord; | |||
| import com.iformall.domain.po.WxRaffleActivityRecordExtends; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumCashBackActivityRecordStatus; | |||
| public interface WxCashBackActivityService { | |||
| @@ -28,7 +33,7 @@ public interface WxCashBackActivityService { | |||
| PageInfo<WxCashBackActivityItem> listActivityItemAsPage(WxCashBackActivityItem record, Integer pageIndex, Integer pageSize); | |||
| PageInfo<WxCashBackActivityRecord> listActivityRecordAsPage(WxCashBackActivityRecord record, Integer pageIndex, Integer pageSize); | |||
| PageInfo<WxCashBackActivityRecord> listActivityRecordAsPage(WxCashBackActivityRecord record, Integer pageIndex, Integer pageSize,List<Map<String,Object>> oneActivityExeclList); | |||
| int getItemCount(WxCashBackActivity record); | |||
| int getRecordCount(WxCashBackActivityRecord record); | |||
| @@ -65,6 +70,7 @@ public interface WxCashBackActivityService { | |||
| List<WxCashBackActivityMerchant> getActivityMerchants(Long activityId,String tenantId,boolean hasMerchantInfo); | |||
| void exportData(List objectList,String sheetName,Class objectCalss,HttpServletRequest request, HttpServletResponse response); | |||
| void exportData(Map<String,String> titleMap,List<Map<String,Object>> objectList,String fileName,String sheetName,HttpServletRequest request, HttpServletResponse response); | |||
| void auditRecord(WxCashBackActivityRecord record); | |||
| @@ -72,5 +78,11 @@ public interface WxCashBackActivityService { | |||
| void saveOrUpdateRecord(WxCashBackActivityRecord record); | |||
| Map<Long,WxCashBackActivityItem> getItemMap(TenantEntity tenantEntity,List<Long> activitIds); | |||
| List<WxCashBackActivityRecordExtends> getRecordExtends(WxCashBackActivityRecord record); | |||
| Integer getMaxRecordExtendsSize(WxCashBackActivityRecord record); | |||
| } | |||
| @@ -13,6 +13,7 @@ import com.iformall.domain.po.WxRaffleActivity; | |||
| import com.iformall.domain.po.WxRaffleActivityItem; | |||
| import com.iformall.domain.po.WxRaffleActivityMerchant; | |||
| import com.iformall.domain.po.WxRaffleActivityRecord; | |||
| import com.iformall.domain.po.WxRaffleActivityRecordExtends; | |||
| import com.iformall.domain.po.WxRaffleActivityRecordItem; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumCashBackActivityRecordStatus; | |||
| @@ -84,5 +85,9 @@ public interface WxRaffleActivityService { | |||
| Map<Long,MallUserInfo> getMallUserInfoMap(TenantEntity tenantEntity); | |||
| List<WxRaffleActivityRecordExtends> getRecordExtends(WxRaffleActivityRecord record); | |||
| Integer getMaxRecordExtendsSize(WxRaffleActivityRecord record); | |||
| } | |||
| @@ -8,8 +8,13 @@ import com.iformall.domain.po.WxCashBackActivity; | |||
| import com.iformall.domain.po.WxCashBackActivityItem; | |||
| import com.iformall.domain.po.WxCashBackActivityMerchant; | |||
| import com.iformall.domain.po.WxCashBackActivityRecord; | |||
| import com.iformall.domain.po.WxCashBackActivityRecordExtends; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.WxRaffleActivityItem; | |||
| import com.iformall.domain.po.WxRaffleActivityRecord; | |||
| import com.iformall.domain.po.WxRaffleActivityRecordExtends; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.po.base.BaseEntity.SortField; | |||
| import com.iformall.domain.vo.WxCUserBasicInfoVo; | |||
| import com.iformall.enums.EnumCashBackActivityItemRule; | |||
| import com.iformall.enums.EnumCashBackActivityRecordStatus; | |||
| @@ -17,13 +22,17 @@ import com.iformall.enums.EnumYesOrNo; | |||
| import com.iformall.mapper.WxCashBackActivityItemMapper; | |||
| import com.iformall.mapper.WxCashBackActivityMapper; | |||
| import com.iformall.mapper.WxCashBackActivityMerchantMapper; | |||
| import com.iformall.mapper.WxCashBackActivityRecordExtendsMapper; | |||
| import com.iformall.mapper.WxCashBackActivityRecordMapper; | |||
| import com.iformall.mapper.WxMerchantMapper; | |||
| import com.iformall.service.ExcelService; | |||
| import com.iformall.service.WxCashBackActivityService; | |||
| import com.iformall.service.WxShopService; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.context.annotation.Lazy; | |||
| import org.springframework.stereotype.Service; | |||
| import java.math.BigDecimal; | |||
| @@ -46,10 +55,16 @@ public class WxCashBackActivityServiceImpl implements WxCashBackActivityService | |||
| WxCashBackActivityMerchantMapper wxCashBackActivityMerchantMapper; | |||
| @Autowired | |||
| WxMerchantMapper wxMerchantMapper; | |||
| @Autowired | |||
| WxCashBackActivityRecordExtendsMapper wxCashBackActivityRecordExtendsMapper; | |||
| @Autowired | |||
| ExcelService excelService; | |||
| @Lazy | |||
| @Autowired | |||
| WxShopService wxShopService; | |||
| @Override | |||
| public PageInfo<WxCashBackActivity> listActivityAsPage(WxCashBackActivity record, Integer pageIndex, Integer pageSize) { | |||
| if (null != record.getMerchantId()) { | |||
| @@ -117,16 +132,16 @@ public class WxCashBackActivityServiceImpl implements WxCashBackActivityService | |||
| @Override | |||
| public PageInfo<WxCashBackActivityRecord> listActivityRecordAsPage(WxCashBackActivityRecord record, | |||
| Integer pageIndex, Integer pageSize) { | |||
| Integer pageIndex, Integer pageSize,List<Map<String,Object>> oneActivityExeclList) { | |||
| initRecordQueryParam(record); | |||
| PageInfo<WxCashBackActivityRecord> recordPage = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCashBackActivityRecordMapper.findList(record)); | |||
| if (null != recordPage && null != recordPage.getList()) { | |||
| handerRecordPageData(record,recordPage.getList()); | |||
| handerRecordPageData(record,recordPage.getList(),oneActivityExeclList,record.getActivityId()); | |||
| } | |||
| return recordPage; | |||
| } | |||
| private void handerRecordPageData(TenantEntity tenantEntity,List<WxCashBackActivityRecord> recordList) { | |||
| private void handerRecordPageData(TenantEntity tenantEntity,List<WxCashBackActivityRecord> recordList,List<Map<String,Object>> oneActivityExeclList,Long oneAcitvityId) { | |||
| if (null == recordList || recordList.size() <=0 ) { | |||
| return; | |||
| } | |||
| @@ -171,6 +186,11 @@ public class WxCashBackActivityServiceImpl implements WxCashBackActivityService | |||
| } | |||
| } | |||
| Map<Long,String> merchantShopNumberMap = null; | |||
| if (null != midList && midList.size() > 0 ) { | |||
| merchantShopNumberMap = wxShopService.getMerchantShopNumberMap(tenantEntity, midList); | |||
| } | |||
| for (WxCashBackActivityRecord _r : recordList) { | |||
| if (null != _r.getActivityId()) { | |||
| WxCashBackActivity _a = activityMap.get(_r.getActivityId()); | |||
| @@ -184,6 +204,10 @@ public class WxCashBackActivityServiceImpl implements WxCashBackActivityService | |||
| if (null != _m) { | |||
| _r.setMerchantName(_m.getName()); | |||
| } | |||
| if (null != merchantShopNumberMap && merchantShopNumberMap.containsKey(_r.getMerchantId())) { | |||
| _r.setShopNumber(merchantShopNumberMap.get(_r.getMerchantId())); | |||
| } | |||
| } | |||
| if (null != _r.getItemId()) { | |||
| @@ -192,6 +216,10 @@ public class WxCashBackActivityServiceImpl implements WxCashBackActivityService | |||
| _r.setItemName(_i.getName()); | |||
| } | |||
| } | |||
| if (null != oneActivityExeclList && null != oneAcitvityId) { | |||
| oneActivityExeclList.add(_r.generateExcelData()); | |||
| } | |||
| } | |||
| } | |||
| @@ -341,6 +369,12 @@ public class WxCashBackActivityServiceImpl implements WxCashBackActivityService | |||
| public void exportData(List objectList,String sheetName,Class objectCalss,HttpServletRequest request, HttpServletResponse response) { | |||
| excelService.exportExcel(objectList, null, sheetName, objectCalss, sheetName+".xlsx", response, false); | |||
| } | |||
| @Override | |||
| public void exportData(Map<String,String> titleMap,List<Map<String, Object>> objectList, String fileName,String sheetName, HttpServletRequest request, | |||
| HttpServletResponse response) { | |||
| excelService.exportExcel(titleMap,objectList, fileName,sheetName, response); | |||
| } | |||
| @Override | |||
| public void auditRecord(WxCashBackActivityRecord record) { | |||
| @@ -381,6 +415,26 @@ public class WxCashBackActivityServiceImpl implements WxCashBackActivityService | |||
| wxCashBackActivityRecordMapper.updateById(record); | |||
| } | |||
| WxCashBackActivityRecordExtends wxCashBackActivityRecordExtends = new WxCashBackActivityRecordExtends(); | |||
| wxCashBackActivityRecordExtends.updateTenantInfo(record); | |||
| wxCashBackActivityRecordExtends.setRecordId(record.getId()); | |||
| wxCashBackActivityRecordExtendsMapper.deleteExtendsByRecordId(wxCashBackActivityRecordExtends); | |||
| if (null != record.getRecordExtends()) { | |||
| for (int i = 0 ; i < record.getRecordExtends().size() ; i++) { | |||
| WxCashBackActivityRecordExtends re = record.getRecordExtends().get(i); | |||
| WxCashBackActivityRecordExtends are = new WxCashBackActivityRecordExtends(); | |||
| are.setId(idWorker.nextId()); | |||
| are.updateTenantInfo(record); | |||
| are.setCreateDate(new Date()); | |||
| are.setUpdateDate(new Date()); | |||
| are.setActivityId(record.getActivityId()); | |||
| are.setRecordId(record.getId()); | |||
| are.setRemark(re.getRemark()); | |||
| wxCashBackActivityRecordExtendsMapper.insert(are); | |||
| } | |||
| } | |||
| } | |||
| @Override | |||
| @@ -388,5 +442,38 @@ public class WxCashBackActivityServiceImpl implements WxCashBackActivityService | |||
| initRecordQueryParam(record); | |||
| return wxCashBackActivityRecordMapper.selectMerchantRecords(record); | |||
| } | |||
| @Override | |||
| public Map<Long,WxCashBackActivityItem> getItemMap(TenantEntity tenantEntity,List<Long> activitIds) { | |||
| WxCashBackActivityItem iq = new WxCashBackActivityItem(); | |||
| iq.updateTenantInfo(tenantEntity); | |||
| iq.setActivityIdList(activitIds); | |||
| List<WxCashBackActivityItem> iqList = wxCashBackActivityItemMapper.findList(iq); | |||
| Map<Long,WxCashBackActivityItem> itemMap = new HashMap<Long,WxCashBackActivityItem>(); | |||
| if (null != iqList && iqList.size() > 0 ) { | |||
| for (WxCashBackActivityItem i : iqList) { | |||
| itemMap.put(i.getId(), i); | |||
| } | |||
| } | |||
| return itemMap; | |||
| } | |||
| @Override | |||
| public List<WxCashBackActivityRecordExtends> getRecordExtends(WxCashBackActivityRecord record) { | |||
| WxCashBackActivityRecordExtends re = new WxCashBackActivityRecordExtends(); | |||
| re.updateTenantInfo(record); | |||
| re.setActivityId(record.getActivityId()); | |||
| re.setRecordId(record.getId()); | |||
| re.setSortColumns(SortField.CreateDate_ASC); | |||
| return wxCashBackActivityRecordExtendsMapper.findList(re); | |||
| } | |||
| @Override | |||
| public Integer getMaxRecordExtendsSize(WxCashBackActivityRecord record) { | |||
| WxCashBackActivityRecordExtends re = new WxCashBackActivityRecordExtends(); | |||
| re.updateTenantInfo(record); | |||
| re.setActivityId(record.getActivityId()); | |||
| return wxCashBackActivityRecordExtendsMapper.findMaxRecordExtendsSize(re); | |||
| } | |||
| } | |||
| @@ -11,7 +11,9 @@ import com.iformall.domain.po.WxRaffleActivity; | |||
| import com.iformall.domain.po.WxRaffleActivityItem; | |||
| import com.iformall.domain.po.WxRaffleActivityMerchant; | |||
| import com.iformall.domain.po.WxRaffleActivityRecord; | |||
| import com.iformall.domain.po.WxRaffleActivityRecordExtends; | |||
| import com.iformall.domain.po.WxRaffleActivityRecordItem; | |||
| import com.iformall.domain.po.base.BaseEntity.SortField; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxCUserBasicInfoVo; | |||
| import com.iformall.enums.EnumCashBackActivityItemRule; | |||
| @@ -21,6 +23,7 @@ import com.iformall.mapper.WxMerchantMapper; | |||
| import com.iformall.mapper.WxRaffleActivityItemMapper; | |||
| import com.iformall.mapper.WxRaffleActivityMapper; | |||
| import com.iformall.mapper.WxRaffleActivityMerchantMapper; | |||
| import com.iformall.mapper.WxRaffleActivityRecordExtendsMapper; | |||
| import com.iformall.mapper.WxRaffleActivityRecordItemMapper; | |||
| import com.iformall.mapper.WxRaffleActivityRecordMapper; | |||
| import com.iformall.service.ExcelService; | |||
| @@ -54,6 +57,8 @@ public class WxRaffleActivityServiceImpl implements WxRaffleActivityService { | |||
| WxRaffleActivityMerchantMapper wxActivityMerchantMapper; | |||
| @Autowired | |||
| WxMerchantMapper wxMerchantMapper; | |||
| @Autowired | |||
| WxRaffleActivityRecordExtendsMapper wxRaffleActivityRecordExtendsMapper; | |||
| @Lazy | |||
| @Autowired | |||
| @@ -208,6 +213,7 @@ public class WxRaffleActivityServiceImpl implements WxRaffleActivityService { | |||
| _r.setRecordItemList(getActivityRecordItemListByRecordId(aidList,_r.getId(),_r)); | |||
| _r.setItemDetail(_r.generateItemDetaiJson(userMap)); | |||
| _r.setRecordExtends(getRecordExtends(_r)); | |||
| if (null != oneActivityExeclList && null != oneAcitvityId) { | |||
| _r.generateItemIds(); | |||
| @@ -499,6 +505,26 @@ public class WxRaffleActivityServiceImpl implements WxRaffleActivityService { | |||
| wxActivityRecordMapper.updateById(record); | |||
| } | |||
| WxRaffleActivityRecordExtends wxRaffleActivityRecordExtends = new WxRaffleActivityRecordExtends(); | |||
| wxRaffleActivityRecordExtends.updateTenantInfo(record); | |||
| wxRaffleActivityRecordExtends.setRecordId(record.getId()); | |||
| wxRaffleActivityRecordExtendsMapper.deleteExtendsByRecordId(wxRaffleActivityRecordExtends); | |||
| if (null != record.getRecordExtends()) { | |||
| for (int i = 0 ; i < record.getRecordExtends().size() ; i++) { | |||
| WxRaffleActivityRecordExtends re = record.getRecordExtends().get(i); | |||
| WxRaffleActivityRecordExtends are = new WxRaffleActivityRecordExtends(); | |||
| are.setId(idWorker.nextId()); | |||
| are.updateTenantInfo(record); | |||
| are.setCreateDate(new Date()); | |||
| are.setUpdateDate(new Date()); | |||
| are.setActivityId(record.getActivityId()); | |||
| are.setRecordId(record.getId()); | |||
| are.setRemark(re.getRemark()); | |||
| wxRaffleActivityRecordExtendsMapper.insert(are); | |||
| } | |||
| } | |||
| } | |||
| @Override | |||
| @@ -541,4 +567,23 @@ public class WxRaffleActivityServiceImpl implements WxRaffleActivityService { | |||
| } | |||
| return _riList; | |||
| } | |||
| @Override | |||
| public List<WxRaffleActivityRecordExtends> getRecordExtends(WxRaffleActivityRecord record) { | |||
| WxRaffleActivityRecordExtends re = new WxRaffleActivityRecordExtends(); | |||
| re.updateTenantInfo(record); | |||
| re.setActivityId(record.getActivityId()); | |||
| re.setRecordId(record.getId()); | |||
| re.setSortColumns(SortField.CreateDate_ASC); | |||
| return wxRaffleActivityRecordExtendsMapper.findList(re); | |||
| } | |||
| @Override | |||
| public Integer getMaxRecordExtendsSize(WxRaffleActivityRecord record) { | |||
| WxRaffleActivityRecordExtends re = new WxRaffleActivityRecordExtends(); | |||
| re.updateTenantInfo(record); | |||
| re.setActivityId(record.getActivityId()); | |||
| re.setRecordId(record.getId()); | |||
| return wxRaffleActivityRecordExtendsMapper.findMaxRecordExtendsSize(re); | |||
| } | |||
| } | |||
| @@ -50,6 +50,13 @@ | |||
| and `activity_id` = #{activityId} | |||
| </if> | |||
| <if test=" null != activityIdList "> | |||
| and activity_id in | |||
| <foreach collection="activityIdList" index="index" item="aidItem" open="(" separator="," close=")"> | |||
| #{aidItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| @@ -0,0 +1,78 @@ | |||
| <?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.WxCashBackActivityRecordExtendsMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCashBackActivityRecordExtends"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="activity_id" jdbcType="BIGINT" property="activityId" /> | |||
| <result column="record_id" jdbcType="BIGINT" property="recordId" /> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||
| <result column="remark" jdbcType="VARCHAR" property="remark" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`activity_id`,`record_id`,`create_date`,`update_date`,`remark` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != activityId "> | |||
| and `activity_id` = #{activityId} | |||
| </if> | |||
| <if test=" null != recordId "> | |||
| and `record_id` = #{recordId} | |||
| </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 != 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> | |||
| </sql> | |||
| <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_cash_back_activity_record_extends where id = #{id} and tenant_id=#{tenantId} | |||
| </select> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxCashBackActivityRecordExtends" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_cash_back_activity_record_extends | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="findMaxRecordExtendsSize" parameterType="com.iformall.domain.po.WxCashBackActivityRecordExtends" resultType="Integer"> | |||
| SELECT COUNT(record_id) FROM wx_cash_back_activity_record_extends | |||
| where `activity_id` = #{activityId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| GROUP BY record_id ORDER BY COUNT(record_id) DESC limit 0,1 | |||
| </select> | |||
| <delete id = "deleteExtendsByRecordId" parameterType="com.iformall.domain.po.WxCashBackActivityRecordExtends"> | |||
| delete from wx_cash_back_activity_record_extends where `record_id` = #{recordId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </delete> | |||
| </mapper> | |||
| @@ -0,0 +1,78 @@ | |||
| <?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.WxRaffleActivityRecordExtendsMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxRaffleActivityRecordExtends"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| <result column="activity_id" jdbcType="BIGINT" property="activityId" /> | |||
| <result column="record_id" jdbcType="BIGINT" property="recordId" /> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||
| <result column="remark" jdbcType="VARCHAR" property="remark" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`parent_tenant_id`,`activity_id`,`record_id`,`create_date`,`update_date`,`remark` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != activityId "> | |||
| and `activity_id` = #{activityId} | |||
| </if> | |||
| <if test=" null != recordId "> | |||
| and `record_id` = #{recordId} | |||
| </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 != 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> | |||
| </sql> | |||
| <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_raffle_activity_record_extends where id = #{id} and tenant_id=#{tenantId} | |||
| </select> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxRaffleActivityRecordExtends" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_raffle_activity_record_extends | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="findMaxRecordExtendsSize" parameterType="com.iformall.domain.po.WxRaffleActivityRecordExtends" resultType="Integer"> | |||
| SELECT COUNT(record_id) FROM wx_raffle_activity_record_extends | |||
| where `activity_id` = #{activityId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| GROUP BY record_id ORDER BY COUNT(record_id) DESC limit 0,1 | |||
| </select> | |||
| <delete id = "deleteExtendsByRecordId" parameterType="com.iformall.domain.po.WxRaffleActivityRecordExtends"> | |||
| delete from wx_raffle_activity_record_extends where `record_id` = #{recordId} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </delete> | |||
| </mapper> | |||