|
@@ -19,6 +19,8 @@ import com.qs.mp.common.core.domain.AjaxResult;
|
|
|
import com.qs.mp.common.core.page.TableDataInfo;
|
|
|
import com.qs.mp.common.enums.CdKeyGroupStatusEnum;
|
|
|
import com.qs.mp.common.enums.CdKeyStatusEnum;
|
|
|
+import com.qs.mp.common.enums.ValidityPeriodEnum;
|
|
|
+import com.qs.mp.common.utils.DateUtils;
|
|
|
import com.qs.mp.common.utils.StringUtils;
|
|
|
import com.qs.mp.common.utils.bean.BeanUtils;
|
|
|
import com.qs.mp.utils.ExcelUtil;
|
|
@@ -30,10 +32,8 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Objects;
|
|
|
+import java.util.*;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -138,7 +138,7 @@ public class CdKeyMgrController extends BaseController {
|
|
|
if (!CdKeyGroupStatusEnum.NONACTIVATED.getValue().equals(cdKeyGroup.getStatus().getValue())) {
|
|
|
return AjaxResult.error("只有未激活的兑换码组才能激活");
|
|
|
}
|
|
|
- cdKeyGroup.setStatus(CdKeyGroupStatusEnum.ACTIVATED);
|
|
|
+ cdKeyGroup.setStatus(param.getIsActive() == 1 ? CdKeyGroupStatusEnum.ACTIVATED : CdKeyGroupStatusEnum.NONACTIVATED);
|
|
|
cdKeyGroup.setActivationTime(new Date());
|
|
|
return AjaxResult.success(cdKeyGroupService.updateById(cdKeyGroup));
|
|
|
}
|
|
@@ -150,16 +150,18 @@ public class CdKeyMgrController extends BaseController {
|
|
|
@ApiResponse(code = 200, message = "查询成功", response = CdKeyExchangeVO.class)
|
|
|
)
|
|
|
public TableDataInfo exchangeDetail(@PathVariable String groupId) {
|
|
|
- CdKeyExchangeVO exchangeVO = new CdKeyExchangeVO();
|
|
|
startPage();
|
|
|
List<CdKey> cdKeyList = cdKeyService.list(new QueryWrapper<CdKey>().eq("group_id", groupId));
|
|
|
long unCashedCount = cdKeyList.stream().filter(cdKey -> CdKeyStatusEnum.UNCASHED.getValue().equals(cdKey.getStatus())).count();
|
|
|
long cashedCount = cdKeyList.stream().filter(cdKey -> CdKeyStatusEnum.CASHED.getValue().equals(cdKey.getStatus())).count();
|
|
|
- exchangeVO.setRemainQty((int) unCashedCount);
|
|
|
- exchangeVO.setCashedQty((int) cashedCount);
|
|
|
- List<CdKey> list = (List<CdKey>) getDataTable(cdKeyList).getRows();
|
|
|
- exchangeVO.setCdKeyExchangeList(list);
|
|
|
- return null;
|
|
|
+ List<CdKeyExchangeVO> exchangeVOList = mapperFacade.mapAsList(cdKeyList, CdKeyExchangeVO.class);
|
|
|
+ exchangeVOList.forEach(cdKeyExchangeVO -> {
|
|
|
+ cdKeyExchangeVO.setRemainQty((int) unCashedCount);
|
|
|
+ cdKeyExchangeVO.setCashedQty((int) cashedCount);
|
|
|
+ });
|
|
|
+ TableDataInfo resp = getDataTable(cdKeyList);
|
|
|
+ resp.setRows(exchangeVOList);
|
|
|
+ return resp;
|
|
|
}
|
|
|
|
|
|
@ApiOperation("导出兑换码订单")
|