|
|
@@ -342,6 +342,9 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { |
|
|
public ResultData listAdminAsPage(WxCouponOrderBVo wxCouponOrderBVo, Integer pageIndex, Integer pageSize) { |
|
|
public ResultData listAdminAsPage(WxCouponOrderBVo wxCouponOrderBVo, Integer pageIndex, Integer pageSize) { |
|
|
handleWxCouponOrderBVoQueryParam(wxCouponOrderBVo); |
|
|
handleWxCouponOrderBVoQueryParam(wxCouponOrderBVo); |
|
|
PageInfo<WxCouponOrderBVo> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findListOfAdmin(wxCouponOrderBVo)); |
|
|
PageInfo<WxCouponOrderBVo> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findListOfAdmin(wxCouponOrderBVo)); |
|
|
|
|
|
if (null != pageInfo && null != pageInfo.getList()){ |
|
|
|
|
|
handleQueryResult(pageInfo.getList(), wxCouponOrderBVo); |
|
|
|
|
|
} |
|
|
return new ResultData(pageInfo); |
|
|
return new ResultData(pageInfo); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@@ -479,48 +482,124 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void handleQueryResult(List<WxCouponOrderBVo> list,TenantEntity tenantEntity) { |
|
|
|
|
|
if (null != list ) { |
|
|
|
|
|
|
|
|
|
|
|
WxMerchant merchantQ = new WxMerchant(); |
|
|
|
|
|
merchantQ.updateTenantInfo(tenantEntity); |
|
|
|
|
|
List<WxMerchant> merchantList = wxMerchantMapper.findIdNameList(merchantQ); |
|
|
|
|
|
Map<Long,String> merchantNameMap = new HashMap<Long,String>(); |
|
|
|
|
|
if (null != merchantList) { |
|
|
|
|
|
merchantList.parallelStream().forEach(m -> { |
|
|
|
|
|
merchantNameMap.put(m.getId(), m.getName()); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
WxCoupon couponQ = new WxCoupon(); |
|
|
|
|
|
couponQ.updateTenantInfo(tenantEntity); |
|
|
|
|
|
List<WxCoupon> couponList = wxCouponMapper.findList(couponQ); |
|
|
|
|
|
Map<Long,WxCoupon> couponMap = new HashMap<Long,WxCoupon>(); |
|
|
|
|
|
if (null != couponList) { |
|
|
|
|
|
couponList.parallelStream().forEach(c -> { |
|
|
|
|
|
couponMap.put(c.getId(), c); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<WxMerchantProductVo> merchantProductVos = wxCouponMerchantMapper.findMerchantProduct(tenantEntity.getTenantId(), null); |
|
|
|
|
|
Map<Long,Long> merchantProductIdMap = new HashMap<Long,Long>(); |
|
|
|
|
|
if (null != merchantProductVos) { |
|
|
|
|
|
merchantProductVos.parallelStream().forEach(mp -> { |
|
|
|
|
|
if (mp.getMc() > 1) { |
|
|
|
|
|
merchantProductIdMap.put(mp.getProductId(), -999L); |
|
|
|
|
|
}else { |
|
|
|
|
|
merchantProductIdMap.put(mp.getProductId(), mp.getMerchantId()); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
list.parallelStream().forEach(co -> { |
|
|
|
|
|
if (co.getCouponOrderStatus().equals(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode())) { |
|
|
|
|
|
co.setUpdateDate(null); |
|
|
|
|
|
} |
|
|
|
|
|
if (null != co.getSendMerchantId()) { |
|
|
|
|
|
co.setSendMerchantName(merchantNameMap.get(co.getSendMerchantId())); |
|
|
|
|
|
} |
|
|
|
|
|
WxCoupon coupon = couponMap.get(co.getCouponId()); |
|
|
|
|
|
if (null != coupon) { |
|
|
|
|
|
co.setTitle(coupon.getTitle()); |
|
|
|
|
|
co.setSalePrice(coupon.getSalePrice()); |
|
|
|
|
|
co.setUsePrice(coupon.getUsePrice()); |
|
|
|
|
|
co.setPrice(coupon.getPrice()); |
|
|
|
|
|
co.setAutoRefund(coupon.getAutoRefund()); |
|
|
|
|
|
co.setBusiness(coupon.getBusiness()); |
|
|
|
|
|
co.setSubsidyType(coupon.getSubsidyType()); |
|
|
|
|
|
co.setSourceType(coupon.getSourceType()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
WxMerchantSubsidy merchantSubsidyQ = new WxMerchantSubsidy(); |
|
|
|
|
|
merchantSubsidyQ.setCouponOrderId(co.getId()); |
|
|
|
|
|
merchantSubsidyQ.setCouponType(co.getCouponType()); |
|
|
|
|
|
merchantSubsidyQ.setType(EnumMerchantSubsidyType.MANUAL.getCode()); |
|
|
|
|
|
merchantSubsidyQ.updateTenantInfo(co); |
|
|
|
|
|
List<WxMerchantSubsidy> msList = wxMerchantSubsidyMapper.selectList(new QueryWrapper<WxMerchantSubsidy>(merchantSubsidyQ)); |
|
|
|
|
|
if (msList.size() > 0) { |
|
|
|
|
|
co.setSubsidyNum(msList.get(0).getSubsidy()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Long merchanId = merchantProductIdMap.get(co.getCouponId()); |
|
|
|
|
|
if (merchanId == 999L) { |
|
|
|
|
|
co.setMerchantName("多商户通用"); |
|
|
|
|
|
co.setMerchantId(0L); |
|
|
|
|
|
}else { |
|
|
|
|
|
co.setMerchantName(merchantNameMap.get(merchanId)); |
|
|
|
|
|
co.setMerchantId(merchanId); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.getById(co.getCUserId(), co.getFinalTenantId()); |
|
|
|
|
|
if (null != basicInfo) { |
|
|
|
|
|
co.setcuserPhone(basicInfo.getPhone()); |
|
|
|
|
|
co.setUserNickName(basicInfo.getNickName()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
WxMerchantBUser buser = wxMerchantBUserService.getById(co.getBUserId()); |
|
|
|
|
|
if (null != buser) { |
|
|
|
|
|
co.setVerifyMerchantName(merchantNameMap.get(buser.getMerchantId())); |
|
|
|
|
|
} |
|
|
|
|
|
//co.setChannelType();) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if (!c.getMerchantId().equals(0L)) { |
|
|
|
|
|
// List<WxMerchantVo> merchantVoList = c.getMerchantVoList(); |
|
|
|
|
|
// if (!CollectionUtils.isEmpty(merchantVoList)) { |
|
|
|
|
|
// StringBuilder shopNumber = new StringBuilder(); |
|
|
|
|
|
// StringBuilder building = new StringBuilder(); |
|
|
|
|
|
// WxMerchantVo wxMerchantVo = merchantVoList.get(0); |
|
|
|
|
|
// List<WxShopVo> shopVoList = wxMerchantVo.getShopVoList(); |
|
|
|
|
|
// for (WxShopVo wxShopVo : shopVoList) { |
|
|
|
|
|
// shopNumber.append(wxShopVo.getShopNumber()).append(";"); |
|
|
|
|
|
// building.append(wxShopVo.getBuildingName()).append(wxShopVo.getFloorName()).append(";"); |
|
|
|
|
|
// } |
|
|
|
|
|
// c.setShopNumber(shopNumber.toString()); |
|
|
|
|
|
// c.setBuildingStr(building.toString()); |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void exportData(WxCouponOrderBVo wxCouponOrder, HttpServletRequest request, HttpServletResponse response) { |
|
|
public void exportData(WxCouponOrderBVo wxCouponOrder, HttpServletRequest request, HttpServletResponse response) { |
|
|
String filename = "券订单"; |
|
|
String filename = "券订单"; |
|
|
if(EnumCouponType.COUPON_DISTRIBUTION.getCode().equals(wxCouponOrder.getCouponType())){ |
|
|
if(EnumCouponType.COUPON_DISTRIBUTION.getCode().equals(wxCouponOrder.getCouponType())){ |
|
|
filename = "商品订单"; |
|
|
filename = "商品订单"; |
|
|
} |
|
|
} |
|
|
WxMerchant merchantQ = new WxMerchant(); |
|
|
|
|
|
merchantQ.updateTenantInfo(wxCouponOrder); |
|
|
|
|
|
List<WxMerchant> merchantList = wxMerchantMapper.findIdNameList(merchantQ); |
|
|
|
|
|
Map<Long,String> merchantNameMap = new HashMap<Long,String>(); |
|
|
|
|
|
if (null != merchantList) { |
|
|
|
|
|
merchantList.parallelStream().forEach(m -> { |
|
|
|
|
|
merchantNameMap.put(m.getId(), m.getName()); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
handleWxCouponOrderBVoQueryParam(wxCouponOrder); |
|
|
handleWxCouponOrderBVoQueryParam(wxCouponOrder); |
|
|
|
|
|
|
|
|
List<WxCouponOrderBVo> list = wxCouponOrderMapper.findListOfAdmin(wxCouponOrder); |
|
|
List<WxCouponOrderBVo> list = wxCouponOrderMapper.findListOfAdmin(wxCouponOrder); |
|
|
list.parallelStream().forEach(c -> { |
|
|
|
|
|
if (c.getCouponOrderStatus().equals(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode())) { |
|
|
|
|
|
c.setUpdateDate(null); |
|
|
|
|
|
} |
|
|
|
|
|
if (null != c.getSendMerchantId()) { |
|
|
|
|
|
c.setSendMerchantName(merchantNameMap.get(c.getSendMerchantId())); |
|
|
|
|
|
} |
|
|
|
|
|
// if (!c.getMerchantId().equals(0L)) { |
|
|
|
|
|
// List<WxMerchantVo> merchantVoList = c.getMerchantVoList(); |
|
|
|
|
|
// if (!CollectionUtils.isEmpty(merchantVoList)) { |
|
|
|
|
|
// StringBuilder shopNumber = new StringBuilder(); |
|
|
|
|
|
// StringBuilder building = new StringBuilder(); |
|
|
|
|
|
// WxMerchantVo wxMerchantVo = merchantVoList.get(0); |
|
|
|
|
|
// List<WxShopVo> shopVoList = wxMerchantVo.getShopVoList(); |
|
|
|
|
|
// for (WxShopVo wxShopVo : shopVoList) { |
|
|
|
|
|
// shopNumber.append(wxShopVo.getShopNumber()).append(";"); |
|
|
|
|
|
// building.append(wxShopVo.getBuildingName()).append(wxShopVo.getFloorName()).append(";"); |
|
|
|
|
|
// } |
|
|
|
|
|
// c.setShopNumber(shopNumber.toString()); |
|
|
|
|
|
// c.setBuildingStr(building.toString()); |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
handleQueryResult(list,wxCouponOrder); |
|
|
excelService.exportCsv(list, null, filename, WxCouponOrderBVo.class, filename + ".csv", response, false); |
|
|
excelService.exportCsv(list, null, filename, WxCouponOrderBVo.class, filename + ".csv", response, false); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|