|
@@ -16,6 +16,8 @@ import com.qs.mp.admin.domain.vo.CdKeyGroupVO;
|
|
|
import com.qs.mp.admin.service.ICdKeyGroupGoodsService;
|
|
|
import com.qs.mp.admin.service.ICdKeyGroupService;
|
|
|
import com.qs.mp.admin.service.ICdKeyService;
|
|
|
+import com.qs.mp.channel.domain.Channel;
|
|
|
+import com.qs.mp.channel.service.IChannelService;
|
|
|
import com.qs.mp.common.core.domain.AjaxResult;
|
|
|
import com.qs.mp.common.core.page.TableDataInfo;
|
|
|
import com.qs.mp.common.enums.CdKeyGroupStatusEnum;
|
|
@@ -27,6 +29,7 @@ import com.qs.mp.web.controller.BaseController;
|
|
|
import io.swagger.annotations.*;
|
|
|
import ma.glasnost.orika.MapperFacade;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -56,6 +59,15 @@ public class CdKeyMgrController extends BaseController {
|
|
|
@Autowired
|
|
|
private MapperFacade mapperFacade;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IChannelService channelService;
|
|
|
+
|
|
|
+ @Value("${cloud.public-bucket-name}")
|
|
|
+ private String publicBucketName;
|
|
|
+
|
|
|
+ @Value("${cloud.region}")
|
|
|
+ private String region;
|
|
|
+
|
|
|
|
|
|
@ApiOperation("兑换码生成")
|
|
|
@PreAuthorize("@ss.hasPermi('business:cdKey:add')")
|
|
@@ -108,6 +120,8 @@ public class CdKeyMgrController extends BaseController {
|
|
|
cdKeyGroupListVOS = cdKeyGroupList.stream().map(cdKeyGroup -> {
|
|
|
CdKeyGroupListVO cdKeyGroupListVO = new CdKeyGroupListVO();
|
|
|
BeanUtils.copyProperties(cdKeyGroup, cdKeyGroupListVO);
|
|
|
+ Channel channel = channelService.getById(cdKeyGroup.getChannelId());
|
|
|
+ cdKeyGroupListVO.setSiteName(channel.getSiteName() + channel.getMobile());
|
|
|
return cdKeyGroupListVO;
|
|
|
}).collect(Collectors.toList());
|
|
|
}
|
|
@@ -156,7 +170,9 @@ public class CdKeyMgrController extends BaseController {
|
|
|
exchangeVOList.forEach(cdKeyExchangeVO -> {
|
|
|
cdKeyExchangeVO.setRemainQty((int) unCashedCount);
|
|
|
cdKeyExchangeVO.setCashedQty((int) cashedCount);
|
|
|
- });
|
|
|
+ List<CdKeyGroupGoods> goodsList = cdKeyGroupGoodsService.list(new QueryWrapper<CdKeyGroupGoods>().eq("ref_id", cdKeyExchangeVO.getRefId()));
|
|
|
+ cdKeyExchangeVO.setGoodsName(goodsList.get(0).getTitle());
|
|
|
+ });
|
|
|
TableDataInfo resp = getDataTable(cdKeyList);
|
|
|
resp.setRows(exchangeVOList);
|
|
|
return resp;
|
|
@@ -166,14 +182,15 @@ public class CdKeyMgrController extends BaseController {
|
|
|
@PreAuthorize("@ss.hasPermi('business:cdKey:export')")
|
|
|
@PostMapping("/export")
|
|
|
public AjaxResult export(@RequestBody CdKeyExportParam param) {
|
|
|
- List<CdKey> cdKeyExportList = cdKeyService.listByIds(param.getGroupIdList());
|
|
|
+ List<CdKey> cdKeyExportList = cdKeyService.list(new QueryWrapper<CdKey>().in("group_id", param.getGroupIdList()));
|
|
|
List<CdKeyOrderExcel> excelList = new ArrayList<>();
|
|
|
cdKeyExportList.forEach(cdKey -> {
|
|
|
CdKeyOrderExcel cdKeyOrderExcel = new CdKeyOrderExcel();
|
|
|
cdKeyOrderExcel.setCdKey(cdKey.getCdKey());
|
|
|
CdKeyGroupGoods groupGoods = cdKeyGroupGoodsService.getOne(new QueryWrapper<CdKeyGroupGoods>().eq("ref_id", cdKey.getRefId()));
|
|
|
cdKeyOrderExcel.setGoodsName(groupGoods.getTitle());
|
|
|
- cdKeyOrderExcel.setPicUrl(cdKey.getPicUrl());
|
|
|
+ String picUrl = "https://" + publicBucketName + ".cos." + region + ".myqcloud.com/" + groupGoods.getPicUrl();
|
|
|
+ cdKeyOrderExcel.setPicUrl(picUrl);
|
|
|
excelList.add(cdKeyOrderExcel);
|
|
|
});
|
|
|
|