Commit 383327b5 authored by 332784038@qq.com's avatar 332784038@qq.com

Merge remote-tracking branch 'origin/release' into release

parents 744dd2ef f8e4d3d6
......@@ -32,7 +32,7 @@ public class CustomerApiImpl implements CustomerApi {
@Resource
private CountryService countryService;
public void associateCustomerAuto(String areaCode, String phone, Long memberUserId, String newName) {
public void associateCustomerAuto(String areaCode, String phone, Long memberUserId, String newName ,String memberCode) {
//先查询此用户是否有关联老客户
CustomerContactsDO customerContactsDO = customerContactsService.getUniqueOneAndValidate(areaCode, phone, null);
......@@ -85,7 +85,7 @@ public class CustomerApiImpl implements CustomerApi {
customerCreateReqVO.setCustomerContacts(Arrays.asList(customerContactsCreateReqVO));
customerCreateReqVO.setCustomerOperateLogRemark("会员注册关联创建客户. 会员id:" + memberUserId + "; 电话:" + phone);
customerCreateReqVO.setCustomerOperateLogRemark("会员注册关联创建客户. 会员编号:" + memberCode + "; 电话:" + phone);
// app创建
customerCreateReqVO.setCreateFrom(CustomerCreateFromEnum.APP_REGISTER.getValue());
......
......@@ -4,8 +4,10 @@ import java.util.Date;
public interface CustomerApi {
void associateCustomerAuto(String areaCode, String phone, Long userId, String newName);
void associateCustomerAuto(String areaCode, String phone, Long userId, String newName, String memberCode);
void approvalCustomerDelay(String approveId, Integer result);
void approvalCustomerTransfer(String approveId, Integer result);
void fillFirstDealTimeIfNull(Long customerId, Date firstDealTime);
......
......@@ -50,5 +50,6 @@ public class UserRespDTO {
private Integer country;
private Integer city;
private String code;
}
......@@ -2,18 +2,18 @@ package cn.iocoder.yudao.module.member.controller.admin.scoreRule;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.member.dal.dataobject.ScoreRuleShareRecord.ScoreRuleShareRecordDO;
import cn.iocoder.yudao.module.member.service.ScoreRuleShareRecord.ScoreRuleShareRecordService;
import cn.iocoder.yudao.module.member.vo.ScoreRuleShareRecord.ScoreRuleShareRecordDetailReqVO;
import cn.iocoder.yudao.module.member.vo.ScoreRuleShareRecord.ScoreRuleShareRecordDetailVO;
import cn.iocoder.yudao.module.member.vo.ScoreRuleShareRecord.ScoreRuleShareRecordPageVO;
import cn.iocoder.yudao.module.member.vo.ScoreRuleShareRecord.ScoreRuleShareRecordQueryVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
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 javax.annotation.Resource;
import javax.validation.Valid;
......
......@@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.member.controller.app.scoreRule.vo.AppScoreRuleBa
import cn.iocoder.yudao.module.member.controller.app.scoreRule.vo.AppScoreRuleListBackVO;
import cn.iocoder.yudao.module.member.controller.app.scoreRule.vo.AppScoreRuleListReqVO;
import cn.iocoder.yudao.module.member.enums.ScoreRuleTypeEnum;
import cn.iocoder.yudao.module.member.service.ScoreRuleShareRecord.ScoreRuleShareRecordService;
import cn.iocoder.yudao.module.member.service.scoreRule.ScoreRuleService;
import cn.iocoder.yudao.module.member.vo.scoreRule.IdReqVo;
import io.swagger.annotations.Api;
......@@ -36,11 +37,13 @@ public class AppScoreRuleController {
private ApplicationContext applicationContext;
@Resource
private ScoreProducerApi scoreProducerApi;
@Resource
private ScoreRuleShareRecordService scoreRuleShareRecordService;
@PostMapping("/get")
@ApiOperation("客户端获得积分规则详情")
@Idempotent(timeout = 5)
@Idempotent(timeout = 1)
public CommonResult<AppScoreRuleBackDetailVO> getScoreRule(@Valid @RequestBody IdReqVo idReqVo) {
AppScoreRuleBackDetailVO scoreRuleBackDetailVO = scoreRuleService.appGetScoreRule(idReqVo.getId());
return success(scoreRuleBackDetailVO);
......@@ -48,7 +51,7 @@ public class AppScoreRuleController {
@PostMapping("/list")
@ApiOperation("客户端获得积分规则列表")
@Idempotent(timeout = 5)
@Idempotent(timeout = 1, message = "页面加载中")
public CommonResult<List<AppScoreRuleListBackVO>> getScoreRuleList(@Valid @RequestBody AppScoreRuleListReqVO reqVO) {
List<AppScoreRuleListBackVO> list = scoreRuleService.appGetScoreRuleList(reqVO);
return success(list);
......@@ -61,7 +64,11 @@ public class AppScoreRuleController {
if (ruleId == null || userId == null) {
return;
}
scoreProducerApi.sendShareMessage(ScoreRuleTypeEnum.SHARE, userId, ruleId, IPHelper.getIpAddr(request));
String ipAddr = IPHelper.getIpAddr(request);
if (!scoreRuleShareRecordService.verifyTriggerIp(userId, ruleId, ipAddr)) {
return;
}
scoreProducerApi.sendShareMessage(ScoreRuleTypeEnum.SHARE, userId, ruleId, ipAddr);
}
//@PostMapping("/page")
//@ApiOperation("获得积分规则分页")
......
package cn.iocoder.yudao.module.member.dal.dataobject.ScoreRuleShareRecord;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* 分享规则失败点击记录 DO
*
* @author 系统管理员
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("score_rule_share_fail_trigger")
public class ScoreRuleShareFailTriggerDO {
/**
* 主键
*/
@TableId
private Long id;
/**
* 分享记录id
*/
private Long shareRecordId;
/**
* 点击时间
*/
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date triggerTime;
/**
* 点击ip
*/
private String ipAddress;
}
package cn.iocoder.yudao.module.member.dal.mysql.ScoreRuleShareRecord;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.module.member.dal.dataobject.ScoreRuleShareRecord.ScoreRuleShareFailTriggerDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 分享失败点击记录 Mapper
*
* @author 系统管理员
*/
@Mapper
public interface ScoreRuleShareFailTriggerMapper extends AbstractMapper<ScoreRuleShareFailTriggerDO> {
}
\ No newline at end of file
......@@ -100,7 +100,14 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
} else {
lockKey1 = "score:rule:order:lock:" + order.getOrderConsignorDO().getCustomerId();
}
String lockKey2 = "score:rule:order:lock:" + order.getOrderConsigneeDO().getCustomerId();
// 增加订单无收货人时校验
long consigneeId = 0;
if (Objects.isNull(order.getOrderConsigneeDO()) || Objects.isNull(order.getOrderConsigneeDO().getCustomerId())) {
log.info("Order in shipping listener: The order consignee is empty,orderID:{}", orderId);
} else {
consigneeId = order.getOrderConsigneeDO().getCustomerId();
}
String lockKey2 = "score:rule:order:lock:" + consigneeId;
RLock lock1 = redissonClient.getLock(lockKey1);
RLock lock2 = redissonClient.getLock(lockKey2);
RedissonMultiLock multiLock = new RedissonMultiLock(lock1, lock2);
......@@ -110,7 +117,7 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
log.error("Order in shipping listener: get lock error, orderId:{}", orderId);
}
// 获取需要添加积分的用户 发货人
List<Long> userIds = getAddScoreUser(order, extraInfo, scoreRuleDO);
List<Long> userIds = getAddScoreUser(order.getUserId(), order.getOrderConsignorDO().getCustomerId(), consigneeId, extraInfo, scoreRuleDO);
if (CollectionUtil.isEmpty(userIds)) {
log.info("Order in shipping listener: consignor and consignee are not bound to the member, orderId:{}", orderId);
return;
......@@ -159,7 +166,7 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
* @param orderId
* @return
*/
private Integer getScoreCount(Integer transportId, Long channelId, String allowChannels, List<ScoreRuleOrderVExtraVO.OrderVRule> orderVRules, Long orderId) {
private Integer getScoreCount(Integer transportId, Long channelId, List<Long> allowChannels, List<ScoreRuleOrderVExtraVO.OrderVRule> orderVRules, Long orderId) {
Integer scoreCount = 0;
List<OrderItemRespDTO> orderItems = orderApi.getOrderItemsByOrderId(orderId);
if (orderItems == null) {
......@@ -178,8 +185,7 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
} else if (transportId == TransportTypeEnum.SPECIAL_LINE_AIR_FREIGHT.getValue()) {
// 空运校验渠道
// 渠道id
String[] channels = allowChannels.split(",");
if (!ArrayUtil.contains(channels, channelId.toString())) {
if (!allowChannels.contains(channelId)) {
return 0;
}
// 空运算重量
......@@ -190,18 +196,10 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
/**
* 获取需要加分的用户
*
* @param order
* @param extraInfo
* @param scoreRuleDO
* @return
*/
private List<Long> getAddScoreUser(OrderRespDTO order, ScoreRuleOrderVExtraVO extraInfo, ScoreRuleDO scoreRuleDO) {
private List<Long> getAddScoreUser(Long userId, Long consignorId, Long consigneeId, ScoreRuleOrderVExtraVO extraInfo, ScoreRuleDO scoreRuleDO) {
ArrayList<Long> users = new ArrayList<>();
// 发货人和收货人都要判断给分
Long userId = order.getUserId();
Long consigneeId = order.getOrderConsigneeDO().getCustomerId();
Long consigneeMemberId;
boolean isBackendOrder = userId <= 0;
// 校验订单入口
if (!isOrderEntryValid(extraInfo.getOrderEntry(), isBackendOrder)) {
......@@ -209,7 +207,7 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
}
// 如果是后台下单,重新获取发货人用户ID
if (isBackendOrder) {
userId = getCustomerMemberId(order.getOrderConsignorDO().getCustomerId());
userId = getCustomerMemberId(consignorId);
if (userId == null) {
userId = 0L;
}
......@@ -224,7 +222,12 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
} else {
addValidUser(users, userId);
}
consigneeMemberId = getCustomerMemberId(consigneeId);
// 判断收货人
if (consigneeId == null || consigneeId <= 0) {
return users;
}
Long consigneeMemberId = getCustomerMemberId(consigneeId);
if (consigneeMemberId != null && consigneeMemberId > 0) {
if (consigneeMemberId.equals(userId)) {
log.info("Order in shipping listener: The consignee is the same as the sender, userId:{}", userId);
......@@ -330,11 +333,11 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
int wOrV = weightOrVolume.setScale(0, RoundingMode.HALF_UP).intValue();
ScoreRuleOrderVExtraVO.OrderVRule lastRule = orderVRules.get(orderVRules.size() - 1);
if (wOrV >= lastRule.getHigh()) {
return lastRule.getScore();
return lastRule.getScore() * wOrV;
}
for (ScoreRuleOrderVExtraVO.OrderVRule rule : orderVRules) {
if (rule.getLow() <= wOrV && wOrV < rule.getHigh()) {
return rule.getScore();
return rule.getScore() * wOrV;
}
}
return 0;
......
......@@ -47,7 +47,7 @@ public class RegisterStrategy extends AbstractScoreRuleStrategy {
}
// 校验注册平台
ScoreRuleRegisterExtraVO scoreRuleRegisterExtraVO = JsonUtils.parseObject(scoreRuleDO.getExtra(), ScoreRuleRegisterExtraVO.class);
if (scoreRuleRegisterExtraVO != null && !"2,3".equals(scoreRuleRegisterExtraVO.getRegisterPlatform())) {
if (scoreRuleRegisterExtraVO != null) {
if (!scoreRuleRegisterExtraVO.getRegisterPlatform().contains(String.valueOf(message.getRegisterPlatform()))) {
log.info("Register listener: The register platform does not match,userID:{}", userId);
return;
......
......@@ -34,4 +34,9 @@ public interface ScoreRuleShareRecordService extends IService<ScoreRuleShareReco
* @return 分享记录分页
*/
PageResult<ScoreRuleShareRecordPageVO> getRuleShareRecordPage(ScoreRuleShareRecordQueryVO query);
/**
* 分享规则触发ip校验
*/
boolean verifyTriggerIp(Long userId, Long ruleId, String ipAddr);
}
......@@ -4,14 +4,21 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.module.member.dal.dataobject.ScoreRuleShareRecord.ScoreRuleShareFailTriggerDO;
import cn.iocoder.yudao.module.member.dal.dataobject.ScoreRuleShareRecord.ScoreRuleShareRecordDO;
import cn.iocoder.yudao.module.member.dal.dataobject.scoreLog.MemberUserScoreLogDO;
import cn.iocoder.yudao.module.member.dal.mysql.ScoreRuleShareRecord.ScoreRuleShareFailTriggerMapper;
import cn.iocoder.yudao.module.member.dal.mysql.ScoreRuleShareRecord.ScoreRuleShareRecordMapper;
import cn.iocoder.yudao.module.member.enums.ScoreSourceTypeEnum;
import cn.iocoder.yudao.module.member.service.scoreLog.MemberUserScoreLogService;
import cn.iocoder.yudao.module.member.util.ScoreRuleGenCodeUtils;
import cn.iocoder.yudao.module.member.vo.ScoreRuleShareRecord.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
......@@ -21,12 +28,17 @@ import java.util.List;
*/
@Service
@Validated
@Slf4j
public class ScoreRuleShareRecordServiceImpl extends AbstractService<ScoreRuleShareRecordMapper, ScoreRuleShareRecordDO> implements ScoreRuleShareRecordService {
@Resource
private ScoreRuleShareRecordMapper scoreRuleShareRecordMapper;
@Resource
private ScoreRuleGenCodeUtils scoreRuleGenCodeUtils;
@Resource
private MemberUserScoreLogService logService;
@Resource
private ScoreRuleShareFailTriggerMapper scoreRuleShareFailTriggerMapper;
@Override
public Long createRuleShareRecord(ScoreRuleShareRecordCreateReqVO createReqVO) {
......@@ -55,7 +67,12 @@ public class ScoreRuleShareRecordServiceImpl extends AbstractService<ScoreRuleSh
if (list.isEmpty()) {
return PageResult.empty();
}
list.stream().forEach(item -> {
list.forEach(item -> {
// 有效记录中ip取的是积分记录中的幂等key,需要提取出ip
if (item.getIpAddress().contains("SHARE")) {
String[] split = item.getIpAddress().split("_");
item.setIpAddress(split[split.length - 1]);
}
item.setTypeZh(DictFrameworkUtils.getDictDataFromCache("score_rule_type", item.getType().toString()).getLabel());
item.setTypeEn(DictFrameworkUtils.getDictDataFromCache("score_rule_type", item.getType().toString()).getLabelEn());
});
......@@ -78,4 +95,26 @@ public class ScoreRuleShareRecordServiceImpl extends AbstractService<ScoreRuleSh
int total = scoreRuleShareRecordMapper.countScoreRuleShareRecord(query);
return new PageResult<>(list, total, size, query.getPage(), (total + size - 1) / size);
}
}
@Override
public boolean verifyTriggerIp(Long userId, Long ruleId, String ipAddr) {
// 根据分享人和规则id获取分享记录
ScoreRuleShareRecordDO scoreRuleShareRecordDO = selectOne("member_id", userId, "rule_id", ruleId);
if (scoreRuleShareRecordDO == null) {
log.info("Share listener: The user not share the activity,userId:{},ruleId:{}", userId, ruleId);
return false;
}
String uniqueId = userId + "_" + ruleId + "_" + ipAddr;
MemberUserScoreLogDO memberUserScoreLogDO = logService.getByUniqueId(ScoreSourceTypeEnum.SHARE + "_" + uniqueId);
if (memberUserScoreLogDO != null) {
// 增加触发失败记录
ScoreRuleShareFailTriggerDO failTriggerDO = new ScoreRuleShareFailTriggerDO();
failTriggerDO.setShareRecordId(scoreRuleShareRecordDO.getId());
failTriggerDO.setIpAddress(ipAddr);
failTriggerDO.setTriggerTime(new Date());
scoreRuleShareFailTriggerMapper.insert(failTriggerDO);
return false;
}
return true;
}
}
\ No newline at end of file
......@@ -236,7 +236,7 @@ public class MemberUserServiceImpl implements MemberUserService {
clientInternalMessageApi.createInternalMessage(dto);
//关联或创建后端客户
customerApi.associateCustomerAuto(areacode, mobile, user.getId(), englishName);
customerApi.associateCustomerAuto(areacode, mobile, user.getId(), englishName, user.getCode());
applicationContext.publishEvent(new MemberRegEvent(user.getId()));
......
......@@ -53,4 +53,7 @@ public class ScoreRuleShareRecordDetailVO {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "点击时间")
private Date triggerTime;
@ApiModelProperty(value = "点击ip")
private String ipAddress;
}
......@@ -22,7 +22,7 @@ public class ScoreRuleOrderVExtraVO {
@ApiModelProperty(value = "提货点列表(第一级提货点,第二级国家,城市,仓库id)", required = true)
private List<List<Long>> receiveAddrList;
@ApiModelProperty(value = "渠道,运输方式选择海运时,渠道隐藏,可多选,逗号拼接")
private String channel;
private List<Long> channel;
@ApiModelProperty(value = "积分规则列表", required = true)
private List<OrderVRule> orderVRule;
@ApiModelProperty(value = "订单入口(1后台,2APP,3WEB)可多选,逗号拼", required = true)
......
......@@ -41,6 +41,7 @@
srsr.create_time AS createTime,
msul.score_count AS score,
msul.create_time AS triggerTime,
msul.unique_id AS ipAddress,
mu.nickname AS memberName,
sr.type,
sr.title_zh AS titleZh,
......@@ -55,22 +56,57 @@
AND srsr.id = #{query.id}
</if>
<include refid="shareRecordDetailCondition"/>
order by srsr.create_time desc
<if test="query.id == null and query.relationSymbol == null">
UNION
SELECT
srsr.id,
srsr.code,
srsr.create_time AS createTime,
0 AS score,
srsf.trigger_time AS triggerTime,
srsf.ip_address AS ipAddress,
mu.nickname AS memberName,
sr.type,
sr.title_zh AS titleZh,
sr.title_en AS titleEn
FROM
score_rule_share_fail_trigger srsf
LEFT JOIN score_rule_share_record srsr ON srsf.share_record_id = srsr.id
LEFT JOIN member_user mu ON srsr.member_id = mu.id
LEFT JOIN score_rule sr ON srsr.rule_id = sr.id
where srsr.deleted = 0
<include refid="shareRecordDetailCondition"/>
</if>
order by createTime desc, triggerTime desc
limit #{start}, #{size}
</select>
<select id="countScoreRuleShareRecordDetail" resultType="java.lang.Integer">
SELECT
count(*)
FROM
member_user_score_log msul
LEFT JOIN score_rule_share_record srsr ON msul.member_id = srsr.member_id AND msul.rule_id = srsr.rule_id
LEFT JOIN member_user mu ON srsr.member_id = mu.id
LEFT JOIN score_rule sr ON srsr.rule_id = sr.id
where srsr.deleted = 0
<if test="query.id != null">
AND srsr.id = #{query.id}
</if>
<include refid="shareRecordDetailCondition"/>
FROM (
SELECT srsr.id
FROM member_user_score_log msul
LEFT JOIN score_rule_share_record srsr ON msul.member_id = srsr.member_id AND msul.rule_id = srsr.rule_id
LEFT JOIN member_user mu ON srsr.member_id = mu.id
LEFT JOIN score_rule sr ON srsr.rule_id = sr.id
where srsr.deleted = 0
<if test="query.id != null">
AND srsr.id = #{query.id}
</if>
<include refid="shareRecordDetailCondition"/>
<if test="query.id == null and query.relationSymbol == null">
UNION ALL
SELECT srsr.id
FROM score_rule_share_fail_trigger srsf
LEFT JOIN score_rule_share_record srsr ON srsf.share_record_id = srsr.id
LEFT JOIN member_user mu ON srsr.member_id = mu.id
LEFT JOIN score_rule sr ON srsr.rule_id = sr.id
where srsr.deleted = 0
<include refid="shareRecordDetailCondition"/>
</if>
) subquery
</select>
<select id="getCurrentMaxShareRecordCode" resultType="java.lang.String">
SELECT code FROM score_rule_share_record ORDER BY code desc LIMIT 1
......
......@@ -516,7 +516,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
// 如果客户联系人为空,则创建新的客户信息,重新查询
customerApi.associateCustomerAuto(memberUserDO.getAreaCode(),
memberUserDO.getMobile(), memberUserDO.getId(),
memberUserDO.getNickname());
memberUserDO.getNickname(), memberUserDO.getCode());
customerContacts = customerContactsService.getOne(new LambdaQueryWrapper<CustomerContactsDO>()
.and(we -> we.eq(CustomerContactsDO::getUserid, memberUserDO.getId())
.or()
......@@ -3090,7 +3090,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderConsignorDO.setUpdater(updater);
if (Objects.isNull(customerContacts)) {
// 如果客户联系人为空,则创建新的客户信息,重新查询
customerApi.associateCustomerAuto(memberUserDO.getAreaCode(), memberUserDO.getMobile(), memberUserDO.getId(), memberUserDO.getNickname());
customerApi.associateCustomerAuto(memberUserDO.getAreaCode(), memberUserDO.getMobile(), memberUserDO.getId(), memberUserDO.getNickname(), memberUserDO.getCode());
customerContacts = customerContactsService.getOne(new LambdaQueryWrapper<CustomerContactsDO>()
.and(we -> we.eq(CustomerContactsDO::getUserid, memberUserDO.getId())
.or()
......
......@@ -6,7 +6,6 @@ import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.apollo.core.event.BoxCheckOrderSchedulingEvent;
import cn.iocoder.yudao.framework.apollo.core.event.Order.CalculateOrderVValueEvent;
import cn.iocoder.yudao.framework.apollo.core.event.QueryChannelInfoEvent;
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
......@@ -1220,7 +1219,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
orderItemDOList,
isNotRollbackIn, orderWarehouseInDOList,
zhongPaoBest,
channelPackagingOverWeightAdditionalBoList);
channelPackagingOverWeightAdditionalBoList, false);
if (CollectionUtil.isNotEmpty(channelPackagingOverWeightAdditionalBoList)) {
channelPackagingOverWeightAdditionalBoList =
......@@ -1903,7 +1902,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
private void processOrderItemException(Long orderId, OrderDO orderDO, List<OrderItemDO> orderItemDOList,
boolean isNotRollbackIn, List<OrderWarehouseInDO> orderWarehouseInDOList, ZhongPaoBestVO zhongPaoBest,
List<ChannelPackagingOverWeightAdditionalBo> channelPackagingOverWeightAdditionalBoList) {
List<ChannelPackagingOverWeightAdditionalBo> channelPackagingOverWeightAdditionalBoList, boolean isFinishStocked) {
// 处理异常
for (OrderItemDO orderItemDO : orderItemDOList) {
......@@ -1934,8 +1933,10 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// orderItem 设置warehouseInInfoVo
WarehouseInInfoVO warehouseInInfoVO = this.orderItemSetWarehouseInInfoVO(orderItemDO, orderWarehouseInDOListFilter);
// 处理空运订单 商品重量超限异常 和 商品路线重量超限异常
this.processAirOrderOverWeightException(orderId, orderDO, orderItemDO, warehouseInInfoVO, channelPackagingOverWeightAdditionalBoList);
// 处理空运订单 商品重量超限异常 和 商品路线重量超限异常 (完成入仓时才需要,备货完成时不需要处理)
if (!isFinishStocked) {
this.processAirOrderOverWeightException(orderId, orderDO, orderItemDO, warehouseInInfoVO, channelPackagingOverWeightAdditionalBoList);
}
this.setOrderItemZhongPao(zhongPaoBest, orderItemDO, warehouseInInfoVO.getWeight(), warehouseInInfoVO.getVolume());
......@@ -4727,7 +4728,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
ZhongPaoBestVO zhongPaoBest = getZhongPaoBest(orderDO);
// 根据订单项产生异常,多箱,少箱,新增商品异常,入仓特性不符异常
processOrderItemException(orderId, orderDO, orderItemDOList, isNotRollbackIn, orderWarehouseInDOList, zhongPaoBest, channelPackagingOverWeightAdditionalBoList);
processOrderItemException(orderId, orderDO, orderItemDOList, isNotRollbackIn, orderWarehouseInDOList, zhongPaoBest, channelPackagingOverWeightAdditionalBoList, true);
if (CollectionUtil.isNotEmpty(channelPackagingOverWeightAdditionalBoList)) {
channelPackagingOverWeightAdditionalBoList = channelPackagingOverWeightAdditionalBoList.stream().filter(t -> !t.isMerged()).collect(Collectors.toList());
......
......@@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
......@@ -65,6 +66,8 @@ public class AppRedeemRewardController {
@Idempotent(timeout = 5)
//@PreAuthenticated
public CommonResult<Boolean> redeemReward(@Valid @RequestBody AppRedeemRewardReqVO redeemRewardReqVO) {
// APP/WEB兑换设置兑换时间
redeemRewardReqVO.setRedemptionTime(new Date());
return success(redeemRewardApi.redeemReward(redeemRewardReqVO));
}
@PostMapping("/send-sms-code")
......
......@@ -15,6 +15,7 @@ import cn.iocoder.yudao.module.ecw.api.express.dto.ExpressRespDTO;
import cn.iocoder.yudao.module.member.api.score.MemberUserScoreApi;
import cn.iocoder.yudao.module.member.api.score.dto.MemberUserScoreOperateReqDTO;
import cn.iocoder.yudao.module.member.api.score.dto.ReleationScoreExpireInfoDTO;
import cn.iocoder.yudao.module.member.enums.PlatformTypeEnum;
import cn.iocoder.yudao.module.member.enums.ScoreSourceTypeEnum;
import cn.iocoder.yudao.module.reward.controller.app.redeem.vo.AppRewardRedeemListRespVO;
import cn.iocoder.yudao.module.reward.dal.dataobject.redeem.RewardRedeemDO;
......@@ -80,6 +81,11 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper,
int start = (reqVO.getPageNo() - 1) * reqVO.getPageSize();
int size = reqVO.getPageSize();
List<RewardRedeemPageRespVO> result = rewardRedeemMapper.pageInfo(start, size, reqVO);
result.forEach(respVO -> {
if (respVO.getEntrance() != PlatformTypeEnum.BACKEND.getValue()) {
respVO.setCreatorName(respVO.getMemberNameZh());
}
});
int total = rewardRedeemMapper.pageCount(reqVO);
return new PageResult<>(result, total, reqVO.getPageSize(), reqVO.getPageNo(), (total + reqVO.getPageSize() - 1) / reqVO.getPageSize());
}
......@@ -159,7 +165,7 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper,
if (CollectionUtils.isEmpty(request.getIds())) {
throw exception(ErrorCodeConstants.REWARD_REDEEM_NOT_EXIST);
}
List<Long> errorIds = checkBatchVerifyParam(request);
List<String> errorIds = checkBatchVerifyParam(request);
if (CollectionUtils.isNotEmpty(errorIds)) {
throw exception(ErrorCodeConstants.REWARD_REDEEM_BATCH_VERIFY_ERROR, errorIds);
}
......@@ -407,13 +413,13 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper,
return failedInfoMap;
}
private List<Long> checkBatchVerifyParam(RewardRedeemBatchVerifyReqVO request) {
private List<String> checkBatchVerifyParam(RewardRedeemBatchVerifyReqVO request) {
LambdaUpdateWrapper<RewardRedeemDO> wrapper = Wrappers.lambdaUpdate();
wrapper.in(RewardRedeemDO::getId, request.getIds());
Map<Long, RewardRedeemDO> idRewardRedeemMap = this.list(wrapper).stream()
.collect(Collectors.toMap(RewardRedeemDO::getId, Function.identity(), (c1, c2) -> c1));
return idRewardRedeemMap.keySet().stream().filter(id -> {
RewardRedeemDO rewardRedeemDO = idRewardRedeemMap.get(id);
Map<String, RewardRedeemDO> idRewardRedeemMap = this.list(wrapper).stream()
.collect(Collectors.toMap(RewardRedeemDO::getRedemptionNumber, Function.identity(), (c1, c2) -> c1));
return idRewardRedeemMap.keySet().stream().filter(coder -> {
RewardRedeemDO rewardRedeemDO = idRewardRedeemMap.get(coder);
if (rewardRedeemDO == null) {
return true;
}
......
......@@ -1433,7 +1433,7 @@ public class OfferServiceImpl extends AbstractService<OfferMapper, OfferDO> impl
customerContactsDOList = customerContactsService.getByPhone(userRespDTO.getAreaCode(), userRespDTO.getMobile());
// 当此客户端用户不存在绑定的有效客户信息时需要去关联创建
if (CollectionUtil.isEmpty(customerContactsDOList) || customerContactsDOList.size() == 0) {
customerApi.associateCustomerAuto(userRespDTO.getAreaCode(), userRespDTO.getMobile(), userRespDTO.getId(), userRespDTO.getNickname());
customerApi.associateCustomerAuto(userRespDTO.getAreaCode(), userRespDTO.getMobile(), userRespDTO.getId(), userRespDTO.getNickname(), userRespDTO.getCode());
customerContactsDOList = customerContactsService.getByMemberUserId(loginUser.getId());
} else {
customerContactsService.update(new LambdaUpdateWrapper<CustomerContactsDO>()
......
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