Commit 03a7d578 authored by zhangfeng's avatar zhangfeng

Merge branch 'refs/heads/feature_member_score' into dev

parents 3e7053ff a7340da0
...@@ -10,9 +10,12 @@ import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated; ...@@ -10,9 +10,12 @@ import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerContacts.CustomerContactsDO; import cn.iocoder.yudao.module.customer.dal.dataobject.customerContacts.CustomerContactsDO;
import cn.iocoder.yudao.module.customer.service.customerContacts.CustomerContactsService; import cn.iocoder.yudao.module.customer.service.customerContacts.CustomerContactsService;
import cn.iocoder.yudao.module.ecw.api.paramValid.ParamValidatorApi; import cn.iocoder.yudao.module.ecw.api.paramValid.ParamValidatorApi;
import cn.iocoder.yudao.module.ecw.dal.dataobject.region.RegionDO;
import cn.iocoder.yudao.module.ecw.service.internalMessage.InternalMessageService; import cn.iocoder.yudao.module.ecw.service.internalMessage.InternalMessageService;
import cn.iocoder.yudao.module.ecw.service.internalMessage.WebInternalMessageService; import cn.iocoder.yudao.module.ecw.service.internalMessage.WebInternalMessageService;
import cn.iocoder.yudao.module.ecw.service.region.RegionService;
import cn.iocoder.yudao.module.member.controller.app.auth.vo.AppEmailUpdateReqVO; import cn.iocoder.yudao.module.member.controller.app.auth.vo.AppEmailUpdateReqVO;
import cn.iocoder.yudao.module.member.service.level.MemberUserLevelConfigService;
import cn.iocoder.yudao.module.member.vo.member.MemberUpdateReqVO; import cn.iocoder.yudao.module.member.vo.member.MemberUpdateReqVO;
import cn.iocoder.yudao.module.member.controller.app.user.vo.*; import cn.iocoder.yudao.module.member.controller.app.user.vo.*;
import cn.iocoder.yudao.module.member.convert.user.UserConvert; import cn.iocoder.yudao.module.member.convert.user.UserConvert;
...@@ -35,6 +38,8 @@ import cn.iocoder.yudao.module.member.vo.userEnterprise.UserEnterpriseCreateReqV ...@@ -35,6 +38,8 @@ import cn.iocoder.yudao.module.member.vo.userEnterprise.UserEnterpriseCreateReqV
import cn.iocoder.yudao.module.member.vo.userEnterprise.UserEnterpriseUpdateReqVO; import cn.iocoder.yudao.module.member.vo.userEnterprise.UserEnterpriseUpdateReqVO;
import cn.iocoder.yudao.module.member.vo.userEnterpriseAuth.UserEnterpriseAuthBackVO; import cn.iocoder.yudao.module.member.vo.userEnterpriseAuth.UserEnterpriseAuthBackVO;
import cn.iocoder.yudao.module.member.vo.userEnterpriseAuth.UserEnterpriseAuthCreateReqVO; import cn.iocoder.yudao.module.member.vo.userEnterpriseAuth.UserEnterpriseAuthCreateReqVO;
import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelConfigBaseRespVO;
import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserScoreLevelVO;
import cn.iocoder.yudao.module.product.service.coupon.CouponService; import cn.iocoder.yudao.module.product.service.coupon.CouponService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -98,6 +103,12 @@ public class AppUserController { ...@@ -98,6 +103,12 @@ public class AppUserController {
@Resource @Resource
private PasswordEncoder passwordEncoder; private PasswordEncoder passwordEncoder;
@Resource
private MemberUserLevelConfigService memberUserLevelConfigService;
@Resource
private RegionService regionService;
@PutMapping("/update-nickname") @PutMapping("/update-nickname")
@ApiOperation("修改用户昵称") @ApiOperation("修改用户昵称")
...@@ -146,6 +157,26 @@ public class AppUserController { ...@@ -146,6 +157,26 @@ public class AppUserController {
if (passwordEncoder.matches("88888888", user.getPassword())) { if (passwordEncoder.matches("88888888", user.getPassword())) {
respVO.setIsSimplePassword(Boolean.TRUE); respVO.setIsSimplePassword(Boolean.TRUE);
} }
MemberUserLevelConfigBaseRespVO userScoreLevelVO = memberUserLevelConfigService.getLevelByCount(user.getTotalScore());
MemberUserScoreLevelVO scoreLevelVO = MemberUserScoreLevelVO.builder().memberId(user.getId())
.memberCode(user.getMemberCode())
.holdScore(user.getHoldScore())
.expiredScore(user.getExpiredScore())
.usedScore(user.getUsedScore())
.levelIcon(userScoreLevelVO.getIcon())
.levelName(userScoreLevelVO.getName())
.build();
respVO.setUserScoreLevelInfo(scoreLevelVO);
if (user.getCountry() != null) {
RegionDO region = regionService.getRegion(Long.valueOf(user.getCountry()));
respVO.setCountryTitleEn(region.getTitleEn());
respVO.setCountryTitleZh(region.getTitleZh());
}
if (user.getCity() != null) {
RegionDO region = regionService.getRegion(Long.valueOf(user.getCity()));
respVO.setCityTitleEn(region.getTitleEn());
respVO.setCityTitleZh(region.getTitleZh());
}
return success(respVO); return success(respVO);
} }
......
package cn.iocoder.yudao.module.member.controller.app.user.vo; package cn.iocoder.yudao.module.member.controller.app.user.vo;
import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserScoreLevelVO;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -67,4 +68,14 @@ public class AppUserInfoRespVO { ...@@ -67,4 +68,14 @@ public class AppUserInfoRespVO {
@ApiModelProperty(value = "是否简单密码", example = "false") @ApiModelProperty(value = "是否简单密码", example = "false")
private Boolean isSimplePassword = Boolean.FALSE; private Boolean isSimplePassword = Boolean.FALSE;
@ApiModelProperty(value = "会员积分信息")
private MemberUserScoreLevelVO userScoreLevelInfo;
@ApiModelProperty(value = "会员国家中文")
private String countryTitleZh;
@ApiModelProperty(value = "会员国家英文")
private String countryTitleEn;
@ApiModelProperty(value = "会员城市中文")
private String cityTitleZh;
@ApiModelProperty(value = "会员国家英文")
private String cityTitleEn;
} }
...@@ -10,6 +10,7 @@ import org.springframework.data.redis.core.StringRedisTemplate; ...@@ -10,6 +10,7 @@ import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.concurrent.TimeUnit;
/** /**
* 会员积分规则 Redis DAO * 会员积分规则 Redis DAO
...@@ -57,7 +58,7 @@ public class ScoreRuleRedisDao { ...@@ -57,7 +58,7 @@ public class ScoreRuleRedisDao {
ScoreRuleOrderVExtraVO scoreRuleOrderVExtraVO = JsonUtils.parseObject(scoreRuleDO.getExtra(), ScoreRuleOrderVExtraVO.class); ScoreRuleOrderVExtraVO scoreRuleOrderVExtraVO = JsonUtils.parseObject(scoreRuleDO.getExtra(), ScoreRuleOrderVExtraVO.class);
stringRedisTemplate.opsForValue().set(formatKey(scoreRuleDO.getType(), scoreRuleOrderVExtraVO.getTransportType()), JsonUtils.toJsonString(scoreRuleDO)); stringRedisTemplate.opsForValue().set(formatKey(scoreRuleDO.getType(), scoreRuleOrderVExtraVO.getTransportType()), JsonUtils.toJsonString(scoreRuleDO));
} }
stringRedisTemplate.opsForValue().set(formatKey(scoreRuleDO.getType(), null), JsonUtils.toJsonString(scoreRuleDO)); stringRedisTemplate.opsForValue().set(formatKey(scoreRuleDO.getType(), null), JsonUtils.toJsonString(scoreRuleDO),24L, TimeUnit.HOURS);
} }
public void deleteEnableScoreRule(Integer type) { public void deleteEnableScoreRule(Integer type) {
......
...@@ -415,15 +415,11 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score ...@@ -415,15 +415,11 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
if (enableScoreRule == null) { if (enableScoreRule == null) {
return null; return null;
} }
// 校验一下活动开始结束时间
if (!enableScoreRule.getEndTime().after(new Date()) || !enableScoreRule.getStartTime().before(new Date())) {
return null;
}
scoreRuleRedisDao.setEnableScoreRule(enableScoreRule); scoreRuleRedisDao.setEnableScoreRule(enableScoreRule);
} else { // 校验一下活动开始结束时间
if (!enableScoreRule.getEndTime().after(new Date()) || !enableScoreRule.getStartTime().before(new Date())) { }
return null; if (!enableScoreRule.getEndTime().after(new Date()) || !enableScoreRule.getStartTime().before(new Date())) {
} return null;
} }
return enableScoreRule; return enableScoreRule;
} }
...@@ -439,14 +435,10 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score ...@@ -439,14 +435,10 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
if (enableScoreRule == null) { if (enableScoreRule == null) {
return null; return null;
} }
if (!enableScoreRule.getEndTime().after(new Date()) || !enableScoreRule.getStartTime().before(new Date())) {
return null;
}
scoreRuleRedisDao.setEnableScoreRule(enableScoreRule); scoreRuleRedisDao.setEnableScoreRule(enableScoreRule);
} else { }
if (!enableScoreRule.getEndTime().after(new Date()) || !enableScoreRule.getStartTime().before(new Date())) { if (!enableScoreRule.getEndTime().after(new Date()) || !enableScoreRule.getStartTime().before(new Date())) {
return null; return null;
}
} }
return enableScoreRule; return enableScoreRule;
case RECOMMEND: case RECOMMEND:
......
package cn.iocoder.boot.module.order.api; package cn.iocoder.boot.module.order.api;
import cn.iocoder.boot.module.order.api.dto.OrderItemRespDTO;
import cn.iocoder.boot.module.order.api.dto.OrderRespDTO; import cn.iocoder.boot.module.order.api.dto.OrderRespDTO;
import java.util.List;
/** /**
* 订单 api * 订单 api
*/ */
...@@ -14,4 +17,8 @@ public interface OrderApi { ...@@ -14,4 +17,8 @@ public interface OrderApi {
* 判断是否用户首单 * 判断是否用户首单
*/ */
boolean isFirstOrder(Long userId); boolean isFirstOrder(Long userId);
/**
* 根据订单id获取所有订单项
*/
List<OrderItemRespDTO> getOrderItemsByOrderId(Long orderId);
} }
package cn.iocoder.boot.module.order.api.dto;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import org.apache.commons.lang3.StringUtils;
/**
* 订单收货人信息 DO
*
* @author 系统管理员
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class OrderConsigneeApiDO extends BaseDO {
/**
* 主键ID
*/
@TableId
private Long id;
/**
* 下单用户id
*/
private Long relationId;
/**
* 订单id
*/
private Long orderId;
/**
* 收货人姓名
*/
private String name;
/**
* 收货人姓名(英文)
*/
private String nameEn;
/**
* 手机
*/
private String phone;
/**
* 邮箱
*/
private String email;
/**
* 公司
*/
private String company;
/**
* 公司(英文)
*/
private String companyEn;
@ApiModelProperty(value = "收获方式:1 自提 2 送货上门 ")
private Integer harvestMethod;
@ApiModelProperty(value = "送货时间", required = true)
private String deliveryDate;
/**
* 地址
*/
private String address;
@ApiModelProperty(value = "国家")
private Long country;
@ApiModelProperty(value = "省")
private Long province;
@ApiModelProperty(value = "市")
private Long city;
/**
* 国家简称
*/
private String countryAbbreviation;
/**
* 国家区号
*/
private String countryCode;
/**
* 客户id
*/
private Long customerId;
/**
* 客户联系人id
*/
private Long customerContactsId;
public void setCountryCode(String countryCode) {
if (StringUtils.isNotBlank(countryCode)) {
this.countryCode = countryCode.replace("+", "");
}else {
this.countryCode = countryCode;
}
}
}
package cn.iocoder.boot.module.order.api.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OrderItemRespDTO {
@ApiModelProperty(value = "收费重量")
private BigDecimal chargeWeight;
@ApiModelProperty(value = "收费体积")
private BigDecimal chargeVolume;
}
...@@ -278,6 +278,11 @@ public class OrderRespDTO { ...@@ -278,6 +278,11 @@ public class OrderRespDTO {
@NotNull(message = "目的地信息不能为空") @NotNull(message = "目的地信息不能为空")
private OrderObjectiveApiDO orderObjectiveDO; private OrderObjectiveApiDO orderObjectiveDO;
@TableField(exist = false)
@ApiModelProperty(value = "收货人信息")
@NotNull(message = "收货人信息不能为空")
private OrderConsigneeApiDO orderConsigneeDO;
@TableField(exist = false) @TableField(exist = false)
@ApiModelProperty(value = "目的地ID") @ApiModelProperty(value = "目的地ID")
private Long objectiveId; private Long objectiveId;
......
package cn.iocoder.yudao.module.order.api; package cn.iocoder.yudao.module.order.api;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.boot.module.order.api.OrderApi; import cn.iocoder.boot.module.order.api.OrderApi;
import cn.iocoder.boot.module.order.api.dto.OrderConsigneeApiDO;
import cn.iocoder.boot.module.order.api.dto.OrderItemRespDTO;
import cn.iocoder.boot.module.order.api.dto.OrderObjectiveApiDO; import cn.iocoder.boot.module.order.api.dto.OrderObjectiveApiDO;
import cn.iocoder.boot.module.order.api.dto.OrderRespDTO; import cn.iocoder.boot.module.order.api.dto.OrderRespDTO;
import cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO; import cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderConsignee.OrderConsigneeDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderItem.OrderItemDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderObjective.OrderObjectiveDO; import cn.iocoder.yudao.module.order.dal.dataobject.orderObjective.OrderObjectiveDO;
import cn.iocoder.yudao.module.order.service.order.OrderConsigneeService;
import cn.iocoder.yudao.module.order.service.order.OrderObjectiveService; import cn.iocoder.yudao.module.order.service.order.OrderObjectiveService;
import cn.iocoder.yudao.module.order.service.order.OrderService; import cn.iocoder.yudao.module.order.service.order.OrderService;
import cn.iocoder.yudao.module.order.service.order.impl.OrderItemServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
@Service @Service
@Validated @Validated
...@@ -21,6 +30,10 @@ public class OrderApiImpl implements OrderApi { ...@@ -21,6 +30,10 @@ public class OrderApiImpl implements OrderApi {
private OrderService orderService; private OrderService orderService;
@Resource @Resource
private OrderObjectiveService objectiveService; private OrderObjectiveService objectiveService;
@Resource
private OrderConsigneeService orderConsigneeService;
@Resource
private OrderItemServiceImpl orderItemService;
@Override @Override
public OrderRespDTO getOrder(Long id, String orderNo) { public OrderRespDTO getOrder(Long id, String orderNo) {
...@@ -36,13 +49,22 @@ public class OrderApiImpl implements OrderApi { ...@@ -36,13 +49,22 @@ public class OrderApiImpl implements OrderApi {
OrderRespDTO orderRespDTO = new OrderRespDTO(); OrderRespDTO orderRespDTO = new OrderRespDTO();
BeanUtils.copyProperties(orderDO, orderRespDTO); BeanUtils.copyProperties(orderDO, orderRespDTO);
// 设置目的地信息
OrderObjectiveDO orderObjectiveDO = objectiveService.getByOrderId(id); OrderObjectiveDO orderObjectiveDO = objectiveService.getByOrderId(id);
if (orderObjectiveDO == null) { if (orderObjectiveDO != null) {
return orderRespDTO; OrderObjectiveApiDO orderObjectiveApiDO = new OrderObjectiveApiDO();
BeanUtils.copyProperties(orderObjectiveDO, orderObjectiveApiDO);
orderRespDTO.setOrderObjectiveDO(orderObjectiveApiDO);
} }
OrderObjectiveApiDO orderObjectiveApiDO = new OrderObjectiveApiDO();
BeanUtils.copyProperties(orderObjectiveDO, orderObjectiveApiDO); // 设置收货人信息
orderRespDTO.setOrderObjectiveDO(orderObjectiveApiDO); OrderConsigneeDO orderConsigneeByOrderId = orderConsigneeService.getOrderConsigneeByOrderId(id);
if (orderConsigneeByOrderId != null) {
OrderConsigneeApiDO orderConsigneeApiDO = new OrderConsigneeApiDO();
BeanUtils.copyProperties(orderConsigneeByOrderId, orderConsigneeApiDO);
orderRespDTO.setOrderConsigneeDO(orderConsigneeApiDO);
}
return orderRespDTO; return orderRespDTO;
} }
...@@ -51,4 +73,13 @@ public class OrderApiImpl implements OrderApi { ...@@ -51,4 +73,13 @@ public class OrderApiImpl implements OrderApi {
Long count = orderService.selectCount(new LambdaQueryWrapper<OrderDO>().eq(OrderDO::getUserId, userId)); Long count = orderService.selectCount(new LambdaQueryWrapper<OrderDO>().eq(OrderDO::getUserId, userId));
return count <= 0; return count <= 0;
} }
@Override
public List<OrderItemRespDTO> getOrderItemsByOrderId(Long orderId) {
List<OrderItemDO> orderItemDOS = orderItemService.selectList("order_id", orderId);
if (CollectionUtil.isNotEmpty(orderItemDOS)) {
return orderItemDOS.stream().map(orderItemDO -> new OrderItemRespDTO(orderItemDO.getChargeWeight(), orderItemDO.getChargeVolume())).collect(Collectors.toList());
}
return null;
}
} }
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