Просмотр исходного кода

fix couponorder export

release_toaliyun_real
winter 4 лет назад
Родитель
Сommit
e3c92b1215
2 измененных файлов: 112 добавлений и 35 удалений
  1. +111
    -32
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java
  2. +1
    -3
      mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml

+ 111
- 32
mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java Просмотреть файл

@@ -342,6 +342,9 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
public ResultData listAdminAsPage(WxCouponOrderBVo wxCouponOrderBVo, Integer pageIndex, Integer pageSize) {
handleWxCouponOrderBVoQueryParam(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);
}

@@ -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
public void exportData(WxCouponOrderBVo wxCouponOrder, HttpServletRequest request, HttpServletResponse response) {
String filename = "券订单";
if(EnumCouponType.COUPON_DISTRIBUTION.getCode().equals(wxCouponOrder.getCouponType())){
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);
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);
}



+ 1
- 3
mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml Просмотреть файл

@@ -841,7 +841,6 @@
<result column="pay_vendor" jdbcType="INTEGER" property="payVendor" />
<result column="verify_type" jdbcType="INTEGER" property="verifyType" />
<result column="verify_remark" jdbcType="VARCHAR" property="verifyRemark" />

<result column="freight_price" jdbcType="INTEGER" property="freightPrice"/>
<result column="shipping_type" jdbcType="INTEGER" property="shippingType"/>
<result column="shipping_address" jdbcType="VARCHAR" property="shippingAddress"/>
@@ -885,8 +884,7 @@
<select id="findListOfAdmin" parameterType="com.iformall.domain.vo.WxCouponOrderBVo" resultMap="AdminBVoResultMap">
select co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.order_id,
co.create_date,co.update_date,co.coupon_price, co.verify_type, co.verify_remark,co.pay_vendor,
co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,
co.coupon_id
co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,co.send_merchant_id
FROM wx_coupon_order co WHERE 1=1
<if test=" null != tenantId and '' != tenantId">
and co.`tenant_id` = #{tenantId}


Загрузка…
Отмена
Сохранить