|
|
@@ -383,6 +383,66 @@ public class CmsOrderController {
|
|
|
.doWrite(collect);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 导出实物模板 订单excel
|
|
|
+ */
|
|
|
+ @GetMapping("/export/mOrder/realGoods")
|
|
|
+ public void exportMorderRealGoods(HttpServletResponse response, Long channelId, String account, String showId, Boolean isNoBind, Integer dsType, @RequestParam(value = "orderStatus", required = false) List<String> orderStatus) throws Exception {
|
|
|
+ StringBuilder conditionSb = new StringBuilder();
|
|
|
+ if (isNoBind != null) {
|
|
|
+ String f = isNoBind ? "=" : "!=";
|
|
|
+ conditionSb.append(String.format(" and os.ex_code != '' and os.user_id %s 0", f));
|
|
|
+ }
|
|
|
+ if (dsType != null) {
|
|
|
+ //默认优惠券
|
|
|
+ String dsTypeField = "coupon_user_id";
|
|
|
+ if (dsType == 2) {
|
|
|
+ dsTypeField = "balance";
|
|
|
+ } else if (dsType == 3) {
|
|
|
+ dsTypeField = "galaxycoin";
|
|
|
+ }
|
|
|
+ conditionSb.append(String.format(" and os.%s != 0", dsTypeField));
|
|
|
+ }
|
|
|
+ if (orderStatus != null) {
|
|
|
+ conditionSb.append(String.format(" and os.status in %s", Jsons.toJson(orderStatus).replaceAll("\\[", "(").replaceAll("]", ")")));
|
|
|
+ }
|
|
|
+ String conditionSql = null;
|
|
|
+
|
|
|
+ //主订单
|
|
|
+ MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
|
|
|
+ if (channelId != null) {
|
|
|
+ List<Long> popularizeIds = channelPopularizeMapper.getPopularizeIdByChannelId(channelId);
|
|
|
+ builder.field(ExcelRealGoodsMOrderData::getPopularizeId, popularizeIds).op(Operator.InList);
|
|
|
+ }
|
|
|
+ if (StrUtil.isNotBlank(account)) {
|
|
|
+ GroupsRelation relation = relationMapper.selectOne(Wrappers.lambdaQuery(GroupsRelation.class)
|
|
|
+ .eq(GroupsRelation::getAccount, account).last("limit 1"));
|
|
|
+ if (relation != null) {
|
|
|
+ builder.field(ExcelRealGoodsMOrderData::getUserId, relation.getUserId());
|
|
|
+ } else {
|
|
|
+ builder.field(ExcelRealGoodsMOrderData::getUserId).op(Operator.IsNull);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StrUtil.isNotBlank(showId)) {
|
|
|
+ builder.field(ExcelRealGoodsMOrderData::getUserId, userService.getUserIdByShowId(showId));
|
|
|
+ }
|
|
|
+ if (StrUtil.isNotBlank(conditionSql)) {
|
|
|
+ builder.put("condition", conditionSql);
|
|
|
+ }
|
|
|
+ List<ExcelRealGoodsMOrderData> list = beanSearcher.searchAll(ExcelRealGoodsMOrderData.class, builder
|
|
|
+ .field(ExcelRealGoodsMOrderData::getGoodsDonType, Constant.realGoodsType).op(Operator.InList)
|
|
|
+ .build());
|
|
|
+ list.forEach(data -> {
|
|
|
+ data.setPayType("寄付现结");
|
|
|
+ if (data.getGoodsDonType() == Constant.realGoodsType.get(0)) {
|
|
|
+ data.setRealGoodName("路由器");
|
|
|
+ } else if (data.getGoodsDonType() == Constant.realGoodsType.get(1)) {
|
|
|
+ data.setRealGoodName("银河潮玩");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ EasyExcelUtils.createExcelStreamMutilByEasyExcel(response, ExcelRealGoodsOrderData.class, list, "实物订单列表", "实物订单列表", ExcelTypeEnum.XLSX, null);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 导出实物模板 订单excel
|
|
|
*/
|