mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-22 12:05:05 +08:00
update会员计费模板
This commit is contained in:
@@ -80,4 +80,10 @@ public interface MemberGroupMapper {
|
||||
List<MemberVO> queryMemberList(@Param("groupCode") String groupCode);
|
||||
|
||||
MemberGroup selectByGroupCode(String groupCode);
|
||||
|
||||
MemberGroupVO queryByStationId(String stationId);
|
||||
|
||||
MemberGroupVO queryByMerchantId(String merchantId);
|
||||
|
||||
MemberDiscountVO queryMemberDiscountV2(@Param("groupCode") String groupCode, @Param("memberId") String memberId);
|
||||
}
|
||||
|
||||
@@ -74,4 +74,20 @@ public interface MemberGroupService {
|
||||
|
||||
List<MemberVO> queryMemberList(MemberGroupDTO dto);
|
||||
|
||||
MemberGroupVO queryByMerchantId(String merchantId);
|
||||
|
||||
/**
|
||||
* 通过站点id查询当前站点是否配置集团
|
||||
* @param stationId 站点信息
|
||||
* @return
|
||||
*/
|
||||
MemberGroupVO queryByStationId(String stationId);
|
||||
|
||||
/**
|
||||
* 添加会员到集团
|
||||
* 如果该站点配置的有集团,就把会员自动加入到集团中
|
||||
* 目前只有汇鑫大厦使用
|
||||
* @return
|
||||
*/
|
||||
int addMember2MemberGroup(String memberId, String stationId);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.jsowell.pile.service.impl;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.jsowell.common.enums.DelFlagEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.SecurityUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
@@ -90,6 +91,11 @@ public class MemberGroupServiceImpl implements MemberGroupService {
|
||||
*/
|
||||
@Override
|
||||
public int insertMemberGroup(MemberGroup memberGroup) {
|
||||
String merchantId = memberGroup.getMerchantId();
|
||||
MemberGroupVO memberGroupVO = queryByMerchantId(merchantId);
|
||||
if (memberGroupVO != null) {
|
||||
throw new BusinessException("", "该运营商已经创建过集团");
|
||||
}
|
||||
// 生成编号
|
||||
memberGroup.setGroupCode(generateGroupCode());
|
||||
memberGroup.setCreateTime(DateUtils.getNowDate());
|
||||
@@ -107,14 +113,14 @@ public class MemberGroupServiceImpl implements MemberGroupService {
|
||||
return memberGroupMapper.insertMemberGroup(memberGroup);
|
||||
}
|
||||
|
||||
private boolean isBetween(BigDecimal price){
|
||||
private boolean isBetween(BigDecimal price) {
|
||||
BigDecimal start = BigDecimal.ZERO;
|
||||
BigDecimal end = BigDecimal.TEN;
|
||||
return isBetween(price, start, end);
|
||||
}
|
||||
|
||||
private boolean isBetween(BigDecimal price, BigDecimal start, BigDecimal end){
|
||||
return price.compareTo(start) > 0 && price.compareTo(end) < 0;
|
||||
private boolean isBetween(BigDecimal source, BigDecimal start, BigDecimal end) {
|
||||
return source.compareTo(start) > 0 && source.compareTo(end) < 0;
|
||||
}
|
||||
|
||||
// 生成编号
|
||||
@@ -131,6 +137,7 @@ public class MemberGroupServiceImpl implements MemberGroupService {
|
||||
|
||||
/**
|
||||
* 根据会员组编号查询
|
||||
*
|
||||
* @param groupCode
|
||||
* @return
|
||||
*/
|
||||
@@ -181,6 +188,11 @@ public class MemberGroupServiceImpl implements MemberGroupService {
|
||||
return MemberDiscountVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 后管保存集团会员关系
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int addMember(MemberGroupDTO dto) {
|
||||
String groupCode = dto.getGroupCode();
|
||||
@@ -193,15 +205,51 @@ public class MemberGroupServiceImpl implements MemberGroupService {
|
||||
return 0;
|
||||
}
|
||||
// 查询会员id
|
||||
String phoneNumber = dto.getPhoneNumber();
|
||||
String firstLevelMerchantId = pileMerchantInfoService.getFirstLevelMerchantIdByMerchantId(memberGroup.getMerchantId());
|
||||
MemberBasicInfo memberBasicInfo = memberBasicInfoService.selectInfoByMobileNumber(phoneNumber, firstLevelMerchantId);
|
||||
MemberBasicInfo memberBasicInfo = memberBasicInfoService.selectInfoByMobileNumber(dto.getPhoneNumber(), firstLevelMerchantId);
|
||||
if (memberBasicInfo == null) {
|
||||
return 0;
|
||||
}
|
||||
// 校验通过,关系存入数据库
|
||||
return saveMemberGroupRelation(memberBasicInfo.getMemberId(), groupCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单保存集团会员关系
|
||||
* @param memberId 会员id
|
||||
* @param merchantId 运营商id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int addMember2MemberGroup(String memberId, String merchantId) {
|
||||
log.info("添加会员id:{}, 到运营商:{}的集团中", memberId, merchantId);
|
||||
// 查询该站点有没有集团信息
|
||||
MemberGroupVO memberGroupVO = queryByMerchantId(merchantId);
|
||||
if (memberGroupVO == null) {
|
||||
return 0;
|
||||
}
|
||||
// 检查memberId是否在集团中
|
||||
MemberDiscountVO vo = memberGroupMapper.queryMemberDiscountV2(memberGroupVO.getGroupCode(), memberId);
|
||||
if (vo == null) {
|
||||
// 校验通过,关系存入数据库 加入到集团
|
||||
return saveMemberGroupRelation(memberId, memberGroupVO.getGroupCode());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员与集团的关系保存到数据库
|
||||
* @param memberId 会员id
|
||||
* @param groupCode 集团编号
|
||||
* @return
|
||||
*/
|
||||
private int saveMemberGroupRelation(String memberId, String groupCode) {
|
||||
if (StringUtils.isBlank(memberId) || StringUtils.isBlank(groupCode)) {
|
||||
return 0;
|
||||
}
|
||||
// 校验通过,关系存入数据库 加入到集团
|
||||
MemberGroupRelation relation = new MemberGroupRelation();
|
||||
relation.setMemberId(memberBasicInfo.getMemberId());
|
||||
relation.setMemberId(memberId);
|
||||
relation.setGroupCode(groupCode);
|
||||
relation.setCreateTime(DateUtils.getNowDate());
|
||||
relation.setDelFlag(DelFlagEnum.NORMAL.getValue());
|
||||
@@ -214,4 +262,14 @@ public class MemberGroupServiceImpl implements MemberGroupService {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemberGroupVO queryByMerchantId(String merchantId) {
|
||||
return memberGroupMapper.queryByMerchantId(merchantId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemberGroupVO queryByStationId(String stationId) {
|
||||
return memberGroupMapper.queryByStationId(stationId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -774,6 +774,19 @@ public abstract class AbstractProgramLogic implements InitializingBean {
|
||||
orderBasicInfo.getOrderCode(), memberId, discountAmount, discountElectricityAmount, discountServiceAmount, totalConsumeAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算订单折扣V2
|
||||
* 使用优惠计费模板计算优惠金额
|
||||
* @param orderBasicInfo 订单主表
|
||||
* @param orderDetail 订单详情
|
||||
*/
|
||||
protected void calculateOrderDiscountsV2(OrderBasicInfo orderBasicInfo, OrderDetail orderDetail) {
|
||||
String memberId = orderBasicInfo.getMemberId(); // 会员id
|
||||
String stationId = orderBasicInfo.getStationId(); // 站点id
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算余额支付下发金额
|
||||
*/
|
||||
|
||||
@@ -33,4 +33,10 @@ public class MemberDiscountVO {
|
||||
|
||||
/** 折扣率 */
|
||||
private BigDecimal discount;
|
||||
|
||||
/**
|
||||
* 优惠计费模板
|
||||
*/
|
||||
private BillingTemplateVO billingTemplateVO;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.jsowell.pile.vo.web;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class MemberGroupInfoVO {
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 会员组编号
|
||||
*/
|
||||
private String groupCode;
|
||||
|
||||
/**
|
||||
* 运营商id
|
||||
*/
|
||||
private String merchantId;
|
||||
|
||||
/**
|
||||
* 站点id
|
||||
*/
|
||||
private String stationId;
|
||||
|
||||
/**
|
||||
* 优惠计费模板
|
||||
*/
|
||||
private Map<String, Object> billingTemplateMap;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user