Commit 6ae54181 authored by zhangfeng's avatar zhangfeng

礼品兑换网点属性改为提货点(仓库)

parent 3778bd30
......@@ -42,5 +42,5 @@ public interface WarehouseConvert {
List<WarehouseTreeRegionVO> convertTreeRegion(List<WarehouseTreeRegionVO> list);
List<WarehouseSimpleRespVO> convertListSimple(List<WarehouseDO> list);
}
......@@ -172,4 +172,6 @@ public interface WarehouseService {
List<WarehouseTreeRegionVO> getWarehouseTreeRegionList(Integer tradeType);
List<WarehouseTreeRegionVO> getRegionList(Integer type, String regionId, String destCountryId, String objectiveId, String destWarehouseId);
List<WarehouseDO> getWarehouseListSimple(String title);
}
......@@ -536,4 +536,16 @@ public class WarehouseServiceImpl implements WarehouseService {
warehouseMapper.getRegionList(type, regionId, destCountryId, objectiveId, destWarehouseId);
return list;
}
@Override
public List<WarehouseDO> getWarehouseListSimple(String title) {
if (StringUtils.isBlank(title)) {
return warehouseMapper.selectList();
}
// 模糊搜索中文名和英文名
return warehouseMapper.selectList(new LambdaQueryWrapperX<WarehouseDO>()
.like(WarehouseDO::getTitleZh, title)
.or()
.like(WarehouseDO::getTitleEn, title));
}
}
package cn.iocoder.yudao.module.depository.vo.warehouse;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
@ApiModel("仓库精简信息 Req VO")
@Data
public class WarehouseSimpleReqVO {
@ApiModelProperty(value = "模糊搜标题")
private String title;
}
package cn.iocoder.yudao.module.depository.vo.warehouse;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel("仓库精简信息 Response VO")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class WarehouseSimpleRespVO {
@ApiModelProperty(value = "", required = true)
private Long id;
@ApiModelProperty(value = "中文标题")
private String titleZh;
@ApiModelProperty(value = "英文标题")
private String titleEn;
}
......@@ -2,40 +2,39 @@ package cn.iocoder.yudao.module.depository.controller.admin.warehouse;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.apollo.core.event.QueryChannelInfoEvent;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.module.depository.dal.mysql.warehouse.WarehouseLineMapper;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.depository.convert.warehouse.DeptWarehouseConvert;
import cn.iocoder.yudao.module.depository.convert.warehouse.WarehouseConvert;
import cn.iocoder.yudao.module.depository.dal.dataobject.warehouse.DeptWarehouseDO;
import cn.iocoder.yudao.module.depository.dal.dataobject.warehouse.WarehouseDO;
import cn.iocoder.yudao.module.depository.dal.dataobject.warehouse.WarehouseLineDO;
import cn.iocoder.yudao.module.depository.service.warehouse.WarehouseService;
import cn.iocoder.yudao.module.depository.vo.dept.DeptWarehouseBaseVO;
import cn.iocoder.yudao.module.depository.vo.dept.DeptWarehouseRequestVo;
import cn.iocoder.yudao.module.depository.vo.warehouse.*;
import cn.iocoder.yudao.module.depository.convert.warehouse.DeptWarehouseConvert;
import cn.iocoder.yudao.module.ecw.dal.dataobject.region.RegionDO;
import cn.iocoder.yudao.module.depository.dal.dataobject.warehouse.DeptWarehouseDO;
import cn.iocoder.yudao.module.depository.dal.dataobject.warehouse.WarehouseLineDO;
import cn.iocoder.yudao.module.ecw.service.region.RegionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.*;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.depository.dal.dataobject.warehouse.WarehouseDO;
import cn.iocoder.yudao.module.depository.convert.warehouse.WarehouseConvert;
import cn.iocoder.yudao.module.depository.service.warehouse.WarehouseService;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Api(tags = "管理后台 - 仓库")
@RestController
......@@ -317,6 +316,13 @@ public class WarehouseController {
}
return success(resultList);
}
@PostMapping("/list-all-simple")
@ApiOperation(value = "获得仓库精简信息列表", notes = "主要用于前端的下拉选项")
public CommonResult<List<WarehouseSimpleRespVO>> getWarehouseListSimple(@RequestBody WarehouseSimpleReqVO reqVO) {
List<WarehouseDO> list = warehouseService.getWarehouseListSimple(reqVO.getTitle());
return success(WarehouseConvert.INSTANCE.convertListSimple(list));
}
private static <T> List<T> pagination(List<T> records, int pageNum, int pageSize) {
if (CollectionUtil.isEmpty(records)) {
......
......@@ -44,7 +44,13 @@
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-ecw-api</artifactId>
<artifactId>yudao-module-ecw-impl</artifactId>
<version>${revision}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-depository-core</artifactId>
<version>${revision}</version>
<scope>compile</scope>
</dependency>
......
......@@ -22,6 +22,7 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
......@@ -75,7 +76,6 @@ public class RewardController {
@GetMapping("/list")
@ApiOperation("获得礼品列表")
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
//@PreAuthorize("@ss.hasPermission('reward::query')")
public CommonResult<List<RewardBackVO>> getList(@RequestParam("ids") Collection<Long> ids) {
List<RewardDO> list = rewardService.getList(ids);
List<RewardBackVO> rewardBackVOS = RewardConvert.INSTANCE.convertList(list);
......@@ -84,12 +84,15 @@ public class RewardController {
@PostMapping("/page")
@ApiOperation("获得礼品分页")
//@PreAuthorize("@ss.hasPermission('reward::query')")
public CommonResult<PageResult<RewardBackVO>> getPage(@Valid @RequestBody RewardQueryVO query, PageVO page) {
PageResult<RewardDO> pageResult = rewardService.getPage(query, page);
PageResult<RewardBackVO> rewardBackVOPageResult = RewardConvert.INSTANCE.convertPage(pageResult);
// 转换nodeId和points
rewardBackVOPageResult.getList().forEach(rewardBackVO -> rewardBackVO.getNodeIds().add(new RewardBackVO.NodeAndPoints(rewardBackVO.getNodeId(), rewardBackVO.getPointsRequire())));
rewardBackVOPageResult.getList().forEach(rewardBackVO -> {
List<Integer> nodeId = new ArrayList<>();
nodeId.add(rewardBackVO.getNodeId());
rewardBackVO.getNodeIds().add(new RewardBackVO.NodeAndPoints(nodeId, rewardBackVO.getPointsRequire(), rewardBackVO.getQuantityRemain()));
});
return success(rewardBackVOPageResult);
}
......@@ -119,7 +122,7 @@ public class RewardController {
@GetMapping("/export-excel")
@ApiOperation("导出礼品 Excel")
//@PreAuthorize("@ss.hasPermission('reward::export')")
@PreAuthorize("@ss.hasPermission('reward::export')")
@OperateLog(type = EXPORT)
public void exportExcel(@Valid RewardQueryVO query,
HttpServletResponse response) throws IOException {
......
......@@ -9,7 +9,6 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -60,11 +59,11 @@ public class RewardBackVO {
@ApiModelProperty(value = "兑换所需积分", required = true)
private Integer pointsRequire;
@ExcelProperty("兑换网点")
@ApiModelProperty(value = "兑换网点", required = true)
@ExcelProperty("提货点")
@ApiModelProperty(value = "提货点", required = true)
private Integer nodeId;
@ApiModelProperty(value = "兑换网点和积分列表", required = true)
@ApiModelProperty(value = "提货点,积分,剩余数量列表", required = true)
private List<RewardBackVO.NodeAndPoints> nodeIds = new ArrayList<>();
@ExcelProperty("已兑换次数")
......@@ -122,9 +121,11 @@ public class RewardBackVO {
@AllArgsConstructor
@NoArgsConstructor
public static class NodeAndPoints {
@ApiModelProperty(value = "兑换网点")
private Integer nodeId;
@ApiModelProperty(value = "兑换网点对应积分")
@ApiModelProperty(value = "提货点")
private List<Integer> wareHouses;
@ApiModelProperty(value = "提货点对应积分")
private Integer points;
@ApiModelProperty(value = "剩余数量")
private Integer quantityRemain;
}
}
......@@ -49,14 +49,14 @@ public class RewardCreateReqVO {
//@NotNull(message = "兑换网点不能为空")
//private Integer nodeId;
@ApiModelProperty(value = "兑换网点和积分列表", required = true)
@ApiModelProperty(value = "提货点,积分,剩余数量列表", required = true)
@NotNull(message = "兑换网点列表不能为空")
private List<NodeAndPoints> nodeIds;
@ApiModelProperty(value = "剩余数量", required = true)
@NotNull(message = "剩余数量不能为空")
@Min(value = 0)
private Integer quantityRemain;
//@ApiModelProperty(value = "剩余数量", required = true)
//@NotNull(message = "剩余数量不能为空")
//@Min(value = 0)
//private Integer quantityRemain;
@ApiModelProperty(value = "活动开始时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
......@@ -93,9 +93,11 @@ public class RewardCreateReqVO {
@Data
public static class NodeAndPoints {
@ApiModelProperty(value = "兑换网点")
private Integer nodeId;
@ApiModelProperty(value = "兑换网点对应积分")
@ApiModelProperty(value = "提货点")
private List<Integer> wareHouses;
@ApiModelProperty(value = "提货点对应积分")
private Integer points;
@ApiModelProperty(value = "剩余数量")
private Integer quantityRemain;
}
}
......@@ -1028,7 +1028,7 @@ reward.score.not.enough = \u79EF\u5206\u4E0D\u8DB3
reward.count.not.enough = \u793C\u54C1\u6570\u91CF\u4E0D\u8DB3
reward.redeem.count.not.allow = \u6279\u91CF\u5151\u6362\u6BCF\u6B21\u6700\u591A\u5341\u6761
reward.redeem.allow.count.error = \u5DF2\u8D85\u51FA\u4E2A\u4EBA\u5141\u8BB8\u5151\u6362\u6B21\u6570
reward.node.and.points.list.error = \u521B\u5EFA\u793C\u54C1\u7F51\u70B9\u6216\u6240\u9700\u79EF\u5206\u9519\u8BEF
reward.node.and.points.list.error = \u521B\u5EFA\u793C\u54C1\u63D0\u8D27\u70B9\u6216\u6240\u9700\u79EF\u5206\u9519\u8BEF
reward.redeem.recipient.error = \u793C\u54C1\u6536\u8D27\u4EBA\u4FE1\u606F\u4E0D\u5168
redeem.import.no.record = \u8868\u683C\u4E2D\u65E0\u8BB0\u5F55
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment