master:发布商品,获取颜色调优;
parent
104554c1c5
commit
2b81db2ac0
|
|
@ -6,7 +6,9 @@ import com.ruoyi.common.core.controller.XktBaseController;
|
|||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.Page;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.web.controller.xkt.vo.storeFactory.StoreFactoryResVO;
|
||||
import com.ruoyi.web.controller.xkt.vo.storeMember.StoreMemberCreateVO;
|
||||
import com.ruoyi.web.controller.xkt.vo.storeMember.StoreMemberExpireResVO;
|
||||
import com.ruoyi.web.controller.xkt.vo.storeMember.StoreMemberPageVO;
|
||||
import com.ruoyi.xkt.dto.storeMember.StoreMemberCreateDTO;
|
||||
import com.ruoyi.xkt.dto.storeMember.StoreMemberPageDTO;
|
||||
|
|
@ -17,10 +19,9 @@ import io.swagger.annotations.ApiOperation;
|
|||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 档口购买会员controller
|
||||
|
|
@ -51,6 +52,14 @@ public class StoreMemberController extends XktBaseController {
|
|||
return R.ok(storeMemberService.page(BeanUtil.toBean(pageVO, StoreMemberPageDTO.class)));
|
||||
}
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,store')||@ss.hasSupplierSubRole()")
|
||||
@ApiOperation(value = "获取档口会员过期时间", httpMethod = "GET", response = R.class)
|
||||
@GetMapping("/expire/{storeId}")
|
||||
public R<StoreMemberExpireResVO> expire(@PathVariable Long storeId) {
|
||||
return R.ok(BeanUtil.toBean(storeMemberService.expire(storeId), StoreMemberExpireResVO.class));
|
||||
}
|
||||
|
||||
// TODO 每天获取档口会员过期提醒
|
||||
// TODO 每天获取档口会员过期提醒
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,13 @@ public class GtAndFhbBizController extends BaseController {
|
|||
final StoreProductCategoryAttributeMapper prodCateAttrMapper;
|
||||
final SysProductCategoryMapper prodCateMapper;
|
||||
|
||||
|
||||
|
||||
// TODO 提供导出测试环境数据的接口,不然迁移到生产还要重新来一遍
|
||||
// TODO 提供导出测试环境数据的接口,不然迁移到生产还要重新来一遍
|
||||
// TODO 提供导出测试环境数据的接口,不然迁移到生产还要重新来一遍
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@PutMapping("/sync-es/{storeId}")
|
||||
public void syncToEs(@PathVariable("storeId") Long storeId) {
|
||||
|
|
|
|||
|
|
@ -65,6 +65,11 @@ public class GtAndTyBizController extends BaseController {
|
|||
final SysProductCategoryMapper prodCateMapper;
|
||||
|
||||
|
||||
// TODO 提供导出测试环境数据的接口,不然迁移到生产还要重新来一遍
|
||||
// TODO 提供导出测试环境数据的接口,不然迁移到生产还要重新来一遍
|
||||
// TODO 提供导出测试环境数据的接口,不然迁移到生产还要重新来一遍
|
||||
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@PutMapping("/sync-es/{storeId}")
|
||||
public void syncToEs(@PathVariable("storeId") Long storeId) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.storeMember;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@ApiModel
|
||||
@Data
|
||||
public class StoreMemberExpireResVO {
|
||||
|
||||
@ApiModelProperty(value = "档口ID")
|
||||
private Long storeId;
|
||||
@ApiModelProperty(value = "会员到期时间")
|
||||
private Date endTime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.ruoyi.xkt.dto.storeMember;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@ApiModel
|
||||
@Data
|
||||
public class StoreMemberExpireResDTO {
|
||||
|
||||
@ApiModelProperty(value = "档口ID")
|
||||
private Long storeId;
|
||||
@ApiModelProperty(value = "会员到期时间")
|
||||
private Date endTime;
|
||||
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.ruoyi.xkt.service;
|
|||
|
||||
import com.ruoyi.common.core.page.Page;
|
||||
import com.ruoyi.xkt.dto.storeMember.StoreMemberCreateDTO;
|
||||
import com.ruoyi.xkt.dto.storeMember.StoreMemberExpireResDTO;
|
||||
import com.ruoyi.xkt.dto.storeMember.StoreMemberPageDTO;
|
||||
import com.ruoyi.xkt.dto.storeMember.StoreMemberPageResDTO;
|
||||
|
||||
|
|
@ -28,4 +29,12 @@ public interface IStoreMemberService {
|
|||
* @return Page<StoreMemberPageResDTO>
|
||||
*/
|
||||
Page<StoreMemberPageResDTO> page(StoreMemberPageDTO pageDTO);
|
||||
|
||||
/**
|
||||
* 获取档口会员过期时间
|
||||
*
|
||||
* @param storeId 档口ID
|
||||
* @return StoreMemberExpireResDTO
|
||||
*/
|
||||
StoreMemberExpireResDTO expire(Long storeId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,9 +13,7 @@ import lombok.RequiredArgsConstructor;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -30,6 +28,20 @@ public class StoreColorServiceImpl implements IStoreColorService {
|
|||
|
||||
final StoreColorMapper storeColorMapper;
|
||||
|
||||
private static final Map<String, Integer> colorPriority = new HashMap<String, Integer>() {{
|
||||
put("白", 1); put("黑", 2); put("红", 3); put("棕", 4); put("灰", 5); put("卡", 6);
|
||||
put("银", 7); put("金", 8); put("蓝", 9); put("绿", 10); put("黄", 11); put("粉", 12);
|
||||
put("紫", 13); put("橙", 14); put("米", 15); put("杏", 16); put("香", 17); put("军", 18);
|
||||
put("酒", 19); put("咖", 20); put("焦", 21); put("墨", 22); put("豹", 23); put("蛇", 24);
|
||||
}};
|
||||
|
||||
private static final Map<String, Integer> suffixPriority = new HashMap<String, Integer>() {{
|
||||
put("", 1); put("单里", 2); put("绒里", 3); put("毛里", 4); put("标准筒", 5); put("加宽筒", 6);
|
||||
put("漆", 7); put("哑光", 8); put("亚光", 9); put("亮", 10); put("雕花", 11); put("爆裂纹", 12);
|
||||
put("马毛", 13); put("豹纹", 14); put("蛇纹", 15); put("石头纹", 16); put("羊翻", 17); put("牛翻", 18);
|
||||
}};
|
||||
|
||||
|
||||
/**
|
||||
* 查询档口所有颜色列表
|
||||
*
|
||||
|
|
@ -42,8 +54,24 @@ public class StoreColorServiceImpl implements IStoreColorService {
|
|||
List<StoreColor> storeColorList = Optional.ofNullable(this.storeColorMapper.selectList(new LambdaQueryWrapper<StoreColor>()
|
||||
.eq(StoreColor::getStoreId, storeId).eq(StoreColor::getDelFlag, Constants.UNDELETED)))
|
||||
.orElseThrow(() -> new ServiceException("当前档口没有颜色!", HttpStatus.ERROR));
|
||||
return storeColorList.stream().map(x -> BeanUtil.toBean(x, StoreColorDTO.class).setStoreColorId(x.getId()))
|
||||
.sorted(Comparator.comparing(StoreColorDTO::getOrderNum)).collect(Collectors.toList());
|
||||
return storeColorList.stream()
|
||||
.map(x -> BeanUtil.toBean(x, StoreColorDTO.class).setStoreColorId(x.getId()))
|
||||
.collect(Collectors.collectingAndThen(
|
||||
Collectors.toMap(StoreColorDTO::getColorName, dto -> dto, (existing, replacement) -> existing),
|
||||
map -> new ArrayList<>(map.values())))
|
||||
.stream()
|
||||
.sorted(Comparator
|
||||
.comparing((StoreColorDTO c) ->
|
||||
colorPriority.getOrDefault(c.getColorName().substring(0, 1), Integer.MAX_VALUE))
|
||||
.thenComparing(c ->
|
||||
suffixPriority.entrySet().stream()
|
||||
.filter(e -> c.getColorName().contains(e.getKey()))
|
||||
.map(Map.Entry::getValue)
|
||||
.findFirst()
|
||||
.orElse(Integer.MAX_VALUE))
|
||||
.thenComparing(StoreColorDTO::getOrderNum)
|
||||
)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.xkt.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
|
@ -12,7 +13,9 @@ import com.ruoyi.common.exception.ServiceException;
|
|||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.xkt.domain.Store;
|
||||
import com.ruoyi.xkt.domain.StoreMember;
|
||||
import com.ruoyi.xkt.dto.advertRound.AdRoundStoreBoughtResDTO;
|
||||
import com.ruoyi.xkt.dto.storeMember.StoreMemberCreateDTO;
|
||||
import com.ruoyi.xkt.dto.storeMember.StoreMemberExpireResDTO;
|
||||
import com.ruoyi.xkt.dto.storeMember.StoreMemberPageDTO;
|
||||
import com.ruoyi.xkt.dto.storeMember.StoreMemberPageResDTO;
|
||||
import com.ruoyi.xkt.enums.NoticeOwnerType;
|
||||
|
|
@ -31,6 +34,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
|
@ -110,5 +114,20 @@ public class StoreMemberServiceImpl implements IStoreMemberService {
|
|||
: Page.convert(new PageInfo<>(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取档口会员过期时间
|
||||
*
|
||||
* @param storeId 档口ID
|
||||
* @return StoreMemberExpireResDTO
|
||||
*/
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public StoreMemberExpireResDTO expire(Long storeId) {
|
||||
StoreMember storeMember = this.storeMemberMapper.selectOne(new LambdaQueryWrapper<StoreMember>()
|
||||
.eq(StoreMember::getStoreId, storeId).eq(StoreMember::getDelFlag, Constants.UNDELETED)
|
||||
.gt(StoreMember::getStartTime, new Date()).le(StoreMember::getEndTime, new Date()));
|
||||
return BeanUtil.toBean(storeMember, StoreMemberExpireResDTO.class);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue