| @@ -234,7 +234,7 @@ public class WxRaffleActivityController extends BaseController { | |||
| TenantEntity tenantInfo = getTenantInfo(); | |||
| wxCashBackActivityRecord.updateTenantInfo(tenantInfo); | |||
| wxCashBackActivityRecord.setSortColumns(SortField.CreateDate_DESC); | |||
| final PageInfo<WxRaffleActivityRecord> page = wxCashBackActivityService.listActivityRecordAsPage(wxCashBackActivityRecord, pageNum, pageSize); | |||
| final PageInfo<WxRaffleActivityRecord> page = wxCashBackActivityService.listActivityRecordAsPage(wxCashBackActivityRecord, pageNum, pageSize,null); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -244,14 +244,20 @@ public class WxRaffleActivityController extends BaseController { | |||
| TenantEntity tenantInfo = getTenantInfo(); | |||
| wxCashBackActivityRecord.updateTenantInfo(tenantInfo); | |||
| wxCashBackActivityRecord.setSortColumns(SortField.CreateDate_DESC); | |||
| PageInfo<WxRaffleActivityRecord> page = wxCashBackActivityService.listActivityRecordAsPage(wxCashBackActivityRecord, 1, 10000); | |||
| List<WxRaffleActivityRecord> result = null; | |||
| if (null != page && null != page.getList()) { | |||
| result = page.getList(); | |||
| if (null != wxCashBackActivityRecord.getActivityId()) { | |||
| List<Map<String,Object>> oneActivityExeclList = new ArrayList<Map<String,Object>>(); | |||
| PageInfo<WxRaffleActivityRecord> page = wxCashBackActivityService.listActivityRecordAsPage(wxCashBackActivityRecord, 1, 10000,oneActivityExeclList); | |||
| wxCashBackActivityService.exportData(oneActivityExeclList, "线下抽奖记录", request, response); | |||
| }else { | |||
| result = new ArrayList<WxRaffleActivityRecord>(); | |||
| PageInfo<WxRaffleActivityRecord> page = wxCashBackActivityService.listActivityRecordAsPage(wxCashBackActivityRecord, 1, 10000,null); | |||
| List<WxRaffleActivityRecord> result = null; | |||
| if (null != page && null != page.getList()) { | |||
| result = page.getList(); | |||
| }else { | |||
| result = new ArrayList<WxRaffleActivityRecord>(); | |||
| } | |||
| wxCashBackActivityService.exportData(result,"线下抽奖记录",WxRaffleActivityRecord.class, request, response); | |||
| } | |||
| wxCashBackActivityService.exportData(result,"线下抽奖记录",WxRaffleActivityRecord.class, request, response); | |||
| } | |||
| @ApiOperation("查询当前提现信息") | |||
| @@ -113,7 +113,7 @@ public class WxRaffleActivityController extends BaseController { | |||
| wxCashBackActivityRecord.updateTenantInfo(tenantInfo); | |||
| wxCashBackActivityRecord.setSortColumns(SortField.CreateDate_DESC); | |||
| wxCashBackActivityRecord.setMerchantId(getLoginBUser().getMerchantId()); | |||
| final PageInfo<WxRaffleActivityRecord> page = wxCashBackActivityService.listActivityRecordAsPage(wxCashBackActivityRecord, pageNum, pageSize); | |||
| final PageInfo<WxRaffleActivityRecord> page = wxCashBackActivityService.listActivityRecordAsPage(wxCashBackActivityRecord, pageNum, pageSize,null); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -51,7 +51,7 @@ public class WxCashBackActivityRecord extends TenantEntity { | |||
| @Excel(name="客户地址",width = 20,orderNum = "8") | |||
| @io.swagger.annotations.ApiModelProperty(value = "客户地址", name = "address") | |||
| private String address; | |||
| @Excel(name="状态",width = 20,replace = {"审核中_0", "审核通过_1", "审核驳回_2"},orderNum = "9") | |||
| @Excel(name="状态",width = 20,replace = {"审核中_0", "审核通过_1", "审核驳回_2","已退单_3"},orderNum = "9") | |||
| @io.swagger.annotations.ApiModelProperty(value = "EnumCashBackActivityRecordStatus", name = "auditStatus") | |||
| private Integer auditStatus; | |||
| @TableField(exist = false) | |||
| @@ -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; | |||
| @@ -10,8 +12,12 @@ import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.math.BigDecimal; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.Iterator; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @TableName(value = "wx_raffle_activity_record") | |||
| @Data | |||
| @@ -46,7 +52,7 @@ public class WxRaffleActivityRecord extends TenantEntity { | |||
| @Excel(name="客户地址",width = 20,orderNum = "8") | |||
| @io.swagger.annotations.ApiModelProperty(value = "客户地址", name = "address") | |||
| private String address; | |||
| @Excel(name="状态",width = 20,replace = {"审核中_0", "审核通过_1", "审核驳回_2"},orderNum = "9") | |||
| @Excel(name="状态",width = 20,replace = {"审核中_0", "审核通过_1", "审核驳回_2","已退单_3"},orderNum = "9") | |||
| @io.swagger.annotations.ApiModelProperty(value = "EnumCashBackActivityRecordStatus", name = "auditStatus") | |||
| private Integer auditStatus; | |||
| @TableField(exist = false) | |||
| @@ -76,6 +82,8 @@ public class WxRaffleActivityRecord extends TenantEntity { | |||
| @TableField(exist = false) | |||
| private List<WxRaffleActivityRecordItem> recordItemList; | |||
| @TableField(exist = false) | |||
| private List<Long> recordItemIdList; | |||
| public String generateItemDetaiJson() { | |||
| if (null != recordItemList && recordItemList.size() > 0 ) { | |||
| @@ -91,4 +99,45 @@ public class WxRaffleActivityRecord extends TenantEntity { | |||
| return null; | |||
| } | |||
| public List<Long> generateItemIds() { | |||
| if (null != recordItemList && recordItemList.size() > 0 ) { | |||
| List<Long> itemIdList = new ArrayList<Long>(); | |||
| for (int i = 0 ; i < recordItemList.size() ; i++) { | |||
| WxRaffleActivityRecordItem ri = recordItemList.get(i); | |||
| itemIdList.add(ri.getId()); | |||
| } | |||
| return itemIdList; | |||
| } | |||
| return null; | |||
| } | |||
| public Map<String,Object> generateExcelData(Map<Long,WxRaffleActivityItem> itemMap) { | |||
| Map<String,Object> excelObject = new HashMap<String,Object>(); | |||
| excelObject.put("活动名称", activityName); | |||
| excelObject.put("商户id", merchantId); | |||
| excelObject.put("订单号", orderNo); | |||
| excelObject.put("订单金额", orderMoney); | |||
| excelObject.put("客户姓名", cusName); | |||
| excelObject.put("客户电话", phone); | |||
| excelObject.put("客户地址", address); | |||
| EnumCashBackActivityRecordStatus status = EnumCashBackActivityRecordStatus.getEnum(auditStatus); | |||
| if (null != status ) { | |||
| excelObject.put("状态", status.getMessage()); | |||
| } | |||
| excelObject.put("审核内容", auditRemark); | |||
| excelObject.put("提交时间", DateUtils.date2String(createDate)); | |||
| if (null != itemMap) { | |||
| for (Iterator<Long> it = itemMap.keySet().iterator();it.hasNext();) { | |||
| Long itemId = it.next(); | |||
| WxRaffleActivityItem item = itemMap.get(itemId); | |||
| if (null != recordItemIdList && recordItemIdList.contains(itemId)) { | |||
| excelObject.put(item.getName(), 1); | |||
| }else { | |||
| excelObject.put(item.getName(), 0); | |||
| } | |||
| } | |||
| } | |||
| return excelObject; | |||
| } | |||
| } | |||
| @@ -8,7 +8,8 @@ public enum EnumCashBackActivityRecordStatus { | |||
| AUDTING(0, "审核中"), | |||
| AUDI_SUCCESS(1, "审批通过"), | |||
| AUDT_FAIL(2, "审批拒绝"); | |||
| AUDT_FAIL(2, "审批拒绝"), | |||
| AUDT_REFUND(3, "退单"); | |||
| public static EnumCashBackActivityRecordStatus getEnum(Integer code) { | |||
| for (EnumCashBackActivityRecordStatus value : values()) { | |||
| @@ -30,7 +30,7 @@ public interface WxRaffleActivityService { | |||
| PageInfo<WxRaffleActivityItem> listActivityItemAsPage(WxRaffleActivityItem record, Integer pageIndex, Integer pageSize); | |||
| PageInfo<WxRaffleActivityRecord> listActivityRecordAsPage(WxRaffleActivityRecord record, Integer pageIndex, Integer pageSize); | |||
| PageInfo<WxRaffleActivityRecord> listActivityRecordAsPage(WxRaffleActivityRecord record, Integer pageIndex, Integer pageSize,List<Map<String,Object>> oneActivityExeclList); | |||
| int getItemCount(WxRaffleActivity record); | |||
| int getRecordCount(WxRaffleActivityRecord record); | |||
| @@ -69,6 +69,7 @@ public interface WxRaffleActivityService { | |||
| List<WxRaffleActivityMerchant> getActivityMerchants(Long activityId,String tenantId,boolean hasMerchantInfo); | |||
| void exportData(List objectList,String sheetName,Class objectCalss,HttpServletRequest request, HttpServletResponse response); | |||
| void exportData(List<Map<String,Object>> objectList,String fileName,HttpServletRequest request, HttpServletResponse response); | |||
| void auditRecord(WxRaffleActivityRecord record); | |||
| @@ -120,17 +120,16 @@ public class WxRaffleActivityServiceImpl implements WxRaffleActivityService { | |||
| } | |||
| @Override | |||
| public PageInfo<WxRaffleActivityRecord> listActivityRecordAsPage(WxRaffleActivityRecord record, | |||
| Integer pageIndex, Integer pageSize) { | |||
| public PageInfo<WxRaffleActivityRecord> listActivityRecordAsPage(WxRaffleActivityRecord record,Integer pageIndex, Integer pageSize,List<Map<String,Object>> oneActivityExeclList) { | |||
| initRecordQueryParam(record); | |||
| PageInfo<WxRaffleActivityRecord> recordPage = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxActivityRecordMapper.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<WxRaffleActivityRecord> recordList) { | |||
| private void handerRecordPageData(TenantEntity tenantEntity,List<WxRaffleActivityRecord> recordList,List<Map<String,Object>> oneActivityExeclList,Long oneAcitvityId) { | |||
| if (null == recordList || recordList.size() <=0 ) { | |||
| return; | |||
| } | |||
| @@ -162,6 +161,13 @@ public class WxRaffleActivityServiceImpl implements WxRaffleActivityService { | |||
| } | |||
| } | |||
| Map<Long,WxRaffleActivityItem> itemMap = null; | |||
| if (null != oneActivityExeclList && null != oneAcitvityId) { | |||
| List<Long> _aids = new ArrayList<Long>(); | |||
| _aids.add(oneAcitvityId); | |||
| itemMap = getItemMap(tenantEntity,_aids); | |||
| } | |||
| for (WxRaffleActivityRecord _r : recordList) { | |||
| if (null != _r.getActivityId()) { | |||
| WxRaffleActivity _a = activityMap.get(_r.getActivityId()); | |||
| @@ -178,9 +184,15 @@ public class WxRaffleActivityServiceImpl implements WxRaffleActivityService { | |||
| } | |||
| _r.setRecordItemList(getActivityRecordItemListByRecordId(aidList,_r.getId(),_r)); | |||
| _r.setItemDetail(_r.generateItemDetaiJson()); | |||
| if (null != oneActivityExeclList && null != oneAcitvityId) { | |||
| _r.setRecordItemIdList(_r.generateItemIds()); | |||
| oneActivityExeclList.add(_r.generateExcelData(itemMap)); | |||
| } | |||
| } | |||
| } | |||
| private Map<Long,WxRaffleActivityItem> getItemMap(TenantEntity tenantEntity,List<Long> activitIds) { | |||
| WxRaffleActivityItem iq = new WxRaffleActivityItem(); | |||
| iq.updateTenantInfo(tenantEntity); | |||
| @@ -370,6 +382,12 @@ public class WxRaffleActivityServiceImpl implements WxRaffleActivityService { | |||
| 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(List<Map<String, Object>> objectList, String fileName, HttpServletRequest request, | |||
| HttpServletResponse response) { | |||
| excelService.exportExcel(objectList, fileName, response); | |||
| } | |||
| @Override | |||
| public void auditRecord(WxRaffleActivityRecord record) { | |||
| @@ -479,5 +497,4 @@ public class WxRaffleActivityServiceImpl implements WxRaffleActivityService { | |||
| } | |||
| return _riList; | |||
| } | |||
| } | |||