Commit ffa5db4d authored by zhangfeng's avatar zhangfeng

Merge branch 'release-zhangfeng' into 'release'

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

See merge request !17
parents 1f93d161 920f3bee
...@@ -42,5 +42,5 @@ public interface WarehouseConvert { ...@@ -42,5 +42,5 @@ public interface WarehouseConvert {
List<WarehouseTreeRegionVO> convertTreeRegion(List<WarehouseTreeRegionVO> list); List<WarehouseTreeRegionVO> convertTreeRegion(List<WarehouseTreeRegionVO> list);
List<WarehouseSimpleRespVO> convertListSimple(List<WarehouseDO> list);
} }
...@@ -176,5 +176,7 @@ public interface WarehouseService { ...@@ -176,5 +176,7 @@ public interface WarehouseService {
List<WarehouseTreeVO> getWarehouseTreeList(Integer tradeType); List<WarehouseTreeVO> getWarehouseTreeList(Integer tradeType);
List<WarehouseDO> getWarehouseListSimple(String title);
WarehouseListVO getGuojiaAndShiAndWarehouseList(Integer tradeType); WarehouseListVO getGuojiaAndShiAndWarehouseList(Integer tradeType);
} }
...@@ -622,4 +622,16 @@ public class WarehouseServiceImpl implements WarehouseService { ...@@ -622,4 +622,16 @@ public class WarehouseServiceImpl implements WarehouseService {
warehouseMapper.getRegionList(type, regionId, destCountryId, objectiveId, destWarehouseId); warehouseMapper.getRegionList(type, regionId, destCountryId, objectiveId, destWarehouseId);
return list; 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; ...@@ -2,40 +2,39 @@ package cn.iocoder.yudao.module.depository.controller.admin.warehouse;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.apollo.core.event.QueryChannelInfoEvent; 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.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.DeptWarehouseBaseVO;
import cn.iocoder.yudao.module.depository.vo.dept.DeptWarehouseRequestVo; import cn.iocoder.yudao.module.depository.vo.dept.DeptWarehouseRequestVo;
import cn.iocoder.yudao.module.depository.vo.warehouse.*; 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.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 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.beans.BeanUtils;
import org.springframework.context.ApplicationContext; 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 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.annotation.Resource;
import javax.servlet.http.*; import javax.servlet.http.HttpServletResponse;
import java.util.*; import javax.validation.Valid;
import java.io.IOException; import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors; 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 static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
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;
@Api(tags = "管理后台 - 仓库") @Api(tags = "管理后台 - 仓库")
@RestController @RestController
...@@ -334,6 +333,13 @@ public class WarehouseController { ...@@ -334,6 +333,13 @@ public class WarehouseController {
} }
return success(resultList); 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) { private static <T> List<T> pagination(List<T> records, int pageNum, int pageSize) {
if (CollectionUtil.isEmpty(records)) { if (CollectionUtil.isEmpty(records)) {
......
...@@ -44,7 +44,13 @@ ...@@ -44,7 +44,13 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.iocoder.boot</groupId> <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> <version>${revision}</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
......
...@@ -22,6 +22,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -22,6 +22,7 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
...@@ -75,7 +76,6 @@ public class RewardController { ...@@ -75,7 +76,6 @@ public class RewardController {
@GetMapping("/list") @GetMapping("/list")
@ApiOperation("获得礼品列表") @ApiOperation("获得礼品列表")
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) @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) { public CommonResult<List<RewardBackVO>> getList(@RequestParam("ids") Collection<Long> ids) {
List<RewardDO> list = rewardService.getList(ids); List<RewardDO> list = rewardService.getList(ids);
List<RewardBackVO> rewardBackVOS = RewardConvert.INSTANCE.convertList(list); List<RewardBackVO> rewardBackVOS = RewardConvert.INSTANCE.convertList(list);
...@@ -84,12 +84,15 @@ public class RewardController { ...@@ -84,12 +84,15 @@ public class RewardController {
@PostMapping("/page") @PostMapping("/page")
@ApiOperation("获得礼品分页") @ApiOperation("获得礼品分页")
//@PreAuthorize("@ss.hasPermission('reward::query')")
public CommonResult<PageResult<RewardBackVO>> getPage(@Valid @RequestBody RewardQueryVO query, PageVO page) { public CommonResult<PageResult<RewardBackVO>> getPage(@Valid @RequestBody RewardQueryVO query, PageVO page) {
PageResult<RewardDO> pageResult = rewardService.getPage(query, page); PageResult<RewardDO> pageResult = rewardService.getPage(query, page);
PageResult<RewardBackVO> rewardBackVOPageResult = RewardConvert.INSTANCE.convertPage(pageResult); PageResult<RewardBackVO> rewardBackVOPageResult = RewardConvert.INSTANCE.convertPage(pageResult);
// 转换nodeId和points // 转换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); return success(rewardBackVOPageResult);
} }
...@@ -119,7 +122,7 @@ public class RewardController { ...@@ -119,7 +122,7 @@ public class RewardController {
@GetMapping("/export-excel") @GetMapping("/export-excel")
@ApiOperation("导出礼品 Excel") @ApiOperation("导出礼品 Excel")
//@PreAuthorize("@ss.hasPermission('reward::export')") @PreAuthorize("@ss.hasPermission('reward::export')")
@OperateLog(type = EXPORT) @OperateLog(type = EXPORT)
public void exportExcel(@Valid RewardQueryVO query, public void exportExcel(@Valid RewardQueryVO query,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
......
...@@ -5,10 +5,13 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; ...@@ -5,10 +5,13 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO; import cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO;
import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils; import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService; import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO; import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.ecw.api.node.NodeApi; import cn.iocoder.yudao.module.depository.dal.dataobject.warehouse.WarehouseDO;
import cn.iocoder.yudao.module.ecw.api.node.dto.NodeRespDTO; import cn.iocoder.yudao.module.depository.dal.mysql.warehouse.WarehouseMapper;
import cn.iocoder.yudao.module.ecw.dal.dataobject.region.RegionDO;
import cn.iocoder.yudao.module.ecw.service.region.RegionService;
import cn.iocoder.yudao.module.member.api.user.MemberUserApi; import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
import cn.iocoder.yudao.module.member.api.user.dto.UserRespDTO; import cn.iocoder.yudao.module.member.api.user.dto.UserRespDTO;
import cn.iocoder.yudao.module.reward.controller.app.reward.vo.AppRewardBackVO; import cn.iocoder.yudao.module.reward.controller.app.reward.vo.AppRewardBackVO;
...@@ -20,13 +23,14 @@ import cn.iocoder.yudao.module.reward.dal.mysql.reward.RewardMapper; ...@@ -20,13 +23,14 @@ import cn.iocoder.yudao.module.reward.dal.mysql.reward.RewardMapper;
import cn.iocoder.yudao.module.reward.enums.QuantitativeRelationSymbolEnum; import cn.iocoder.yudao.module.reward.enums.QuantitativeRelationSymbolEnum;
import cn.iocoder.yudao.module.reward.enums.RewardPickMethedEnum; import cn.iocoder.yudao.module.reward.enums.RewardPickMethedEnum;
import cn.iocoder.yudao.module.reward.enums.RewardStatusEnum; import cn.iocoder.yudao.module.reward.enums.RewardStatusEnum;
import cn.iocoder.yudao.module.reward.util.RewardGenCodeUtils;
import cn.iocoder.yudao.module.reward.vo.reward.*; import cn.iocoder.yudao.module.reward.vo.reward.*;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.module.reward.util.RewardGenCodeUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.Instant; import java.time.Instant;
...@@ -48,31 +52,42 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i ...@@ -48,31 +52,42 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
@Resource @Resource
private RewardMapper rewardMapper; private RewardMapper rewardMapper;
@Resource @Resource
private NodeApi nodeApi; private WarehouseMapper warehouseMapper;
@Resource
private RegionService regionService;
@Resource @Resource
private MemberUserApi memberUserApi; private MemberUserApi memberUserApi;
@Resource @Resource
private RewardGenCodeUtils rewardGenCodeUtils; private RewardGenCodeUtils rewardGenCodeUtils;
@Override @Override
@Transactional(rollbackFor = Exception.class)
public List<Long> create(RewardCreateReqVO createReqVO) { public List<Long> create(RewardCreateReqVO createReqVO) {
verifyCreateVO(createReqVO); verifyCreateVO(createReqVO);
// 插入 // 插入
RewardDO rewardDO = RewardConvert.INSTANCE.convert(createReqVO); RewardDO rewardDO = RewardConvert.INSTANCE.convert(createReqVO);
ArrayList<Long> ids = new ArrayList<>();
for (RewardCreateReqVO.NodeAndPoints wareHouses : createReqVO.getNodeIds()) {
rewardDO.setPointsRequire(wareHouses.getPoints());
// 剩余数量若没传给默认值0 // 剩余数量若没传给默认值0
if (rewardDO.getQuantityRemain() == null) { if (wareHouses.getQuantityRemain() == null) {
rewardDO.setQuantityRemain(0);
} else if (wareHouses.getQuantityRemain() > 0) {
rewardDO.setQuantityRemain(wareHouses.getQuantityRemain());
} else {
rewardDO.setQuantityRemain(0); rewardDO.setQuantityRemain(0);
} }
ArrayList<Long> ids = new ArrayList<>(); for (Integer wareHouse : wareHouses.getWareHouses()) {
for (RewardCreateReqVO.NodeAndPoints nodeId : createReqVO.getNodeIds()) { if (wareHouse == null || wareHouse < 0) {
rewardDO.setNodeId(nodeId.getNodeId()); throw exception(REWARD_NODE_AND_POINTS_LIST_ERROR);
rewardDO.setPointsRequire(nodeId.getPoints()); }
rewardDO.setNodeId(wareHouse);
rewardDO.setCode(rewardGenCodeUtils.generateRewardCode()); rewardDO.setCode(rewardGenCodeUtils.generateRewardCode());
rewardMapper.insert(rewardDO); rewardMapper.insert(rewardDO);
ids.add(rewardDO.getId()); ids.add(rewardDO.getId());
rewardDO.setId(null); rewardDO.setId(null);
} }
}
// 返回 // 返回
return ids; return ids;
} }
...@@ -102,10 +117,10 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i ...@@ -102,10 +117,10 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
throw exception(REWARD_NODE_AND_POINTS_LIST_ERROR); throw exception(REWARD_NODE_AND_POINTS_LIST_ERROR);
} else { } else {
for (RewardCreateReqVO.NodeAndPoints nodeId : nodeIds) { for (RewardCreateReqVO.NodeAndPoints nodeId : nodeIds) {
if (nodeId.getPoints() == null || nodeId.getNodeId() == null) { if (nodeId.getPoints() == null || nodeId.getWareHouses() == null) {
throw exception(REWARD_NODE_AND_POINTS_LIST_ERROR); throw exception(REWARD_NODE_AND_POINTS_LIST_ERROR);
} }
if (nodeId.getPoints() <= 0 || nodeId.getNodeId() <= 0) { if (nodeId.getPoints() <= 0) {
throw exception(REWARD_NODE_AND_POINTS_LIST_ERROR); throw exception(REWARD_NODE_AND_POINTS_LIST_ERROR);
} }
} }
...@@ -218,7 +233,7 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i ...@@ -218,7 +233,7 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
.eq(query.getPointsRequireSymbol() == QuantitativeRelationSymbolEnum.EQ.getValue(), RewardDO::getPointsRequire, query.getPointsRequire()) .eq(query.getPointsRequireSymbol() == QuantitativeRelationSymbolEnum.EQ.getValue(), RewardDO::getPointsRequire, query.getPointsRequire())
.lt(query.getPointsRequireSymbol() == QuantitativeRelationSymbolEnum.LT.getValue(), RewardDO::getPointsRequire, query.getPointsRequire()); .lt(query.getPointsRequireSymbol() == QuantitativeRelationSymbolEnum.LT.getValue(), RewardDO::getPointsRequire, query.getPointsRequire());
} }
//兑换网点id,领取方式,状态 //提货点id,领取方式,状态
lambdaQuery.eqIfPresent(RewardDO::getNodeId, query.getNodeId()) lambdaQuery.eqIfPresent(RewardDO::getNodeId, query.getNodeId())
.eq(StringUtils.isNotBlank(query.getPickMethod()), RewardDO::getPickMethod, query.getPickMethod()) .eq(StringUtils.isNotBlank(query.getPickMethod()), RewardDO::getPickMethod, query.getPickMethod())
.eqIfPresent(RewardDO::getStatus, query.getStatus()); .eqIfPresent(RewardDO::getStatus, query.getStatus());
...@@ -340,22 +355,22 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i ...@@ -340,22 +355,22 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
rewardDOLambdaQuery.eq(RewardDO::getNodeId, reqVO.getNodeId()); rewardDOLambdaQuery.eq(RewardDO::getNodeId, reqVO.getNodeId());
} else { } else {
UserRespDTO user = memberUserApi.getUser(reqVO.getMemberId()); UserRespDTO user = memberUserApi.getUser(reqVO.getMemberId());
List<NodeRespDTO> nodes; List<WarehouseDO> warehouseList;
// 根据用户城市获取 // 根据用户城市获取
nodes = nodeApi.getNodesByCity(user.getCity().longValue(), null); warehouseList = warehouseMapper.selectList(new LambdaQueryWrapperX<WarehouseDO>().eq(WarehouseDO::getShi, user.getCity().longValue()));
appRewardListBackVO.setCity(user.getCity().longValue()); appRewardListBackVO.setCity(user.getCity().longValue());
appRewardListBackVO.setCountry(user.getCountry().longValue()); appRewardListBackVO.setCountry(user.getCountry().longValue());
if (CollectionUtil.isEmpty(nodes)) { if (CollectionUtil.isEmpty(warehouseList)) {
// 根据用户国家获取 // 根据用户国家获取
nodes = nodeApi.getNodesByCity(null, user.getCountry().longValue()); warehouseList = warehouseMapper.selectList(new LambdaQueryWrapperX<WarehouseDO>().eq(WarehouseDO::getGuojia, user.getCountry().longValue()));
appRewardListBackVO.setCity(null); appRewardListBackVO.setCity(null);
} }
// 国家和城市都获取不到 // 国家和城市都获取不到
if (CollectionUtil.isEmpty(nodes)) { if (CollectionUtil.isEmpty(warehouseList)) {
nodes = nodeApi.getNodesByCity(null, 130L); warehouseList = warehouseMapper.selectList(new LambdaQueryWrapperX<WarehouseDO>().eq(WarehouseDO::getGuojia, 130L));
appRewardListBackVO.setCountry(130L); appRewardListBackVO.setCountry(130L);
} }
List<Long> nodeIds = nodes.stream().map(NodeRespDTO::getId).collect(Collectors.toList()); List<Long> nodeIds = warehouseList.stream().map(WarehouseDO::getId).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(nodeIds)) { if (CollectionUtil.isNotEmpty(nodeIds)) {
rewardDOLambdaQuery.in(RewardDO::getNodeId, nodeIds); rewardDOLambdaQuery.in(RewardDO::getNodeId, nodeIds);
} }
...@@ -377,10 +392,12 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i ...@@ -377,10 +392,12 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
AppRewardBackVO appRewardBackVO = new AppRewardBackVO(); AppRewardBackVO appRewardBackVO = new AppRewardBackVO();
BeanUtils.copyProperties(rewardDO, appRewardBackVO); BeanUtils.copyProperties(rewardDO, appRewardBackVO);
setPickMethod(appRewardBackVO); setPickMethod(appRewardBackVO);
NodeRespDTO nodesById = nodeApi.getNodesById(Long.valueOf(rewardDO.getNodeId())); WarehouseDO warehouse = warehouseMapper.selectById(Long.valueOf(rewardDO.getNodeId()));
if (nodesById != null) { if (warehouse != null) {
appRewardBackVO.setNodeZh(nodesById.getGuojiaZh() + "、" + nodesById.getShiZh() + "、" + nodesById.getTitleZh()); RegionDO country = regionService.getRegion(warehouse.getGuojia());
appRewardBackVO.setNodeEn(nodesById.getGuojiaEn() + "、" + nodesById.getShiEn() + "、" + nodesById.getTitleEn()); RegionDO city = regionService.getRegion(warehouse.getShi());
appRewardBackVO.setNodeZh(country.getTitleZh() + "、" + city.getTitleZh() + "、" + warehouse.getTitleZh());
appRewardBackVO.setNodeEn(country.getTitleEn() + "、" + city.getTitleEn() + "、" + warehouse.getTitleEn());
} }
return appRewardBackVO; return appRewardBackVO;
} }
...@@ -422,22 +439,22 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i ...@@ -422,22 +439,22 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
*/ */
private List<Long> getMemberCityNodes(Long memberId) { private List<Long> getMemberCityNodes(Long memberId) {
UserRespDTO user = memberUserApi.getUser(memberId); UserRespDTO user = memberUserApi.getUser(memberId);
List<NodeRespDTO> nodes; List<WarehouseDO> warehouseList;
// 如果用户没有填写国家或城市默认展示中国的礼品 // 如果用户没有填写国家或城市默认展示中国的礼品
if (user.getCity() == null || user.getCountry() == null) { if (user.getCity() == null || user.getCountry() == null) {
nodes = nodeApi.getNodesByCity(null, 130L); warehouseList = warehouseMapper.selectList(new LambdaQueryWrapperX<WarehouseDO>().eq(WarehouseDO::getGuojia, 130L));
} else { } else {
// 根据用户城市获取 // 根据用户城市获取
nodes = nodeApi.getNodesByCity(user.getCity().longValue(), null); warehouseList = warehouseMapper.selectList(new LambdaQueryWrapperX<WarehouseDO>().eq(WarehouseDO::getShi, user.getCity().longValue()));
if (CollectionUtil.isEmpty(nodes)) { if (CollectionUtil.isEmpty(warehouseList)) {
// 根据用户国家获取 // 根据用户国家获取
nodes = nodeApi.getNodesByCity(null, user.getCountry().longValue()); warehouseList = warehouseMapper.selectList(new LambdaQueryWrapperX<WarehouseDO>().eq(WarehouseDO::getGuojia, user.getCountry().longValue()));
} }
} }
// 国家和城市都获取不到 // 国家和城市都获取不到
if (CollectionUtil.isEmpty(nodes)) { if (CollectionUtil.isEmpty(warehouseList)) {
nodes = nodeApi.getNodesByCity(null, 130L); warehouseList = warehouseMapper.selectList(new LambdaQueryWrapperX<WarehouseDO>().eq(WarehouseDO::getGuojia, 130L));
} }
return nodes.stream().map(NodeRespDTO::getId).collect(Collectors.toList()); return warehouseList.stream().map(WarehouseDO::getId).collect(Collectors.toList());
} }
} }
...@@ -9,7 +9,6 @@ import lombok.Data; ...@@ -9,7 +9,6 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -60,11 +59,11 @@ public class RewardBackVO { ...@@ -60,11 +59,11 @@ public class RewardBackVO {
@ApiModelProperty(value = "兑换所需积分", required = true) @ApiModelProperty(value = "兑换所需积分", required = true)
private Integer pointsRequire; private Integer pointsRequire;
@ExcelProperty("兑换网点") @ExcelProperty("提货点")
@ApiModelProperty(value = "兑换网点", required = true) @ApiModelProperty(value = "提货点", required = true)
private Integer nodeId; private Integer nodeId;
@ApiModelProperty(value = "兑换网点和积分列表", required = true) @ApiModelProperty(value = "提货点,积分,剩余数量列表", required = true)
private List<RewardBackVO.NodeAndPoints> nodeIds = new ArrayList<>(); private List<RewardBackVO.NodeAndPoints> nodeIds = new ArrayList<>();
@ExcelProperty("已兑换次数") @ExcelProperty("已兑换次数")
...@@ -122,9 +121,11 @@ public class RewardBackVO { ...@@ -122,9 +121,11 @@ public class RewardBackVO {
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public static class NodeAndPoints { public static class NodeAndPoints {
@ApiModelProperty(value = "兑换网点") @ApiModelProperty(value = "提货点")
private Integer nodeId; private List<Integer> wareHouses;
@ApiModelProperty(value = "兑换网点对应积分") @ApiModelProperty(value = "提货点对应积分")
private Integer points; private Integer points;
@ApiModelProperty(value = "剩余数量")
private Integer quantityRemain;
} }
} }
...@@ -49,14 +49,14 @@ public class RewardCreateReqVO { ...@@ -49,14 +49,14 @@ public class RewardCreateReqVO {
//@NotNull(message = "兑换网点不能为空") //@NotNull(message = "兑换网点不能为空")
//private Integer nodeId; //private Integer nodeId;
@ApiModelProperty(value = "兑换网点和积分列表", required = true) @ApiModelProperty(value = "提货点,积分,剩余数量列表", required = true)
@NotNull(message = "兑换网点列表不能为空") @NotNull(message = "兑换网点列表不能为空")
private List<NodeAndPoints> nodeIds; private List<NodeAndPoints> nodeIds;
@ApiModelProperty(value = "剩余数量", required = true) //@ApiModelProperty(value = "剩余数量", required = true)
@NotNull(message = "剩余数量不能为空") //@NotNull(message = "剩余数量不能为空")
@Min(value = 0) //@Min(value = 0)
private Integer quantityRemain; //private Integer quantityRemain;
@ApiModelProperty(value = "活动开始时间") @ApiModelProperty(value = "活动开始时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
...@@ -93,9 +93,11 @@ public class RewardCreateReqVO { ...@@ -93,9 +93,11 @@ public class RewardCreateReqVO {
@Data @Data
public static class NodeAndPoints { public static class NodeAndPoints {
@ApiModelProperty(value = "兑换网点") @ApiModelProperty(value = "提货点")
private Integer nodeId; private List<Integer> wareHouses;
@ApiModelProperty(value = "兑换网点对应积分") @ApiModelProperty(value = "提货点对应积分")
private Integer points; private Integer points;
@ApiModelProperty(value = "剩余数量")
private Integer quantityRemain;
} }
} }
...@@ -1028,7 +1028,7 @@ reward.score.not.enough = \u79EF\u5206\u4E0D\u8DB3 ...@@ -1028,7 +1028,7 @@ reward.score.not.enough = \u79EF\u5206\u4E0D\u8DB3
reward.count.not.enough = \u793C\u54C1\u6570\u91CF\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.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.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 reward.redeem.recipient.error = \u793C\u54C1\u6536\u8D27\u4EBA\u4FE1\u606F\u4E0D\u5168
redeem.import.no.record = \u8868\u683C\u4E2D\u65E0\u8BB0\u5F55 redeem.import.no.record = \u8868\u683C\u4E2D\u65E0\u8BB0\u5F55
order.cargo.control.limit.update.consignee.error=\u5F53\u524D\u63A7\u8D27\u8BA2\u5355\u9650\u5236\u4FEE\u6539\u6536\u8D27\u4EBA\uFF0C\u672A\u67E5\u8BE2\u5230\u9650\u5236\u65F6\u95F4 order.cargo.control.limit.update.consignee.error=\u5F53\u524D\u63A7\u8D27\u8BA2\u5355\u9650\u5236\u4FEE\u6539\u6536\u8D27\u4EBA\uFF0C\u672A\u67E5\u8BE2\u5230\u9650\u5236\u65F6\u95F4
......
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