Compare commits
55 Commits
eb6bfec709
...
main-cx
| Author | SHA1 | Date | |
|---|---|---|---|
| 565c82305c | |||
| 6e329f4226 | |||
| fdec029158 | |||
|
|
dab9156c8f | ||
|
|
419f7c9886 | ||
| 153dc8751e | |||
| 0a2e13c428 | |||
| 39553dd80e | |||
| 873360a300 | |||
| d2b590a414 | |||
| 46c7576ba9 | |||
| ac6ad6533a | |||
| 13374f4249 | |||
| 3e6b15eade | |||
| 6939311e6f | |||
| 88d7814ad4 | |||
| 416f1d4558 | |||
| 24c4d039b4 | |||
| 9fa3789b8e | |||
| c4cb4a5a4a | |||
| 5c5a9cba80 | |||
| 9b6a3a3fdb | |||
| 6225d23311 | |||
| 10d3387b91 | |||
| 246785dfd8 | |||
| 4dd372831b | |||
| 68a2e24223 | |||
| d1c461e02d | |||
| c572ec0f84 | |||
| 305497c55f | |||
| 6ed1e2ebda | |||
| 0b4ce84d7f | |||
| 72a723a7f1 | |||
| dddb336586 | |||
| 5f49434239 | |||
| 5bd4ab7d2e | |||
| 4edd8ea7e5 | |||
| 2b5f4c3c5e | |||
| 5b8eef7bd2 | |||
| edb449a1ec | |||
| df3f042b2c | |||
| b594007638 | |||
| dfba7801e2 | |||
| de23604153 | |||
| c18db6ffd3 | |||
| 7cd193f8a2 | |||
| 2a009e9037 | |||
| 09e716df0c | |||
| f7d4349bdb | |||
| 0b2d5f65f6 | |||
| 6da09d93fd | |||
| 59c83b2fbb | |||
| d781eaa358 | |||
| 23205f1142 | |||
| 48f6dd405b |
@@ -66,6 +66,7 @@
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
<version>1.18.20</version>
|
||||
</dependency>
|
||||
|
||||
<!-- poi excel -->
|
||||
@@ -95,7 +96,8 @@
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
@@ -69,4 +69,9 @@ public interface PmsProductService {
|
||||
* 根据商品名称或者货号模糊查询
|
||||
*/
|
||||
List<PmsProduct> list(String keyword);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,4 +13,6 @@ public interface UmsMemberLevelService {
|
||||
* @param defaultStatus 是否为默认会员
|
||||
*/
|
||||
List<UmsMemberLevel> list(Integer defaultStatus);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.buy507.mall.mapper.UmsMemberAccountTransactionMapper;
|
||||
import com.buy507.mall.model.*;
|
||||
import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
|
||||
import org.apache.poi.hssf.usermodel.HSSFRow;
|
||||
@@ -24,10 +27,6 @@ import com.buy507.mall.dto.MemberWithdrawApplyResult;
|
||||
import com.buy507.mall.mapper.DmsMemberTradeRecordMapper;
|
||||
import com.buy507.mall.mapper.DmsMemberWithdrawApplyMapper;
|
||||
import com.buy507.mall.mapper.UmsMemberMapper;
|
||||
import com.buy507.mall.model.DmsMemberTradeRecord;
|
||||
import com.buy507.mall.model.DmsMemberWithdrawApply;
|
||||
import com.buy507.mall.model.ItemType;
|
||||
import com.buy507.mall.model.UmsMember;
|
||||
import com.buy507.mall.service.DmsMemberWithdrawApplyService;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
|
||||
@@ -48,6 +47,9 @@ public class DmsMemberWithdrawApplyServiceImpl implements DmsMemberWithdrawApply
|
||||
|
||||
@Autowired
|
||||
private RedisLock redisLock;
|
||||
|
||||
@Autowired
|
||||
private UmsMemberAccountTransactionMapper accountTransactionMapper;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -88,6 +90,15 @@ public class DmsMemberWithdrawApplyServiceImpl implements DmsMemberWithdrawApply
|
||||
member = memberMapper.selectByPrimaryKey(member.getId());
|
||||
member.setFreeze(member.getFreeze().subtract(withdrawApply.getValue())); //修改冻结值
|
||||
memberMapper.updateByPrimaryKey(member);
|
||||
|
||||
// 写入会员流水记录表
|
||||
UmsMemberAccountTransaction memberTransaction = new UmsMemberAccountTransaction();
|
||||
memberTransaction.setMemberId(member.getId());
|
||||
memberTransaction.setRevenueAmount(withdrawApply.getValue()); // 提现金额
|
||||
memberTransaction.setRemarks("提现"); // 备注
|
||||
memberTransaction.setCreateTime(DateUtil.date()); // 提现时间
|
||||
accountTransactionMapper.insert(memberTransaction); // 保存流水记录
|
||||
|
||||
redisLock.unlock(String.valueOf(member.getId()), String.valueOf(time));
|
||||
break;
|
||||
}
|
||||
@@ -95,7 +106,7 @@ public class DmsMemberWithdrawApplyServiceImpl implements DmsMemberWithdrawApply
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.buy507.mall.service.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.buy507.mall.component.RedisLock;
|
||||
import com.buy507.mall.dao.*;
|
||||
import com.buy507.mall.dto.PmsProductParam;
|
||||
@@ -9,6 +8,7 @@ import com.buy507.mall.dto.PmsProductResult;
|
||||
import com.buy507.mall.mapper.*;
|
||||
import com.buy507.mall.model.*;
|
||||
import com.buy507.mall.service.PmsProductService;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -84,7 +84,8 @@ public class PmsProductServiceImpl implements PmsProductService {
|
||||
log.info("b"+String.valueOf(productParam.getProductAttributeCategoryId()));
|
||||
log.info("c"+String.valueOf(product.getProductCategoryId()));
|
||||
log.info("d"+String.valueOf(product.getProductAttributeCategoryId()));
|
||||
productMapper.insertSelective(product);
|
||||
product.setOriginalPrice(productParam.getPrice());
|
||||
productMapper.insertAll(product);
|
||||
//根据促销类型设置价格:、阶梯价格、满减价格
|
||||
Long productId = product.getId();
|
||||
//会员价格
|
||||
@@ -264,6 +265,7 @@ public class PmsProductServiceImpl implements PmsProductService {
|
||||
return productMapper.updateByExampleSelective(record, example);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int updateDeleteStatus(List<Long> ids, Integer deleteStatus) {
|
||||
PmsProduct record = new PmsProduct();
|
||||
@@ -273,6 +275,7 @@ public class PmsProductServiceImpl implements PmsProductService {
|
||||
return productMapper.updateByExampleSelective(record, example);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<PmsProduct> list(String keyword) {
|
||||
PmsProductExample productExample = new PmsProductExample();
|
||||
@@ -285,6 +288,8 @@ public class PmsProductServiceImpl implements PmsProductService {
|
||||
return productMapper.selectByExample(productExample);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated 旧版创建
|
||||
*/
|
||||
|
||||
@@ -43,7 +43,13 @@
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.15</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.30</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -27,4 +27,6 @@ public interface OmsOrderItemMapper {
|
||||
int updateByPrimaryKeySelective(OmsOrderItem record);
|
||||
|
||||
int updateByPrimaryKey(OmsOrderItem record);
|
||||
|
||||
OmsOrderItem selectByOrderId(Long orderId);
|
||||
}
|
||||
@@ -3,7 +3,11 @@ package com.buy507.mall.mapper;
|
||||
import com.buy507.mall.model.OmsOrder;
|
||||
import com.buy507.mall.model.OmsOrderExample;
|
||||
import java.util.List;
|
||||
|
||||
import com.buy507.mall.model.PmsProduct;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
|
||||
public interface OmsOrderMapper {
|
||||
long countByExample(OmsOrderExample example);
|
||||
@@ -27,4 +31,6 @@ public interface OmsOrderMapper {
|
||||
int updateByPrimaryKeySelective(OmsOrder record);
|
||||
|
||||
int updateByPrimaryKey(OmsOrder record);
|
||||
}
|
||||
|
||||
|
||||
PmsProduct selectAll(@Param("orderSn") String orderSn);}
|
||||
@@ -7,6 +7,7 @@ import com.buy507.mall.model.PmsProductFullReduction;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
public interface PmsProductMapper {
|
||||
long countByExample(PmsProductExample example);
|
||||
@@ -23,7 +24,9 @@ public interface PmsProductMapper {
|
||||
|
||||
List<PmsProduct> selectByExample(PmsProductExample example);
|
||||
|
||||
// @Select("select * from pms_product where id = #{id}")
|
||||
PmsProduct selectByPrimaryKey(Long id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") PmsProduct record, @Param("example") PmsProductExample example);
|
||||
|
||||
int updateByExampleWithBLOBs(@Param("record") PmsProduct record, @Param("example") PmsProductExample example);
|
||||
@@ -37,6 +40,11 @@ public interface PmsProductMapper {
|
||||
int updateByPrimaryKey(PmsProduct record);
|
||||
|
||||
PmsProduct getProductInfoById(Long id);
|
||||
|
||||
|
||||
|
||||
PmsProduct getProductByOrderSn(String orderSn);
|
||||
|
||||
PmsProduct getPrimaryKey(Long id);
|
||||
|
||||
|
||||
int insertAll(PmsProduct product);
|
||||
}
|
||||
@@ -29,4 +29,5 @@ public interface PmsSkuStockMapper {
|
||||
int updateByPrimaryKey(PmsSkuStock record);
|
||||
|
||||
List<PmsSkuStock> getPmsSkuStock(Long id);
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.buy507.mall.model.SmsHomeNewProduct;
|
||||
import com.buy507.mall.model.SmsHomeNewProductExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
public interface SmsHomeNewProductMapper {
|
||||
long countByExample(SmsHomeNewProductExample example);
|
||||
@@ -27,4 +28,5 @@ public interface SmsHomeNewProductMapper {
|
||||
int updateByPrimaryKeySelective(SmsHomeNewProduct record);
|
||||
|
||||
int updateByPrimaryKey(SmsHomeNewProduct record);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.buy507.mall.mapper;
|
||||
|
||||
import com.buy507.mall.model.UmsDevelopmentFund;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author curry
|
||||
* @description 针对表【ums_development_fund(发展基金流水)】的数据库操作Mapper
|
||||
* @createDate 2025-02-17 13:41:58
|
||||
* @Entity com.buy507.mall.model.UmsDevelopmentFund
|
||||
*/
|
||||
public interface UmsDevelopmentFundMapper {
|
||||
|
||||
/**
|
||||
* 查询现金总和
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT cash_total FROM ums_development_fund")
|
||||
BigDecimal getTotalCash();
|
||||
|
||||
/**
|
||||
* 查询积分总和
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT points_total FROM ums_development_fund")
|
||||
Integer getTotalPoints();
|
||||
|
||||
|
||||
/**
|
||||
* 更新积分
|
||||
* @param fundPoints
|
||||
*/
|
||||
@Update("update ums_development_fund set points_total = points_total + #{fundPoints}")
|
||||
void updatePoints(int fundPoints);
|
||||
|
||||
/**
|
||||
* 更新现金
|
||||
* @param fundCash
|
||||
*/
|
||||
@Update("update ums_development_fund set cash_total = cash_total + #{fundCash}")
|
||||
void updateCash(BigDecimal fundCash);
|
||||
|
||||
/**
|
||||
* 发展基金
|
||||
* @return
|
||||
*/
|
||||
@Select("select id, cash_total, points_total, updated_at from ums_development_fund")
|
||||
UmsDevelopmentFund selectAll();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -27,5 +27,9 @@ public interface UmsMemberMapper {
|
||||
int updateByPrimaryKeySelective(UmsMember record);
|
||||
|
||||
int updateByPrimaryKey(UmsMember record);
|
||||
|
||||
|
||||
/**
|
||||
*修改用户会员等级
|
||||
*/
|
||||
int upgradeMember(@Param("memberId") Long memberId, @Param("newMemberLevelId") Long newMemberLevelId);
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.buy507.mall.model.UmsMemberRelationTree;
|
||||
import com.buy507.mall.model.UmsMemberRelationTreeExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
public interface UmsMemberRelationTreeMapper {
|
||||
long countByExample(UmsMemberRelationTreeExample example);
|
||||
@@ -27,4 +28,7 @@ public interface UmsMemberRelationTreeMapper {
|
||||
int updateByPrimaryKeySelective(UmsMemberRelationTree record);
|
||||
|
||||
int updateByPrimaryKey(UmsMemberRelationTree record);
|
||||
|
||||
@Select("select * from ums_member_relation_tree where member_id = #{currentUserId}")
|
||||
UmsMemberRelationTree findByMemberId(Long currentUserId);
|
||||
}
|
||||
@@ -7,15 +7,16 @@ package com.buy507.mall.model;
|
||||
*/
|
||||
public enum MemberLevel {
|
||||
/**普通用户**/
|
||||
Member(0),
|
||||
Member(1),
|
||||
/**vip会员**/
|
||||
Consumer(1),
|
||||
Consumer(2),
|
||||
/**店长**/
|
||||
Partner(2),
|
||||
Partner(3),
|
||||
/**代理**/
|
||||
Diamond(3),
|
||||
Diamond(4),
|
||||
/** 市代 **/
|
||||
OneDiamond(4),
|
||||
OneDiamond(5),
|
||||
|
||||
TwoDiamond(6), //中级合作商
|
||||
ThreeDiamond(7), //高级合作商
|
||||
FourDiamond(8); //特级合作商
|
||||
|
||||
@@ -45,7 +45,7 @@ public class OmsOrder implements Serializable {
|
||||
@ApiModelProperty(value = "管理员后台调整订单使用的折扣金额")
|
||||
private BigDecimal discountAmount;
|
||||
|
||||
@ApiModelProperty(value = "支付方式:0->未支付;1->支付宝;2->微信;3->线下支付")
|
||||
@ApiModelProperty(value = "支付方式:0->未支付;1->支付宝;2->微信;3->线下支付;4->积分支付;5—>余额支付")
|
||||
private Integer payType;
|
||||
|
||||
@ApiModelProperty(value = "订单来源:0->PC订单;1->app订单")
|
||||
@@ -54,7 +54,7 @@ public class OmsOrder implements Serializable {
|
||||
@ApiModelProperty(value = "订单状态:0->待付款;1->待发货;2->已发货;3->已完成;4->已关闭;5->无效订单")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "订单类型:0->正常订单;1->秒杀订单")
|
||||
@ApiModelProperty(value = "订单类型:0->正常订单;1->秒杀订单;3->虚拟订单")
|
||||
private Integer orderType;
|
||||
|
||||
@ApiModelProperty(value = "提货方式:0->自提;1->物流")
|
||||
|
||||
@@ -62,13 +62,15 @@ public class OmsOrderItem implements Serializable {
|
||||
@ApiModelProperty(value = "该商品经过优惠后的分解金额")
|
||||
private BigDecimal realAmount;
|
||||
|
||||
private Integer giftIntegration;
|
||||
private BigDecimal giftIntegration;
|
||||
|
||||
private Integer giftGrowth;
|
||||
|
||||
@ApiModelProperty(value = "商品销售属性:[{'key':'颜色','value':'颜色'},{'key':'容量','value':'4G'}]")
|
||||
private String productAttr;
|
||||
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Long getId() {
|
||||
@@ -239,11 +241,11 @@ public class OmsOrderItem implements Serializable {
|
||||
this.realAmount = realAmount;
|
||||
}
|
||||
|
||||
public Integer getGiftIntegration() {
|
||||
public BigDecimal getGiftIntegration() {
|
||||
return giftIntegration;
|
||||
}
|
||||
|
||||
public void setGiftIntegration(Integer giftIntegration) {
|
||||
public void setGiftIntegration(BigDecimal giftIntegration) {
|
||||
this.giftIntegration = giftIntegration;
|
||||
}
|
||||
|
||||
|
||||
@@ -157,8 +157,7 @@ public class PmsProduct implements Serializable {
|
||||
|
||||
@Transient
|
||||
private SmsCoupon smsCoupon;
|
||||
|
||||
|
||||
|
||||
@ApiModelProperty(value = "评论信息")
|
||||
@Transient
|
||||
private List<PmsComment> pmsComment;
|
||||
@@ -174,9 +173,25 @@ public class PmsProduct implements Serializable {
|
||||
@Transient
|
||||
@ApiModelProperty(value = "好评比例")
|
||||
private PmsComment commentBiLi;
|
||||
|
||||
|
||||
|
||||
@Transient
|
||||
@ApiModelProperty(value = "会员专区状态")
|
||||
private Integer vipStatus;
|
||||
|
||||
@Transient
|
||||
@ApiModelProperty(value = "积分专区状态")
|
||||
private Integer pointsAreaStatus;
|
||||
|
||||
@Transient
|
||||
@ApiModelProperty(value = "积分兑换专区状态")
|
||||
private Integer pointsExchangeStatus;
|
||||
|
||||
@ApiModelProperty(value = "会员中心:1->店长; 2->代理; 3->市代理")
|
||||
private Integer vipCenter;
|
||||
|
||||
@ApiModelProperty(value = "商品积分价格")
|
||||
private Integer intergrationPrice;
|
||||
|
||||
|
||||
public List<PmsProductAttribute> getProductAttribute() {
|
||||
return productAttribute;
|
||||
@@ -618,6 +633,41 @@ public class PmsProduct implements Serializable {
|
||||
this.distributionFlag = distributionFlag;
|
||||
}
|
||||
|
||||
public Integer getVipStatus() {
|
||||
return vipStatus;
|
||||
}
|
||||
|
||||
public void setVipStatus(Integer vipStatus) {
|
||||
this.vipStatus = vipStatus;
|
||||
}
|
||||
|
||||
|
||||
public Integer getPointsAreaStatus() {
|
||||
return pointsAreaStatus;
|
||||
}
|
||||
|
||||
public void setPointsAreaStatus(Integer pointsAreaStatus) {
|
||||
this.pointsAreaStatus = pointsAreaStatus;
|
||||
}
|
||||
|
||||
|
||||
public Integer getPointsExchangeStatus() {
|
||||
return pointsExchangeStatus;
|
||||
}
|
||||
|
||||
|
||||
public void setPointsExchangeStatus(Integer pointsExchangeStatus) {
|
||||
this.pointsExchangeStatus = pointsExchangeStatus;
|
||||
}
|
||||
|
||||
public Integer getVipCenter () {return vipCenter;}
|
||||
|
||||
public void setVipCenter(Integer vipCenter) {this.vipCenter = vipCenter;}
|
||||
|
||||
public Integer getIntergrationPrice() {return intergrationPrice;}
|
||||
|
||||
public void setIntergrationPrice(Integer intergrationPrice) {this.intergrationPrice = intergrationPrice;}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
@@ -670,4 +720,7 @@ public class PmsProduct implements Serializable {
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -16,6 +16,17 @@ public class SmsHomeNewProduct implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// 会员专区状态
|
||||
private Integer vipStatus;
|
||||
|
||||
// 积分专区状态
|
||||
private Integer pointsAreaStatus;
|
||||
|
||||
// 积分兑换专区状态
|
||||
private Integer pointsExchangeStatus;
|
||||
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -56,6 +67,35 @@ public class SmsHomeNewProduct implements Serializable {
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
public Integer getVipStatus() {
|
||||
return vipStatus;
|
||||
}
|
||||
|
||||
public void setVipStatus(Integer vipStatus) {
|
||||
this.vipStatus = vipStatus;
|
||||
}
|
||||
|
||||
|
||||
public Integer getPointsAreaStatus() {
|
||||
return pointsAreaStatus;
|
||||
}
|
||||
|
||||
public void setPointsAreaStatus(Integer pointsAreaStatus) {
|
||||
this.pointsAreaStatus = pointsAreaStatus;
|
||||
}
|
||||
|
||||
|
||||
public Integer getPointsExchangeStatus() {
|
||||
return pointsExchangeStatus;
|
||||
}
|
||||
|
||||
|
||||
public void setPointsExchangeStatus(Integer pointsExchangeStatus) {
|
||||
this.pointsExchangeStatus = pointsExchangeStatus;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.buy507.mall.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 发展基金流水
|
||||
* @TableName ums_development_fund
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UmsDevelopmentFund implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 现金
|
||||
*/
|
||||
private BigDecimal cashTotal;
|
||||
|
||||
/**
|
||||
* 积分
|
||||
*/
|
||||
private Integer pointsTotal;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updatedAt;
|
||||
|
||||
public Integer getPointsTotal() {
|
||||
return pointsTotal;
|
||||
}
|
||||
|
||||
public void setPointsTotal(Integer pointsTotal) {
|
||||
this.pointsTotal = pointsTotal;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public BigDecimal getCashTotal() {
|
||||
return cashTotal;
|
||||
}
|
||||
|
||||
public void setCashTotal(BigDecimal cashTotal) {
|
||||
this.cashTotal = cashTotal;
|
||||
}
|
||||
|
||||
public Date getUpdatedAt() {
|
||||
return updatedAt;
|
||||
}
|
||||
|
||||
public void setUpdatedAt(Date updatedAt) {
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UmsDevelopmentFund{" +
|
||||
"id=" + id +
|
||||
", cashTotal=" + cashTotal +
|
||||
", pointsTotal=" + pointsTotal +
|
||||
", updatedAt=" + updatedAt +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -68,29 +68,18 @@ public class UmsMember implements Serializable {
|
||||
@ApiModelProperty(value = "分销实体店状态(0->未开店;1->已开店)")
|
||||
private StoreStatus storeStatus;
|
||||
|
||||
/**
|
||||
* 余额
|
||||
*/
|
||||
@ApiModelProperty(value = "余额")
|
||||
private BigDecimal balance;
|
||||
|
||||
/**
|
||||
* 冻结余额
|
||||
*/
|
||||
@ApiModelProperty(value = "冻结余额")
|
||||
private BigDecimal freeze;
|
||||
|
||||
/**
|
||||
* 详细地址
|
||||
*/
|
||||
@ApiModelProperty(value = "详细地址")
|
||||
private String detailAddress;
|
||||
|
||||
/**
|
||||
* 真实姓名
|
||||
*/
|
||||
@ApiModelProperty(value = "真实姓名")
|
||||
private String realName;
|
||||
|
||||
/**
|
||||
* 排队状态
|
||||
*/
|
||||
@ApiModelProperty(value = "排队状态:0->未排队;1->排队中")
|
||||
private Integer orderStatus;
|
||||
|
||||
|
||||
@@ -41,6 +41,20 @@ public class UmsMemberAccountTransaction implements Serializable {
|
||||
@ApiModelProperty(value = "转账时间")
|
||||
private Date transferPaymentTime;
|
||||
|
||||
@ApiModelProperty(value = "进账积分")
|
||||
private Integer revenuePoints;
|
||||
|
||||
public Integer getFlowType() {
|
||||
return flowType;
|
||||
}
|
||||
|
||||
public void setFlowType(Integer flowType) {
|
||||
this.flowType = flowType;
|
||||
}
|
||||
|
||||
@ApiModelProperty(value = "流水类型")
|
||||
private Integer flowType;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Long getId() {
|
||||
@@ -83,6 +97,14 @@ public class UmsMemberAccountTransaction implements Serializable {
|
||||
this.transactionState = transactionState;
|
||||
}
|
||||
|
||||
public Integer getRevenuePoints() {
|
||||
return revenuePoints;
|
||||
}
|
||||
|
||||
public void setRevenuePoints(Integer revenuePoints) {
|
||||
this.revenuePoints = revenuePoints;
|
||||
}
|
||||
|
||||
public String getRemarks() {
|
||||
return remarks;
|
||||
}
|
||||
@@ -117,21 +139,18 @@ public class UmsMemberAccountTransaction implements Serializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getClass().getSimpleName());
|
||||
sb.append(" [");
|
||||
sb.append("Hash = ").append(hashCode());
|
||||
sb.append(", id=").append(id);
|
||||
sb.append(", memberId=").append(memberId);
|
||||
sb.append(", orderId=").append(orderId);
|
||||
sb.append(", revenueAmount=").append(revenueAmount);
|
||||
sb.append(", transactionState=").append(transactionState);
|
||||
sb.append(", remarks=").append(remarks);
|
||||
sb.append(", commissionRatio=").append(commissionRatio);
|
||||
sb.append(", createTime=").append(createTime);
|
||||
sb.append(", transferPaymentTime=").append(transferPaymentTime);
|
||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
return "UmsMemberAccountTransaction{" +
|
||||
"id=" + id +
|
||||
", memberId=" + memberId +
|
||||
", orderId=" + orderId +
|
||||
", revenueAmount=" + revenueAmount +
|
||||
", transactionState=" + transactionState +
|
||||
", remarks='" + remarks + '\'' +
|
||||
", commissionRatio=" + commissionRatio +
|
||||
", createTime=" + createTime +
|
||||
", transferPaymentTime=" + transferPaymentTime +
|
||||
", revenuePoints=" + revenuePoints +
|
||||
", flowType=" + flowType +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.buy507.mall.model;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@@ -44,9 +45,12 @@ public class UmsMemberLevel implements Serializable {
|
||||
@ApiModelProperty(value = "注释")
|
||||
private String note;
|
||||
|
||||
@ApiModelProperty(value = "提成比例")
|
||||
@ApiModelProperty(value = "现金提成比例")
|
||||
private Integer commissionRatio;
|
||||
|
||||
@ApiModelProperty(value = "积分提成比例")
|
||||
private Integer pointsRatio;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Long getId() {
|
||||
@@ -161,28 +165,32 @@ public class UmsMemberLevel implements Serializable {
|
||||
this.commissionRatio = commissionRatio;
|
||||
}
|
||||
|
||||
public Integer getPointsRatio() {
|
||||
return pointsRatio;
|
||||
}
|
||||
|
||||
public void setPointsRatio(Integer pointsRatio) {
|
||||
this.pointsRatio = pointsRatio;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getClass().getSimpleName());
|
||||
sb.append(" [");
|
||||
sb.append("Hash = ").append(hashCode());
|
||||
sb.append(", id=").append(id);
|
||||
sb.append(", name=").append(name);
|
||||
sb.append(", growthPoint=").append(growthPoint);
|
||||
sb.append(", defaultStatus=").append(defaultStatus);
|
||||
sb.append(", freeFreightPoint=").append(freeFreightPoint);
|
||||
sb.append(", commentGrowthPoint=").append(commentGrowthPoint);
|
||||
sb.append(", priviledgeFreeFreight=").append(priviledgeFreeFreight);
|
||||
sb.append(", priviledgeSignIn=").append(priviledgeSignIn);
|
||||
sb.append(", priviledgeComment=").append(priviledgeComment);
|
||||
sb.append(", priviledgePromotion=").append(priviledgePromotion);
|
||||
sb.append(", priviledgeMemberPrice=").append(priviledgeMemberPrice);
|
||||
sb.append(", priviledgeBirthday=").append(priviledgeBirthday);
|
||||
sb.append(", note=").append(note);
|
||||
sb.append(", commissionRatio=").append(commissionRatio);
|
||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
return "UmsMemberLevel{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", growthPoint=" + growthPoint +
|
||||
", defaultStatus=" + defaultStatus +
|
||||
", freeFreightPoint=" + freeFreightPoint +
|
||||
", commentGrowthPoint=" + commentGrowthPoint +
|
||||
", priviledgeFreeFreight=" + priviledgeFreeFreight +
|
||||
", priviledgeSignIn=" + priviledgeSignIn +
|
||||
", priviledgeComment=" + priviledgeComment +
|
||||
", priviledgePromotion=" + priviledgePromotion +
|
||||
", priviledgeMemberPrice=" + priviledgeMemberPrice +
|
||||
", priviledgeBirthday=" + priviledgeBirthday +
|
||||
", note='" + note + '\'' +
|
||||
", commissionRatio=" + commissionRatio +
|
||||
", pointsRatio=" + pointsRatio +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -89,7 +89,7 @@
|
||||
id, order_id, order_sn, product_id, product_pic, product_name, product_brand, product_sn,
|
||||
product_price, product_quantity, product_sku_id, product_sku_code, product_category_id,
|
||||
sp1, sp2, sp3, promotion_name, promotion_amount, coupon_amount, integration_amount,
|
||||
real_amount, gift_integration, gift_growth, product_attr
|
||||
real_amount, gift_integration, gift_growth, product_attr,intergrationPrice,intergrationExchange
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="com.buy507.mall.model.OmsOrderItemExample" resultMap="BaseResultMap">
|
||||
select
|
||||
@@ -508,4 +508,9 @@
|
||||
product_attr = #{productAttr,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
<select id="selectByOrderId" resultType="com.buy507.mall.model.OmsOrderItem">
|
||||
select * from mall.oms_order_item where order_id = #{orderId}
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -50,8 +50,7 @@
|
||||
<result column="settlement_status" jdbcType="INTEGER" property="settlementStatus" />
|
||||
<result column="settlement_time" jdbcType="TIMESTAMP" property="settlementTime" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||
@@ -149,7 +148,7 @@
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.buy507.mall.model.OmsOrder">
|
||||
<insert id="insert" useGeneratedKeys="true" parameterType="com.buy507.mall.model.OmsOrder">
|
||||
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>
|
||||
@@ -874,4 +873,57 @@
|
||||
settlement_time = #{settlementTime,jdbcType=TIMESTAMP}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
<select id="selectAll" resultType="com.buy507.mall.model.PmsProduct">
|
||||
SELECT p.id,
|
||||
p.brand_id,
|
||||
p.product_category_id,
|
||||
p.feight_template_id,
|
||||
p.product_attribute_category_id,
|
||||
p.name,
|
||||
p.pic,
|
||||
p.product_sn,
|
||||
p.delete_status,
|
||||
p.publish_status,
|
||||
p.new_status,
|
||||
p.recommand_status,
|
||||
p.verify_status,
|
||||
p.sort,
|
||||
p.sale,
|
||||
p.price,
|
||||
p.promotion_price,
|
||||
p.gift_growth,
|
||||
p.gift_point,
|
||||
p.use_point_limit,
|
||||
p.sub_title,
|
||||
p.description,
|
||||
p.original_price,
|
||||
p.stock,
|
||||
p.low_stock,
|
||||
p.unit,
|
||||
p.weight,
|
||||
p.preview_status,
|
||||
p.service_ids,
|
||||
p.keywords,
|
||||
p.note,
|
||||
p.album_pics,
|
||||
p.detail_title,
|
||||
p.detail_desc,
|
||||
p.detail_html,
|
||||
p.detail_mobile_html,
|
||||
p.promotion_start_time,
|
||||
p.promotion_end_time,
|
||||
p.promotion_per_limit,
|
||||
p.promotion_type,
|
||||
p.brand_name,
|
||||
p.product_category_name,
|
||||
p.distribution_flag,
|
||||
p.vip_status,
|
||||
p.points_area_status,
|
||||
p.points_exchange_status
|
||||
FROM pms_product p
|
||||
JOIN oms_order_item oi ON p.product_sn = oi.product_sn
|
||||
JOIN oms_order o ON oi.order_sn = o.order_sn
|
||||
WHERE o.order_sn = #{orderSn}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -112,7 +112,7 @@
|
||||
verify_status, sort, sale, price, promotion_price, gift_growth, gift_point, use_point_limit,
|
||||
sub_title, original_price, stock, low_stock, unit, weight, preview_status, service_ids,
|
||||
keywords, note, album_pics, detail_title, promotion_start_time, promotion_end_time,
|
||||
promotion_per_limit, promotion_type, brand_name, product_category_name, distribution_flag
|
||||
promotion_per_limit, promotion_type, brand_name, product_category_name, distribution_flag,vip_status,points_area_status,points_exchange_status,intergration_price
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
description, detail_desc, detail_html, detail_mobile_html
|
||||
@@ -234,6 +234,15 @@
|
||||
<if test="newStatus != null">
|
||||
new_status,
|
||||
</if>
|
||||
<if test="vipStatus != null">
|
||||
vip_status,
|
||||
</if>
|
||||
<if test="pointsAreaStatus != null">
|
||||
points_area_status,
|
||||
</if>
|
||||
<if test="pointsExchangeStatus != null">
|
||||
points_exchange_status,
|
||||
</if>
|
||||
<if test="recommandStatus != null">
|
||||
recommand_status,
|
||||
</if>
|
||||
@@ -327,6 +336,9 @@
|
||||
<if test="detailMobileHtml != null">
|
||||
detail_mobile_html,
|
||||
</if>
|
||||
<if test="intergrationPrice != null">
|
||||
intergration_price,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="brandId != null">
|
||||
@@ -452,6 +464,9 @@
|
||||
<if test="detailMobileHtml != null">
|
||||
#{detailMobileHtml,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="intergrationPrice != null">
|
||||
#{intergration_price},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="com.buy507.mall.model.PmsProductExample" resultType="java.lang.Long">
|
||||
@@ -493,6 +508,12 @@
|
||||
<if test="record.publishStatus != null">
|
||||
publish_status = #{record.publishStatus,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.pointsAreaStatus != null">
|
||||
points_area_status = #{record.pointsAreaStatus,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.pointsExchangeStatus != null">
|
||||
points_exchange_status = #{record.pointsExchangeStatus,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.newStatus != null">
|
||||
new_status = #{record.newStatus,jdbcType=INTEGER},
|
||||
</if>
|
||||
@@ -915,4 +936,122 @@
|
||||
where ppfr.product_id=#{id,jdbcType=BIGINT} limit 1
|
||||
</select>
|
||||
|
||||
<select id="getProductByOrderSn" resultMap="BaseResultMap">
|
||||
SELECT p.*
|
||||
FROM pms_product p
|
||||
WHERE p.product_sn = (
|
||||
SELECT DISTINCT oi.product_sn
|
||||
FROM oms_order_item oi
|
||||
WHERE oi.order_sn = #{orderSn}
|
||||
AND oi.product_sn IS NOT NULL
|
||||
limit 1
|
||||
);
|
||||
</select>
|
||||
|
||||
<select id="getPrimaryKey" resultType="com.buy507.mall.model.PmsProduct">
|
||||
SELECT p.id,
|
||||
p.brand_id,
|
||||
p.product_category_id,
|
||||
p.feight_template_id,
|
||||
p.product_attribute_category_id,
|
||||
p.name,
|
||||
p.pic,
|
||||
p.product_sn,
|
||||
p.delete_status,
|
||||
p.publish_status,
|
||||
p.new_status,
|
||||
p.recommand_status,
|
||||
p.verify_status,
|
||||
p.sort,
|
||||
p.sale,
|
||||
p.price,
|
||||
p.promotion_price,
|
||||
p.gift_growth,
|
||||
p.gift_point,
|
||||
p.use_point_limit,
|
||||
p.sub_title,
|
||||
p.description,
|
||||
p.original_price,
|
||||
p.stock,
|
||||
p.low_stock,
|
||||
p.unit,
|
||||
p.weight,
|
||||
p.preview_status,
|
||||
p.service_ids,
|
||||
p.keywords,
|
||||
p.note,
|
||||
p.album_pics,
|
||||
p.detail_title,
|
||||
p.detail_desc,
|
||||
p.detail_html,
|
||||
p.detail_mobile_html,
|
||||
p.promotion_start_time,
|
||||
p.promotion_end_time,
|
||||
p.promotion_per_limit,
|
||||
p.promotion_type,
|
||||
p.brand_name,
|
||||
p.product_category_name,
|
||||
p.distribution_flag,
|
||||
p.vip_status,
|
||||
p.points_area_status,
|
||||
p.points_exchange_status,
|
||||
p.intergration_price
|
||||
FROM pms_product p
|
||||
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertAll" useGeneratedKeys="true" parameterType="com.buy507.mall.model.PmsProduct">
|
||||
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>
|
||||
INSERT INTO pms_product
|
||||
SET
|
||||
brand_id = #{brandId},
|
||||
product_category_id = #{productCategoryId},
|
||||
feight_template_id = #{feightTemplateId},
|
||||
product_attribute_category_id = #{productAttributeCategoryId},
|
||||
name = #{name},
|
||||
pic = #{pic},
|
||||
product_sn = #{productSn},
|
||||
delete_status = #{deleteStatus},
|
||||
publish_status = #{publishStatus},
|
||||
new_status = #{newStatus},
|
||||
vip_status = #{vipStatus},
|
||||
points_area_status = #{pointsAreaStatus},
|
||||
points_exchange_status = #{pointsExchangeStatus},
|
||||
recommand_status = #{recommandStatus},
|
||||
verify_status = #{verifyStatus},
|
||||
sort = #{sort},
|
||||
sale = #{sale},
|
||||
price = #{price},
|
||||
promotion_price = #{promotionPrice},
|
||||
gift_growth = #{giftGrowth},
|
||||
gift_point = #{giftPoint},
|
||||
use_point_limit = #{usePointLimit},
|
||||
sub_title = #{subTitle},
|
||||
original_price = #{originalPrice},
|
||||
stock = #{stock},
|
||||
low_stock = #{lowStock},
|
||||
unit = #{unit},
|
||||
weight = #{weight},
|
||||
preview_status = #{previewStatus},
|
||||
service_ids = #{serviceIds},
|
||||
keywords = #{keywords},
|
||||
note = #{note},
|
||||
album_pics = #{albumPics},
|
||||
detail_title = #{detailTitle},
|
||||
promotion_start_time = #{promotionStartTime},
|
||||
promotion_end_time = #{promotionEndTime},
|
||||
promotion_per_limit = #{promotionPerLimit},
|
||||
promotion_type = #{promotionType},
|
||||
brand_name = #{brandName},
|
||||
product_category_name = #{productCategoryName},
|
||||
description = #{description},
|
||||
detail_desc = #{detailDesc},
|
||||
detail_html = #{detailHtml},
|
||||
detail_mobile_html = #{detailMobileHtml},
|
||||
intergration_price = #{intergrationPrice};
|
||||
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -341,4 +341,5 @@
|
||||
on ppa.id=ppav.product_attribute_id
|
||||
where pst.product_id=#{id,jdbcType=BIGINT}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.buy507.mall.mapper.UmsDevelopmentFundMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.buy507.mall.model.UmsDevelopmentFund">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="cashTotal" column="cash_total" jdbcType="DECIMAL"/>
|
||||
<result property="pointsTotal" column="points_total" jdbcType="INTEGER"/>
|
||||
<result property="updatedAt" column="updated_at" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
||||
@@ -109,10 +109,10 @@
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>
|
||||
insert into ums_member_account_transaction (member_id, order_id, revenue_amount,
|
||||
transaction_state, remarks, commission_ratio, transfer_payment_time)
|
||||
transaction_state, remarks, commission_ratio, transfer_payment_time, revenue_points)
|
||||
values (#{memberId,jdbcType=BIGINT}, #{orderId,jdbcType=BIGINT}, #{revenueAmount,jdbcType=DECIMAL},
|
||||
#{transactionState,jdbcType=INTEGER}, #{remarks,jdbcType=VARCHAR}, #{commissionRatio,jdbcType=INTEGER},
|
||||
#{transferPaymentTime,jdbcType=TIMESTAMP})
|
||||
#{transferPaymentTime,jdbcType=TIMESTAMP}, #{revenuePoints,jdbcType=INTEGER})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.buy507.mall.model.UmsMemberAccountTransaction">
|
||||
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
|
||||
|
||||
@@ -558,6 +558,10 @@
|
||||
select u.phone from ums_member u
|
||||
where u.phone=#{phone,jdbcType=VARCHAR}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<update id="upgradeMember">
|
||||
UPDATE ums_member
|
||||
SET member_level_id = #{newMemberLevelId}
|
||||
WHERE id = #{memberId}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -141,7 +141,7 @@
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update ums_member_relation_tree
|
||||
<set>
|
||||
<if test="record.id != null">
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
<version>1.18.20</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -3,12 +3,7 @@ package com.buy507.mall.portal.controller;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.buy507.mall.common.api.CommonResult;
|
||||
import com.buy507.mall.model.PmsProduct;
|
||||
@@ -96,4 +91,30 @@ public class HomeController {
|
||||
return CommonResult.success(productSku);
|
||||
}
|
||||
|
||||
@ApiOperation("获取会员专区商品")
|
||||
@RequestMapping(value = "/getVipProductList", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult<List<PmsProduct>> getVipProductList(){
|
||||
List<PmsProduct> vipProductList = homeService.getVipProductList();
|
||||
return CommonResult.success(vipProductList);
|
||||
}
|
||||
|
||||
@ApiOperation("获取积分专区商品")
|
||||
@RequestMapping(value = "/getPointProductList", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult<List<PmsProduct>> getPointProductList(){
|
||||
List<PmsProduct> pointProductList = homeService.getPointProductList();
|
||||
return CommonResult.success(pointProductList);
|
||||
}
|
||||
|
||||
@ApiOperation("获取积分兑换专区")
|
||||
@RequestMapping(value = "/getPointExchangeProductList", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult<List<PmsProduct>> getPointExchangeProductList(){
|
||||
List<PmsProduct> pointExchangeProductList = homeService.getPointExchangeProductList();
|
||||
return CommonResult.success(pointExchangeProductList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.buy507.mall.portal.controller;
|
||||
|
||||
import com.buy507.mall.common.api.CommonResult;
|
||||
import com.buy507.mall.portal.domain.WithdrawApplyParam;
|
||||
import com.buy507.mall.portal.service.MyWalletService;
|
||||
import com.buy507.mall.portal.service.UmsMemberService;
|
||||
import com.buy507.mall.portal.vo.WalletCashVo;
|
||||
import com.buy507.mall.portal.vo.WalletPointsVo;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/wallet")
|
||||
public class MyWalletController {
|
||||
|
||||
@Autowired
|
||||
private MyWalletService myWalletService;
|
||||
|
||||
@Autowired
|
||||
private UmsMemberService memberService;
|
||||
|
||||
|
||||
@ApiOperation("获取现金余额和流水")
|
||||
@GetMapping("/balance")
|
||||
public CommonResult<WalletCashVo> getBalance(@RequestParam Long userId){
|
||||
WalletCashVo walletCashVo = myWalletService.getBalanceAndCashFlow(userId);
|
||||
return CommonResult.success(walletCashVo);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("获取积分余额和流水")
|
||||
@GetMapping("/points")
|
||||
public CommonResult<WalletPointsVo> getIntegration(@RequestParam Long userId){
|
||||
WalletPointsVo walletPointsVo = myWalletService.getIntegrationAndPointsFlow(userId);
|
||||
return CommonResult.success(walletPointsVo);
|
||||
}
|
||||
|
||||
@ApiOperation("会员提现申请")
|
||||
@PostMapping(value = "/withdraw")
|
||||
public CommonResult withdrawApply(@RequestBody WithdrawApplyParam applyParam) {
|
||||
return memberService.withdrawApply(applyParam);
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,8 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alipay.api.AlipayApiException;
|
||||
import com.buy507.mall.model.PmsProduct;
|
||||
import com.buy507.mall.model.SmsHomeNewProduct;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -135,11 +137,19 @@ public class OmsPortalOrderController {
|
||||
|
||||
@ApiOperation("积分支付")
|
||||
@ApiImplicitParam(name = "orderId", value = "订单ID", paramType = "query")
|
||||
@RequestMapping(value = "/pointPayment", method = RequestMethod.POST)
|
||||
public CommonResult pointPayment(@RequestParam Long orderId) {
|
||||
return portalOrderService.pointPayment(orderId);
|
||||
}
|
||||
|
||||
@ApiOperation("余额支付")
|
||||
@ApiImplicitParam(name = "orderId", value = "订单ID", paramType = "query")
|
||||
@RequestMapping(value = "/balancePayment", method = RequestMethod.POST)
|
||||
public CommonResult balancePayment(@RequestParam Long orderId) {
|
||||
return portalOrderService.balancePayment(orderId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ApiOperation("微信预支付")
|
||||
@ApiImplicitParam(name = "orderId", value = "订单ID", paramType = "query")
|
||||
@RequestMapping(value = "/wxPrePay", method = RequestMethod.POST)
|
||||
@@ -199,9 +209,7 @@ public class OmsPortalOrderController {
|
||||
response.sendRedirect("http://49.233.215.129/#/pages/order/order?state=6");
|
||||
return "支付宝回调";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ApiOperation("加速订单")
|
||||
@RequestMapping(value = "/accelerateOrder",method = RequestMethod.POST)
|
||||
@@ -215,6 +223,13 @@ public class OmsPortalOrderController {
|
||||
@ApiOperation("普通单排队信息")
|
||||
@RequestMapping("/orderQueue/info")
|
||||
public CommonResult orderQueueInfo() {
|
||||
|
||||
PmsProduct pmsProduct = new PmsProduct();
|
||||
//如果是积分专区的商品和积分兑换的商品则不进行排队
|
||||
if(pmsProduct.getPointsAreaStatus() == 1 || pmsProduct.getPointsExchangeStatus() == 1){
|
||||
return CommonResult.success("该商品不参与排队流程");
|
||||
}
|
||||
//否则进行排队
|
||||
return portalOrderService.orderQueueInfo();
|
||||
}
|
||||
|
||||
@@ -224,6 +239,11 @@ public class OmsPortalOrderController {
|
||||
@ApiOperation(" 加速单排队信息")
|
||||
@RequestMapping("/accelerateOrder/info")
|
||||
public CommonResult accelerateOrderInfo(@RequestParam Long orderId) {
|
||||
PmsProduct pmsProduct = new PmsProduct();
|
||||
//如果是积分专区的商品和积分兑换的商品则不进行排队
|
||||
if(pmsProduct.getPointsAreaStatus() == 1 || pmsProduct.getPointsExchangeStatus() == 1){
|
||||
return CommonResult.success("该商品不参与排队流程");
|
||||
}
|
||||
return portalOrderService.accelerateOrderInfo(orderId);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.buy507.mall.portal.controller;
|
||||
|
||||
import com.buy507.mall.common.api.CommonResult;
|
||||
import com.buy507.mall.model.UmsDevelopmentFund;
|
||||
import com.buy507.mall.portal.domain.*;
|
||||
import com.buy507.mall.portal.service.UmsMemberService;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -89,7 +90,14 @@ public class UmsMemberController {
|
||||
MemberInfoResult result = memberService.getMemberInfo();
|
||||
return CommonResult.success(result);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("获取发展基金")
|
||||
@RequestMapping(value = "/getDevelopmentFund", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public CommonResult<UmsDevelopmentFund> getDevelopmentFund() {
|
||||
UmsDevelopmentFund result = memberService.getDevelopmentFund();
|
||||
return CommonResult.success(result);
|
||||
}
|
||||
|
||||
@ApiOperation("修改会员昵称")
|
||||
@RequestMapping(value = "/updateMemberNickname", method = RequestMethod.POST)
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.buy507.mall.portal.controller;
|
||||
|
||||
import com.buy507.mall.common.api.CommonResult;
|
||||
import com.buy507.mall.model.OmsOrder;
|
||||
import com.buy507.mall.portal.domain.OrderParam;
|
||||
import com.buy507.mall.portal.service.VipCenterService;
|
||||
import com.buy507.mall.portal.vo.OmsOrderDTO;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/vip")
|
||||
public class VipController {
|
||||
|
||||
@Autowired
|
||||
private VipCenterService vipCenterService;
|
||||
|
||||
@ApiOperation("查询升级权限金额")
|
||||
@RequestMapping(value = "/getUpgradeAmount", method = RequestMethod.GET)
|
||||
public CommonResult<BigDecimal> getUpgradeAmount(@RequestParam Long memberLevelId){
|
||||
BigDecimal amount = vipCenterService.getUpgradeAmount(memberLevelId);
|
||||
return CommonResult.success(amount);
|
||||
}
|
||||
|
||||
@ApiOperation("创建购买权益订单")
|
||||
@RequestMapping(value = "/createUpgradeOrder", method = RequestMethod.POST)
|
||||
public CommonResult createUpgradeOrder(@RequestBody OmsOrderDTO param){
|
||||
try {
|
||||
return vipCenterService.createUpgradeOrder(param);
|
||||
} catch (Exception e) {
|
||||
return CommonResult.failed("createOrder fail");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,5 +39,35 @@ public interface HomeDao {
|
||||
/*
|
||||
* 获取所有商品信息按销量排序
|
||||
*/
|
||||
List<PmsProduct> getAllPioductList();
|
||||
List<PmsProduct> getAllPioductList();
|
||||
|
||||
/**
|
||||
* 获取会员专区
|
||||
*/
|
||||
List<PmsProduct> getProductVipStatus(@Param("offset") Integer offset,@Param("limit") Integer limit);
|
||||
|
||||
/**
|
||||
* 获取积分专区
|
||||
*/
|
||||
List<PmsProduct> getProductpointSareaStatus(@Param("offset") Integer offset,@Param("limit") Integer limit);
|
||||
|
||||
/**
|
||||
* 获取积分兑换专区
|
||||
*/
|
||||
List<PmsProduct> getProductpointsExchangeStatus(@Param("offset") Integer offset,@Param("limit") Integer limit);
|
||||
|
||||
/**
|
||||
* 获取会员专区详情
|
||||
*/
|
||||
List<PmsProduct> getVipStatusList();
|
||||
|
||||
/**
|
||||
*获取积分专区商品
|
||||
*/
|
||||
List<PmsProduct> getPointStatusList();
|
||||
|
||||
/**
|
||||
*获取积分兑换专区商品
|
||||
*/
|
||||
List<PmsProduct> getPointExchangeProductList();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.buy507.mall.portal.dao;
|
||||
|
||||
import com.buy507.mall.portal.vo.TransactionCashVo;
|
||||
import com.buy507.mall.portal.vo.TransactionPointsVo;
|
||||
import com.buy507.mall.portal.vo.WalletCashVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface MyWalletMapper {
|
||||
/**
|
||||
* 获取用户现金余额
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT balance FROM ums_member WHERE id = #{userId}")
|
||||
BigDecimal getBalance(Long userId);
|
||||
|
||||
/**
|
||||
* 获取用户现金流水
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT revenue_amount, remarks, transfer_payment_time FROM ums_member_account_transaction " +
|
||||
"WHERE member_id = #{userId} And flow_type = 1 ORDER BY transfer_payment_time DESC")
|
||||
List<TransactionCashVo> getCashFlow(Long userId);
|
||||
|
||||
/**
|
||||
* 获取用户积分余额
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT integration FROM ums_member WHERE id = #{userId}")
|
||||
Integer getIntegration(Long userId);
|
||||
|
||||
/**
|
||||
* 获取用户积分流水
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT revenue_points, remarks, transfer_payment_time FROM ums_member_account_transaction " +
|
||||
"WHERE member_id = #{userId} And flow_type = 2 ORDER BY transfer_payment_time DESC")
|
||||
List<TransactionPointsVo> getPointsFlow(Long userId);
|
||||
}
|
||||
@@ -27,6 +27,12 @@ public class HomeContentResult {
|
||||
private List<PmsProduct> hotProductList;
|
||||
//推荐专题
|
||||
private List<CmsSubject> subjectList;
|
||||
//会员专区
|
||||
private List<PmsProduct> vipProductList;
|
||||
//积分专区
|
||||
private List<PmsProduct> pointsAreaProductList;
|
||||
//积分兑换专区
|
||||
private List<PmsProduct> pointsExchangeProductList;
|
||||
//查询所有商品按销量排序
|
||||
private List<PmsProduct> allProductList;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,29 @@ public class OrderItemResult {
|
||||
|
||||
@ApiModelProperty(value = "商品SKU属性3")
|
||||
private String sp3;
|
||||
|
||||
|
||||
@ApiModelProperty("积分价格")
|
||||
private Integer intergrationPrice;
|
||||
|
||||
@ApiModelProperty("积分兑换专区")
|
||||
private Integer intergrationExchange;
|
||||
|
||||
public Integer getIntergrationPrice() {
|
||||
return intergrationPrice;
|
||||
}
|
||||
|
||||
public void setIntergrationPrice(Integer intergrationPrice) {
|
||||
this.intergrationPrice = intergrationPrice;
|
||||
}
|
||||
|
||||
public Integer getIntergrationExchange() {
|
||||
return intergrationExchange;
|
||||
}
|
||||
|
||||
public void setIntergrationExchange(Integer intergrationExchange) {
|
||||
this.intergrationExchange = intergrationExchange;
|
||||
}
|
||||
|
||||
public Long getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class OrderResult {
|
||||
@ApiModelProperty(value = "支付时间")
|
||||
private Date paymentTime;
|
||||
|
||||
@ApiModelProperty(value = "支付类型: 1->支付宝;2->微信;3->线下支付;4->积分支付")
|
||||
@ApiModelProperty(value = "支付类型: 1->支付宝;2->微信;3->线下支付;4->积分支付; 5->余额支付")
|
||||
private Integer payType;
|
||||
|
||||
@ApiModelProperty(value = "支付类型名称")
|
||||
@@ -113,6 +113,27 @@ public class OrderResult {
|
||||
@ApiModelProperty(value = "快速排队订单还剩邀请成功的人数")
|
||||
private Integer invitedCount;
|
||||
|
||||
@ApiModelProperty(value = "积分价格")
|
||||
private Integer intergrationPrice;
|
||||
|
||||
@ApiModelProperty(value = "积分兑换专区")
|
||||
private Integer intergrationExchange;
|
||||
|
||||
public Integer getIntergrationExchange() {
|
||||
return intergrationExchange;
|
||||
}
|
||||
|
||||
public void setIntergrationExchange(Integer intergrationExchange) {
|
||||
this.intergrationExchange = intergrationExchange;
|
||||
}
|
||||
|
||||
public Integer getIntergrationPrice() {
|
||||
return intergrationPrice;
|
||||
}
|
||||
|
||||
public void setIntergrationPrice(Integer intergrationPrice) {
|
||||
this.intergrationPrice = intergrationPrice;
|
||||
}
|
||||
|
||||
public Long getOrderId() {
|
||||
return orderId;
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.buy507.mall.model.SmsCoupon;
|
||||
import com.buy507.mall.model.SmsCouponProductRelation;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
|
||||
public class ProductDetailResult {
|
||||
private Long id;
|
||||
@@ -152,7 +153,53 @@ public class ProductDetailResult {
|
||||
private int countComent;
|
||||
|
||||
private int applauseRate;
|
||||
|
||||
|
||||
@Transient
|
||||
@ApiModelProperty(value = "积分专区状态")
|
||||
private Integer pointsAreaStatus;
|
||||
|
||||
@Transient
|
||||
@ApiModelProperty(value = "积分兑换专区状态")
|
||||
private Integer pointsExchangeStatus;
|
||||
|
||||
@ApiModelProperty(value = "会员中心:1->店长; 2->代理; 3->市代理")
|
||||
private Integer vipCenter;
|
||||
|
||||
@ApiModelProperty(value = "商品积分价格")
|
||||
private Integer intergrationPrice;
|
||||
|
||||
public Integer getPointsAreaStatus() {
|
||||
return pointsAreaStatus;
|
||||
}
|
||||
|
||||
public void setPointsAreaStatus(Integer pointsAreaStatus) {
|
||||
this.pointsAreaStatus = pointsAreaStatus;
|
||||
}
|
||||
|
||||
public Integer getPointsExchangeStatus() {
|
||||
return pointsExchangeStatus;
|
||||
}
|
||||
|
||||
public void setPointsExchangeStatus(Integer pointsExchangeStatus) {
|
||||
this.pointsExchangeStatus = pointsExchangeStatus;
|
||||
}
|
||||
|
||||
public Integer getVipCenter() {
|
||||
return vipCenter;
|
||||
}
|
||||
|
||||
public void setVipCenter(Integer vipCenter) {
|
||||
this.vipCenter = vipCenter;
|
||||
}
|
||||
|
||||
public Integer getIntergrationPrice() {
|
||||
return intergrationPrice;
|
||||
}
|
||||
|
||||
public void setIntergrationPrice(Integer intergrationPrice) {
|
||||
this.intergrationPrice = intergrationPrice;
|
||||
}
|
||||
|
||||
List<ProductAttributeResult> specList;
|
||||
|
||||
List<ProductAttributeResult> specChildList;
|
||||
|
||||
@@ -14,6 +14,16 @@ public class ProductSkuResult {
|
||||
|
||||
private String pic;
|
||||
|
||||
private Integer intergrationPrice;
|
||||
|
||||
public Integer getIntergrationPrice() {
|
||||
return intergrationPrice;
|
||||
}
|
||||
|
||||
public void setIntergrationPrice(Integer intergrationPrice) {
|
||||
this.intergrationPrice = intergrationPrice;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -40,9 +40,21 @@ public interface HomeService {
|
||||
* @param productId
|
||||
* @return
|
||||
*/
|
||||
|
||||
/**
|
||||
* 获取会员专区商品
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
List<PmsProduct> getVipProductList();
|
||||
|
||||
ProductDetailResult getProductInfo(Long productId);
|
||||
|
||||
ProductSkuResult getProductSku(Long productId, String sp1, String sp2, String sp3);
|
||||
|
||||
List<PmsProduct> getProductList(Long brandId, Long categoryId, String sortType, Integer pageSize, Integer pageNum);
|
||||
|
||||
List<PmsProduct> getPointProductList();
|
||||
|
||||
List<PmsProduct> getPointExchangeProductList();
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.buy507.mall.model.UmsMember;
|
||||
public interface MemberCommissionService {
|
||||
/**
|
||||
* 开始冻结金额到账,等级升级
|
||||
* @param order
|
||||
* @param currentMember
|
||||
*/
|
||||
void computeCommission(UmsMember currentMember);
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.buy507.mall.portal.service;
|
||||
|
||||
import com.buy507.mall.portal.vo.WalletCashVo;
|
||||
import com.buy507.mall.portal.vo.WalletPointsVo;
|
||||
|
||||
public interface MyWalletService {
|
||||
|
||||
/**
|
||||
* 获取现金余额和流水
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
WalletCashVo getBalanceAndCashFlow(Long userId);
|
||||
|
||||
/**
|
||||
* 获取积分余额和流水
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
WalletPointsVo getIntegrationAndPointsFlow(Long userId);
|
||||
}
|
||||
@@ -80,12 +80,17 @@ public interface OmsPortalOrderService {
|
||||
CommonResult confirmReceiving(Long orderId);
|
||||
|
||||
/**
|
||||
* 余额支付
|
||||
* 积分支付
|
||||
* @param orderId
|
||||
* @return
|
||||
*/
|
||||
CommonResult pointPayment(Long orderId);
|
||||
|
||||
/**
|
||||
* 余额支付
|
||||
*/
|
||||
CommonResult balancePayment(Long orderId);
|
||||
|
||||
|
||||
/**
|
||||
* 微信预支付
|
||||
* @param orderId
|
||||
|
||||
@@ -13,7 +13,7 @@ public interface PortalCommonService {
|
||||
|
||||
/**
|
||||
* 获取会员的折扣
|
||||
* @param member
|
||||
* @param memberId
|
||||
* @return
|
||||
*/
|
||||
BigDecimal getDiscount(Long memberId);
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.buy507.mall.portal.service;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.buy507.mall.model.UmsDevelopmentFund;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@@ -185,4 +186,10 @@ public interface UmsMemberService {
|
||||
* @return
|
||||
*/
|
||||
CommonResult<Map<String, Object>> personalTeam();
|
||||
|
||||
/**
|
||||
* 查询发展基金
|
||||
* @return
|
||||
*/
|
||||
UmsDevelopmentFund getDevelopmentFund();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.buy507.mall.portal.service;
|
||||
|
||||
import com.buy507.mall.common.api.CommonResult;
|
||||
import com.buy507.mall.model.OmsOrder;
|
||||
import com.buy507.mall.portal.domain.OrderParam;
|
||||
import com.buy507.mall.portal.vo.OmsOrderDTO;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public interface VipCenterService {
|
||||
|
||||
/**
|
||||
* 查询升级权限金额
|
||||
* @param memberLevelId
|
||||
* @return
|
||||
*/
|
||||
BigDecimal getUpgradeAmount(Long memberLevelId);
|
||||
|
||||
/**
|
||||
* 创建购买权益订单
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
CommonResult createUpgradeOrder(OmsOrderDTO param);
|
||||
}
|
||||
@@ -1,298 +1,288 @@
|
||||
package com.buy507.mall.portal.service.impl;
|
||||
|
||||
import com.buy507.mall.mapper.*;
|
||||
import com.buy507.mall.model.*;
|
||||
import com.buy507.mall.portal.dao.HomeDao;
|
||||
import com.buy507.mall.portal.domain.*;
|
||||
import com.buy507.mall.portal.repository.MemberProductCollectionRepository;
|
||||
import com.buy507.mall.portal.service.HomeService;
|
||||
import com.buy507.mall.portal.service.PortalCommonService;
|
||||
import com.buy507.mall.portal.service.UmsMemberService;
|
||||
import com.buy507.mall.portal.util.DateUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.buy507.mall.mapper.CmsSubjectMapper;
|
||||
import com.buy507.mall.mapper.PmsCommentMapper;
|
||||
import com.buy507.mall.mapper.PmsCommentReplayMapper;
|
||||
import com.buy507.mall.mapper.PmsProductAttributeMapper;
|
||||
import com.buy507.mall.mapper.PmsProductAttributeValueMapper;
|
||||
import com.buy507.mall.mapper.PmsProductCategoryMapper;
|
||||
import com.buy507.mall.mapper.PmsProductFullReductionMapper;
|
||||
import com.buy507.mall.mapper.PmsProductMapper;
|
||||
import com.buy507.mall.mapper.PmsSkuStockMapper;
|
||||
import com.buy507.mall.mapper.SmsFlashPromotionMapper;
|
||||
import com.buy507.mall.mapper.SmsFlashPromotionSessionMapper;
|
||||
import com.buy507.mall.mapper.SmsHomeAdvertiseMapper;
|
||||
import com.buy507.mall.model.CmsSubject;
|
||||
import com.buy507.mall.model.CmsSubjectExample;
|
||||
import com.buy507.mall.model.PmsComment;
|
||||
import com.buy507.mall.model.PmsCommentReplay;
|
||||
import com.buy507.mall.model.PmsProduct;
|
||||
import com.buy507.mall.model.PmsProductAttribute;
|
||||
import com.buy507.mall.model.PmsProductAttributeExample;
|
||||
import com.buy507.mall.model.PmsProductAttributeValue;
|
||||
import com.buy507.mall.model.PmsProductAttributeValueExample;
|
||||
import com.buy507.mall.model.PmsProductCategory;
|
||||
import com.buy507.mall.model.PmsProductCategoryExample;
|
||||
import com.buy507.mall.model.PmsProductExample;
|
||||
import com.buy507.mall.model.PmsProductFullReduction;
|
||||
import com.buy507.mall.model.PmsSkuStock;
|
||||
import com.buy507.mall.model.PmsSkuStockExample;
|
||||
import com.buy507.mall.model.SmsFlashPromotion;
|
||||
import com.buy507.mall.model.SmsFlashPromotionExample;
|
||||
import com.buy507.mall.model.SmsFlashPromotionSession;
|
||||
import com.buy507.mall.model.SmsFlashPromotionSessionExample;
|
||||
import com.buy507.mall.model.SmsHomeAdvertise;
|
||||
import com.buy507.mall.model.SmsHomeAdvertiseExample;
|
||||
import com.buy507.mall.model.UmsMember;
|
||||
import com.buy507.mall.portal.dao.HomeDao;
|
||||
import com.buy507.mall.portal.domain.FlashPromotionProduct;
|
||||
import com.buy507.mall.portal.domain.HomeContentResult;
|
||||
import com.buy507.mall.portal.domain.HomeFlashPromotion;
|
||||
import com.buy507.mall.portal.domain.MemberProductCollection;
|
||||
import com.buy507.mall.portal.domain.ProductAttributeResult;
|
||||
import com.buy507.mall.portal.domain.ProductCategoryOptions;
|
||||
import com.buy507.mall.portal.domain.ProductDetailResult;
|
||||
import com.buy507.mall.portal.domain.ProductSkuResult;
|
||||
import com.buy507.mall.portal.repository.MemberProductCollectionRepository;
|
||||
import com.buy507.mall.portal.service.HomeService;
|
||||
import com.buy507.mall.portal.service.PortalCommonService;
|
||||
import com.buy507.mall.portal.service.UmsMemberService;
|
||||
import com.buy507.mall.portal.util.DateUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
|
||||
/**
|
||||
* 首页内容管理Service实现类
|
||||
*/
|
||||
@Service
|
||||
public class HomeServiceImpl implements HomeService {
|
||||
@Autowired
|
||||
private SmsHomeAdvertiseMapper advertiseMapper;
|
||||
@Autowired
|
||||
private HomeDao homeDao;
|
||||
@Autowired
|
||||
private SmsFlashPromotionMapper flashPromotionMapper;
|
||||
@Autowired
|
||||
private SmsFlashPromotionSessionMapper promotionSessionMapper;
|
||||
@Autowired
|
||||
private PmsProductMapper productMapper;
|
||||
@Autowired
|
||||
private PmsProductCategoryMapper productCategoryMapper;
|
||||
@Autowired
|
||||
private CmsSubjectMapper subjectMapper;
|
||||
@Autowired
|
||||
private PmsCommentReplayMapper pmsCommentReplayMapper;
|
||||
@Autowired
|
||||
private PmsCommentMapper pmsCommentMapper;
|
||||
|
||||
@Autowired
|
||||
private PmsProductFullReductionMapper pmsProductFullReductionMapper;
|
||||
@Autowired
|
||||
private SmsHomeAdvertiseMapper advertiseMapper;
|
||||
@Autowired
|
||||
private HomeDao homeDao;
|
||||
@Autowired
|
||||
private SmsFlashPromotionMapper flashPromotionMapper;
|
||||
@Autowired
|
||||
private SmsFlashPromotionSessionMapper promotionSessionMapper;
|
||||
@Autowired
|
||||
private PmsProductMapper productMapper;
|
||||
@Autowired
|
||||
private PmsProductCategoryMapper productCategoryMapper;
|
||||
@Autowired
|
||||
private CmsSubjectMapper subjectMapper;
|
||||
@Autowired
|
||||
private PmsCommentReplayMapper pmsCommentReplayMapper;
|
||||
@Autowired
|
||||
private PmsCommentMapper pmsCommentMapper;
|
||||
|
||||
@Autowired
|
||||
private PmsProductAttributeMapper pmsProductAttributeMapper;
|
||||
|
||||
@Autowired
|
||||
private PmsProductAttributeValueMapper productAttributeValueMapper;
|
||||
|
||||
@Autowired
|
||||
private MemberProductCollectionRepository productCollectionRepository;
|
||||
|
||||
@Autowired
|
||||
private PmsSkuStockMapper skuStockMapper;
|
||||
|
||||
@Autowired
|
||||
private UmsMemberService memberService;
|
||||
|
||||
@Autowired
|
||||
@Autowired
|
||||
private PmsProductFullReductionMapper pmsProductFullReductionMapper;
|
||||
|
||||
@Autowired
|
||||
private PmsProductAttributeMapper pmsProductAttributeMapper;
|
||||
|
||||
@Autowired
|
||||
private PmsProductAttributeValueMapper productAttributeValueMapper;
|
||||
|
||||
@Autowired
|
||||
private MemberProductCollectionRepository productCollectionRepository;
|
||||
|
||||
@Autowired
|
||||
private PmsSkuStockMapper skuStockMapper;
|
||||
|
||||
@Autowired
|
||||
private UmsMemberService memberService;
|
||||
|
||||
@Autowired
|
||||
private PortalCommonService commonService;
|
||||
|
||||
@Override
|
||||
public HomeContentResult content() {
|
||||
|
||||
HomeContentResult result = new HomeContentResult();
|
||||
//获取首页广告
|
||||
result.setAdvertiseList(getHomeAdvertiseList());
|
||||
//获取推荐品牌
|
||||
result.setBrandList(homeDao.getRecommendBrandList(0,4));
|
||||
//获取秒杀信息
|
||||
result.setHomeFlashPromotion(getHomeFlashPromotion());
|
||||
|
||||
List<PmsProduct> newProductList = homeDao.getNewProductList(0, 4);
|
||||
List<PmsProduct> hotProductList = homeDao.getHotProductList(0, 4);
|
||||
List<PmsProduct> allProductList = homeDao.getAllPioductList();
|
||||
|
||||
//根据会员等级显示不同的商品价格
|
||||
UmsMember member = memberService.getCurrentMember();
|
||||
if(member != null) {
|
||||
BigDecimal discount = commonService.getDiscount(member.getId());
|
||||
if(discount != null) {
|
||||
for(PmsProduct product : newProductList) {
|
||||
product.setPrice(product.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
for(PmsProduct product : hotProductList) {
|
||||
product.setPrice(product.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
for(PmsProduct product : allProductList) {
|
||||
product.setPrice(product.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//获取新品推荐
|
||||
result.setNewProductList(newProductList);
|
||||
//获取人气推荐
|
||||
result.setHotProductList(hotProductList);
|
||||
//获取推荐专题
|
||||
//result.setSubjectList(homeDao.getRecommendSubjectList(0,4));
|
||||
//获取上次所有商品,按销量排序
|
||||
result.setAllProductList(allProductList);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PmsProduct> recommendProductList(Integer pageSize, Integer pageNum) {
|
||||
// TODO: 2019/1/29 暂时默认推荐所有商品
|
||||
PageHelper.startPage(pageNum,pageSize);
|
||||
PmsProductExample example = new PmsProductExample();
|
||||
example.createCriteria()
|
||||
.andDeleteStatusEqualTo(0)
|
||||
.andPublishStatusEqualTo(1);
|
||||
return productMapper.selectByExample(example);
|
||||
}
|
||||
@Override
|
||||
public HomeContentResult content() {
|
||||
|
||||
@Override
|
||||
public List<ProductCategoryOptions> getProductCateList() {
|
||||
PmsProductCategoryExample example = new PmsProductCategoryExample();
|
||||
example.createCriteria()
|
||||
.andShowStatusEqualTo(1);
|
||||
example.setOrderByClause("sort desc");
|
||||
List<PmsProductCategory> productCategories = productCategoryMapper.selectByExample(example);
|
||||
|
||||
List<ProductCategoryOptions> options = new ArrayList<>();
|
||||
for(PmsProductCategory category : productCategories) {
|
||||
//我们这里最大的根节点ID是0,所以找出所有parent id为0的节点,然后调用我们的递归算法
|
||||
if(category.getParentId().equals(0L)){
|
||||
options.add(recursionCategory(category, productCategories));
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
private ProductCategoryOptions recursionCategory(PmsProductCategory category, List<PmsProductCategory> list) {
|
||||
List<ProductCategoryOptions> childList = new ArrayList<>();
|
||||
// 为每一个父节点增加子树(List形式,没有则为空的list)
|
||||
ProductCategoryOptions node = new ProductCategoryOptions();
|
||||
node.setId(category.getId());
|
||||
node.setName(category.getName());
|
||||
node.setLevel(category.getLevel());
|
||||
node.setIcon(category.getIcon());
|
||||
node.setPid(category.getParentId());
|
||||
for (PmsProductCategory childCategory : list){
|
||||
//如果子节点的pid等于父节点的ID,则说明是父子关系
|
||||
if(childCategory.getParentId().equals(category.getId())){
|
||||
// 继续调用递归算法,将当前作为父节点,继续找他的子节点,反复执行。
|
||||
childList.add(recursionCategory(childCategory, list));
|
||||
}
|
||||
}
|
||||
|
||||
// 当遍历完成,返回调用的节点
|
||||
if(!childList.isEmpty()) {
|
||||
node.setChildren(childList);
|
||||
} else {
|
||||
node.setChildren(null);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
HomeContentResult result = new HomeContentResult();
|
||||
//获取首页广告
|
||||
result.setAdvertiseList(getHomeAdvertiseList());
|
||||
//获取推荐品牌
|
||||
result.setBrandList(homeDao.getRecommendBrandList(0, 4));
|
||||
//获取秒杀信息
|
||||
result.setHomeFlashPromotion(getHomeFlashPromotion());
|
||||
|
||||
@Override
|
||||
public List<CmsSubject> getSubjectList(Long cateId, Integer pageSize, Integer pageNum) {
|
||||
PageHelper.startPage(pageNum,pageSize);
|
||||
CmsSubjectExample example = new CmsSubjectExample();
|
||||
CmsSubjectExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andShowStatusEqualTo(1);
|
||||
if(cateId!=null){
|
||||
criteria.andCategoryIdEqualTo(cateId);
|
||||
}
|
||||
return subjectMapper.selectByExample(example);
|
||||
}
|
||||
List<PmsProduct> VipProductList = homeDao.getProductVipStatus(0, 4);
|
||||
List<PmsProduct> PointAreaProductList = homeDao.getProductpointSareaStatus(0, 4);
|
||||
List<PmsProduct> pointsExchangeProductList = homeDao.getProductpointsExchangeStatus(0, 4);
|
||||
List<PmsProduct> allProductList = homeDao.getAllPioductList();
|
||||
|
||||
private HomeFlashPromotion getHomeFlashPromotion() {
|
||||
HomeFlashPromotion homeFlashPromotion = new HomeFlashPromotion();
|
||||
//获取当前秒杀活动
|
||||
Date now = new Date();
|
||||
SmsFlashPromotion flashPromotion = getFlashPromotion(now);
|
||||
if (flashPromotion != null) {
|
||||
//获取当前秒杀场次
|
||||
SmsFlashPromotionSession flashPromotionSession = getFlashPromotionSession(now);
|
||||
if (flashPromotionSession != null) {
|
||||
homeFlashPromotion.setStartTime(flashPromotionSession.getStartTime());
|
||||
homeFlashPromotion.setEndTime(flashPromotionSession.getEndTime());
|
||||
homeFlashPromotion.setName(flashPromotion.getTitle());
|
||||
//获取下一个秒杀场次
|
||||
SmsFlashPromotionSession nextSession = getNextFlashPromotionSession(homeFlashPromotion.getStartTime());
|
||||
if(nextSession!=null){
|
||||
homeFlashPromotion.setNextStartTime(nextSession.getStartTime());
|
||||
homeFlashPromotion.setNextEndTime(nextSession.getEndTime());
|
||||
}
|
||||
//获取秒杀商品
|
||||
List<FlashPromotionProduct> flashProductList = homeDao.getFlashProductList(flashPromotion.getId(), flashPromotionSession.getId());
|
||||
homeFlashPromotion.setProductList(flashProductList);
|
||||
}
|
||||
}
|
||||
return homeFlashPromotion;
|
||||
}
|
||||
//根据会员等级显示不同的商品价格
|
||||
UmsMember member = memberService.getCurrentMember();
|
||||
if (member != null) {
|
||||
BigDecimal discount = commonService.getDiscount(member.getId());
|
||||
if (discount != null) {
|
||||
for (PmsProduct product : VipProductList) {
|
||||
product.setPrice(product.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
for (PmsProduct product : PointAreaProductList) {
|
||||
product.setPrice(product.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
// for (PmsProduct product : pointsExchangeProductList) {
|
||||
// product.setPrice(product.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
// }
|
||||
for (PmsProduct product : allProductList) {
|
||||
product.setPrice(product.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//获取下一个场次信息
|
||||
private SmsFlashPromotionSession getNextFlashPromotionSession(Date date) {
|
||||
SmsFlashPromotionSessionExample sessionExample = new SmsFlashPromotionSessionExample();
|
||||
sessionExample.createCriteria()
|
||||
.andStartTimeGreaterThan(date);
|
||||
sessionExample.setOrderByClause("start_time asc");
|
||||
List<SmsFlashPromotionSession> promotionSessionList = promotionSessionMapper.selectByExample(sessionExample);
|
||||
if (!CollectionUtils.isEmpty(promotionSessionList)) {
|
||||
return promotionSessionList.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//获取会员商品
|
||||
result.setVipProductList(VipProductList);
|
||||
//获取积分专区商品
|
||||
result.setPointsAreaProductList(PointAreaProductList);
|
||||
//获取积分兑换商品
|
||||
result.setPointsExchangeProductList(pointsExchangeProductList);
|
||||
//获取推荐专题
|
||||
//result.setSubjectList(homeDao.getRecommendSubjectList(0,4));
|
||||
//获取上次所有商品,按销量排序
|
||||
result.setAllProductList(allProductList);
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<SmsHomeAdvertise> getHomeAdvertiseList() {
|
||||
SmsHomeAdvertiseExample example = new SmsHomeAdvertiseExample();
|
||||
example.createCriteria().andTypeEqualTo(1).andStatusEqualTo(1);
|
||||
example.setOrderByClause("sort desc");
|
||||
return advertiseMapper.selectByExample(example);
|
||||
}
|
||||
@Override
|
||||
public List<PmsProduct> recommendProductList(Integer pageSize, Integer pageNum) {
|
||||
// TODO: 2019/1/29 暂时默认推荐所有商品
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
PmsProductExample example = new PmsProductExample();
|
||||
example.createCriteria()
|
||||
.andDeleteStatusEqualTo(0)
|
||||
.andPublishStatusEqualTo(1);
|
||||
return productMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
//根据时间获取秒杀活动
|
||||
private SmsFlashPromotion getFlashPromotion(Date date) {
|
||||
Date currDate = DateUtil.getDate(date);
|
||||
SmsFlashPromotionExample example = new SmsFlashPromotionExample();
|
||||
example.createCriteria()
|
||||
.andStatusEqualTo(1)
|
||||
.andStartDateLessThanOrEqualTo(currDate)
|
||||
.andEndDateGreaterThanOrEqualTo(currDate);
|
||||
List<SmsFlashPromotion> flashPromotionList = flashPromotionMapper.selectByExample(example);
|
||||
if (!CollectionUtils.isEmpty(flashPromotionList)) {
|
||||
return flashPromotionList.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public List<ProductCategoryOptions> getProductCateList() {
|
||||
PmsProductCategoryExample example = new PmsProductCategoryExample();
|
||||
example.createCriteria()
|
||||
.andShowStatusEqualTo(1);
|
||||
example.setOrderByClause("sort desc");
|
||||
List<PmsProductCategory> productCategories = productCategoryMapper.selectByExample(example);
|
||||
|
||||
//根据时间获取秒杀场次
|
||||
private SmsFlashPromotionSession getFlashPromotionSession(Date date) {
|
||||
Date currTime = DateUtil.getTime(date);
|
||||
SmsFlashPromotionSessionExample sessionExample = new SmsFlashPromotionSessionExample();
|
||||
sessionExample.createCriteria()
|
||||
.andStartTimeLessThanOrEqualTo(currTime)
|
||||
.andEndTimeGreaterThanOrEqualTo(currTime);
|
||||
List<SmsFlashPromotionSession> promotionSessionList = promotionSessionMapper.selectByExample(sessionExample);
|
||||
if (!CollectionUtils.isEmpty(promotionSessionList)) {
|
||||
return promotionSessionList.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//获取商品详情
|
||||
List<ProductCategoryOptions> options = new ArrayList<>();
|
||||
for (PmsProductCategory category : productCategories) {
|
||||
//我们这里最大的根节点ID是0,所以找出所有parent id为0的节点,然后调用我们的递归算法
|
||||
if (category.getParentId().equals(0L)) {
|
||||
options.add(recursionCategory(category, productCategories));
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
/**
|
||||
*获取会员专区商品
|
||||
*/
|
||||
@Override
|
||||
public List<PmsProduct> getVipProductList() {
|
||||
return homeDao.getVipStatusList();
|
||||
}
|
||||
|
||||
/**
|
||||
*获取积分专区商品
|
||||
*/
|
||||
@Override
|
||||
public List<PmsProduct> getPointProductList() {
|
||||
return homeDao.getPointStatusList();
|
||||
}
|
||||
|
||||
/**
|
||||
*获取积分兑换专区
|
||||
*/
|
||||
@Override
|
||||
public List<PmsProduct> getPointExchangeProductList() {
|
||||
return homeDao.getPointExchangeProductList();
|
||||
}
|
||||
private ProductCategoryOptions recursionCategory(PmsProductCategory category, List<PmsProductCategory> list) {
|
||||
List<ProductCategoryOptions> childList = new ArrayList<>();
|
||||
// 为每一个父节点增加子树(List形式,没有则为空的list)
|
||||
ProductCategoryOptions node = new ProductCategoryOptions();
|
||||
node.setId(category.getId());
|
||||
node.setName(category.getName());
|
||||
node.setLevel(category.getLevel());
|
||||
node.setIcon(category.getIcon());
|
||||
node.setPid(category.getParentId());
|
||||
for (PmsProductCategory childCategory : list) {
|
||||
//如果子节点的pid等于父节点的ID,则说明是父子关系
|
||||
if (childCategory.getParentId().equals(category.getId())) {
|
||||
// 继续调用递归算法,将当前作为父节点,继续找他的子节点,反复执行。
|
||||
childList.add(recursionCategory(childCategory, list));
|
||||
}
|
||||
}
|
||||
|
||||
// 当遍历完成,返回调用的节点
|
||||
if (!childList.isEmpty()) {
|
||||
node.setChildren(childList);
|
||||
} else {
|
||||
node.setChildren(null);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CmsSubject> getSubjectList(Long cateId, Integer pageSize, Integer pageNum) {
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
CmsSubjectExample example = new CmsSubjectExample();
|
||||
CmsSubjectExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andShowStatusEqualTo(1);
|
||||
if (cateId != null) {
|
||||
criteria.andCategoryIdEqualTo(cateId);
|
||||
}
|
||||
return subjectMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
private HomeFlashPromotion getHomeFlashPromotion() {
|
||||
HomeFlashPromotion homeFlashPromotion = new HomeFlashPromotion();
|
||||
//获取当前秒杀活动
|
||||
Date now = new Date();
|
||||
SmsFlashPromotion flashPromotion = getFlashPromotion(now);
|
||||
if (flashPromotion != null) {
|
||||
//获取当前秒杀场次
|
||||
SmsFlashPromotionSession flashPromotionSession = getFlashPromotionSession(now);
|
||||
if (flashPromotionSession != null) {
|
||||
homeFlashPromotion.setStartTime(flashPromotionSession.getStartTime());
|
||||
homeFlashPromotion.setEndTime(flashPromotionSession.getEndTime());
|
||||
homeFlashPromotion.setName(flashPromotion.getTitle());
|
||||
//获取下一个秒杀场次
|
||||
SmsFlashPromotionSession nextSession = getNextFlashPromotionSession(homeFlashPromotion.getStartTime());
|
||||
if (nextSession != null) {
|
||||
homeFlashPromotion.setNextStartTime(nextSession.getStartTime());
|
||||
homeFlashPromotion.setNextEndTime(nextSession.getEndTime());
|
||||
}
|
||||
//获取秒杀商品
|
||||
List<FlashPromotionProduct> flashProductList = homeDao.getFlashProductList(flashPromotion.getId(), flashPromotionSession.getId());
|
||||
homeFlashPromotion.setProductList(flashProductList);
|
||||
}
|
||||
}
|
||||
return homeFlashPromotion;
|
||||
}
|
||||
|
||||
//获取下一个场次信息
|
||||
private SmsFlashPromotionSession getNextFlashPromotionSession(Date date) {
|
||||
SmsFlashPromotionSessionExample sessionExample = new SmsFlashPromotionSessionExample();
|
||||
sessionExample.createCriteria()
|
||||
.andStartTimeGreaterThan(date);
|
||||
sessionExample.setOrderByClause("start_time asc");
|
||||
List<SmsFlashPromotionSession> promotionSessionList = promotionSessionMapper.selectByExample(sessionExample);
|
||||
if (!CollectionUtils.isEmpty(promotionSessionList)) {
|
||||
return promotionSessionList.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<SmsHomeAdvertise> getHomeAdvertiseList() {
|
||||
SmsHomeAdvertiseExample example = new SmsHomeAdvertiseExample();
|
||||
example.createCriteria().andTypeEqualTo(1).andStatusEqualTo(1);
|
||||
example.setOrderByClause("sort desc");
|
||||
return advertiseMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
//根据时间获取秒杀活动
|
||||
private SmsFlashPromotion getFlashPromotion(Date date) {
|
||||
Date currDate = DateUtil.getDate(date);
|
||||
SmsFlashPromotionExample example = new SmsFlashPromotionExample();
|
||||
example.createCriteria()
|
||||
.andStatusEqualTo(1)
|
||||
.andStartDateLessThanOrEqualTo(currDate)
|
||||
.andEndDateGreaterThanOrEqualTo(currDate);
|
||||
List<SmsFlashPromotion> flashPromotionList = flashPromotionMapper.selectByExample(example);
|
||||
if (!CollectionUtils.isEmpty(flashPromotionList)) {
|
||||
return flashPromotionList.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//根据时间获取秒杀场次
|
||||
private SmsFlashPromotionSession getFlashPromotionSession(Date date) {
|
||||
Date currTime = DateUtil.getTime(date);
|
||||
SmsFlashPromotionSessionExample sessionExample = new SmsFlashPromotionSessionExample();
|
||||
sessionExample.createCriteria()
|
||||
.andStartTimeLessThanOrEqualTo(currTime)
|
||||
.andEndTimeGreaterThanOrEqualTo(currTime);
|
||||
List<SmsFlashPromotionSession> promotionSessionList = promotionSessionMapper.selectByExample(sessionExample);
|
||||
if (!CollectionUtils.isEmpty(promotionSessionList)) {
|
||||
return promotionSessionList.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//获取商品详情
|
||||
@Override
|
||||
public ProductDetailResult getProductInfo(Long productId) {
|
||||
PmsProduct product = productMapper.selectByPrimaryKey(productId);
|
||||
@@ -301,15 +291,15 @@ public class HomeServiceImpl implements HomeService {
|
||||
List<String> result = Arrays.asList(detailResult.getAlbumPics().toString().split(","));
|
||||
detailResult.setListAlbumPics(result);
|
||||
detailResult.setAlbumPics(null);
|
||||
PmsProductFullReduction ppFullReduction =(PmsProductFullReduction)pmsProductFullReductionMapper.getPmsProductFullReduction(productId);
|
||||
PmsProductFullReduction ppFullReduction = (PmsProductFullReduction) pmsProductFullReductionMapper.getPmsProductFullReduction(productId);
|
||||
detailResult.setPmsProductFullReduction(ppFullReduction);//满减商品
|
||||
|
||||
|
||||
UmsMember currentMember = memberService.getCurrentMember();//获取用户信息
|
||||
if(currentMember == null) {
|
||||
if (currentMember == null) {
|
||||
detailResult.setWhetherTheCollection(0);//默认商品未收藏,1代表收藏
|
||||
} else {
|
||||
for(MemberProductCollection scproduct:productCollectionRepository.findByMemberId(currentMember.getId())){
|
||||
if(productId==scproduct.getProductId()){
|
||||
for (MemberProductCollection scproduct : productCollectionRepository.findByMemberId(currentMember.getId())) {
|
||||
if (productId == scproduct.getProductId()) {
|
||||
detailResult.setWhetherTheCollection(1);
|
||||
}
|
||||
}
|
||||
@@ -323,19 +313,19 @@ public class HomeServiceImpl implements HomeService {
|
||||
List<ProductAttributeResult> specChildList = new ArrayList<>();
|
||||
ProductAttributeResult spec = null;
|
||||
ProductAttributeResult specChild = null;
|
||||
String array [] = null;
|
||||
|
||||
for(PmsProductAttribute attribute : attributeList) {
|
||||
String array[] = null;
|
||||
|
||||
for (PmsProductAttribute attribute : attributeList) {
|
||||
spec = new ProductAttributeResult();
|
||||
spec.setId(attribute.getId());
|
||||
spec.setName(attribute.getName());
|
||||
specList.add(spec);
|
||||
|
||||
|
||||
//属性录入方式:0->手工录入;1->从列表中选取
|
||||
//是否支持手动新增;0->不支持;1->支持
|
||||
if(1 == attribute.getInputType() && 0 == attribute.getHandAddStatus()) {
|
||||
if (1 == attribute.getInputType() && 0 == attribute.getHandAddStatus()) {
|
||||
array = attribute.getInputList().split(",");
|
||||
for(int i=0; i<array.length; i++) {
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
specChild = new ProductAttributeResult();
|
||||
specChild.setPid(attribute.getId());
|
||||
specChild.setName(array[i]);
|
||||
@@ -345,9 +335,9 @@ public class HomeServiceImpl implements HomeService {
|
||||
PmsProductAttributeValueExample attributeValueExample = new PmsProductAttributeValueExample();
|
||||
attributeValueExample.createCriteria().andProductIdEqualTo(product.getId()).andProductAttributeIdEqualTo(attribute.getId());
|
||||
List<PmsProductAttributeValue> attributeValueList = productAttributeValueMapper.selectByExample(attributeValueExample);
|
||||
for(PmsProductAttributeValue value : attributeValueList) {
|
||||
for (PmsProductAttributeValue value : attributeValueList) {
|
||||
array = value.getValue().split(",");
|
||||
for(String s : array) {
|
||||
for (String s : array) {
|
||||
specChild = new ProductAttributeResult();
|
||||
specChild.setPid(attribute.getId());
|
||||
specChild.setName(s);
|
||||
@@ -356,31 +346,31 @@ public class HomeServiceImpl implements HomeService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
detailResult.setSpecList(specList);
|
||||
detailResult.setSpecChildList(specChildList);
|
||||
List<PmsComment> pmsComment =(List<PmsComment>) pmsCommentMapper.getPmsComment(productId);//评论基础信息
|
||||
if(pmsComment.size()>0){
|
||||
int i=pmsCommentMapper.getCountComment(productId);//评论总数
|
||||
int j=pmsCommentMapper.getApplauseCount(productId)*100/i;//好评率 好评数除以评论 总数 默认好评为大于等于2星
|
||||
detailResult.setCountComent(i);
|
||||
detailResult.setApplauseRate(j);
|
||||
for(int a=0;a<pmsComment.size();a++){
|
||||
List<PmsCommentReplay> pcr =(List<PmsCommentReplay>) pmsCommentReplayMapper.getPmsCommentReplay(pmsComment.get(a).getId());
|
||||
pmsComment.get(a).setPmsCommentReplay(pcr);//评论回复 逐个添加
|
||||
List<PmsComment> pmsComment = (List<PmsComment>) pmsCommentMapper.getPmsComment(productId);//评论基础信息
|
||||
if (pmsComment.size() > 0) {
|
||||
int i = pmsCommentMapper.getCountComment(productId);//评论总数
|
||||
int j = pmsCommentMapper.getApplauseCount(productId) * 100 / i;//好评率 好评数除以评论 总数 默认好评为大于等于2星
|
||||
detailResult.setCountComent(i);
|
||||
detailResult.setApplauseRate(j);
|
||||
for (int a = 0; a < pmsComment.size(); a++) {
|
||||
List<PmsCommentReplay> pcr = (List<PmsCommentReplay>) pmsCommentReplayMapper.getPmsCommentReplay(pmsComment.get(a).getId());
|
||||
pmsComment.get(a).setPmsCommentReplay(pcr);//评论回复 逐个添加
|
||||
}
|
||||
detailResult.setPmsComment(pmsComment);
|
||||
}
|
||||
detailResult.setPmsComment(pmsComment);
|
||||
}
|
||||
|
||||
|
||||
//根据会员等级显示不同的商品价格
|
||||
UmsMember member = memberService.getCurrentMember();
|
||||
if(member != null) {
|
||||
BigDecimal discount = commonService.getDiscount(member.getId());
|
||||
if(discount != null) {
|
||||
detailResult.setPrice(detailResult.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
}
|
||||
|
||||
if (member != null) {
|
||||
BigDecimal discount = commonService.getDiscount(member.getId());
|
||||
if (discount != null) {
|
||||
detailResult.setPrice(detailResult.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
}
|
||||
|
||||
return detailResult;
|
||||
}
|
||||
|
||||
@@ -389,79 +379,84 @@ public class HomeServiceImpl implements HomeService {
|
||||
PmsSkuStockExample example = new PmsSkuStockExample();
|
||||
PmsSkuStockExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andProductIdEqualTo(productId);
|
||||
if(!StringUtils.isEmpty(sp1)) { //mcoooo
|
||||
if (!StringUtils.isEmpty(sp1)) { //mcoooo
|
||||
criteria.andSp1EqualTo(sp1);
|
||||
}
|
||||
if(!StringUtils.isEmpty(sp2)) { //mcoooo
|
||||
if (!StringUtils.isEmpty(sp2)) { //mcoooo
|
||||
criteria.andSp2EqualTo(sp2);
|
||||
}
|
||||
if(!StringUtils.isEmpty(sp3)) {
|
||||
if (!StringUtils.isEmpty(sp3)) {
|
||||
criteria.andSp3EqualTo(sp3);
|
||||
}
|
||||
List<PmsSkuStock> list = skuStockMapper.selectByExample(example);
|
||||
ProductSkuResult skuResult = new ProductSkuResult();
|
||||
for(PmsSkuStock stock : list) {
|
||||
|
||||
PmsProduct product = productMapper.selectByPrimaryKey(productId);
|
||||
|
||||
if(product.getPointsExchangeStatus() == 1){
|
||||
skuResult.setIntergrationPrice(product.getIntergrationPrice());
|
||||
}
|
||||
for (PmsSkuStock stock : list) {
|
||||
BeanUtils.copyProperties(stock, skuResult);
|
||||
}
|
||||
|
||||
//根据会员等级显示不同的商品价格
|
||||
//根据会员等级显示不同的商品价格
|
||||
UmsMember member = memberService.getCurrentMember();
|
||||
if(member != null) {
|
||||
BigDecimal discount = commonService.getDiscount(member.getId());
|
||||
if(discount != null) {
|
||||
skuResult.setPrice(skuResult.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
}
|
||||
|
||||
if (member != null) {
|
||||
BigDecimal discount = commonService.getDiscount(member.getId());
|
||||
if (discount != null) {
|
||||
skuResult.setPrice(skuResult.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
}
|
||||
|
||||
return skuResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PmsProduct> getProductList(Long brandId, Long categoryId, String sortType,
|
||||
Integer pageSize, Integer pageNum) {
|
||||
Integer pageSize, Integer pageNum) {
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
PmsProductExample example = new PmsProductExample();
|
||||
PmsProductExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andDeleteStatusEqualTo(0);
|
||||
if(brandId != null) {
|
||||
if (brandId != null) {
|
||||
criteria.andBrandIdEqualTo(brandId);
|
||||
}
|
||||
if(categoryId != null) {
|
||||
if (categoryId != null) {
|
||||
criteria.andProductCategoryIdEqualTo(categoryId);
|
||||
}
|
||||
|
||||
|
||||
//综合排序
|
||||
if("1".equals(sortType)) {
|
||||
if ("1".equals(sortType)) {
|
||||
example.setOrderByClause("id asc");
|
||||
}
|
||||
//销量
|
||||
if("2".equals(sortType)) {
|
||||
if ("2".equals(sortType)) {
|
||||
example.setOrderByClause("sale desc");
|
||||
}
|
||||
//价格升序
|
||||
if("3".equals(sortType)) {
|
||||
if ("3".equals(sortType)) {
|
||||
example.setOrderByClause("price asc");
|
||||
}
|
||||
//价格降序
|
||||
if("4".equals(sortType)) {
|
||||
if ("4".equals(sortType)) {
|
||||
example.setOrderByClause("price desc");
|
||||
}
|
||||
|
||||
|
||||
List<PmsProduct> productList = productMapper.selectByExample(example);
|
||||
|
||||
|
||||
//根据会员等级显示不同的商品价格
|
||||
UmsMember member = memberService.getCurrentMember();
|
||||
if(member != null) {
|
||||
BigDecimal discount = commonService.getDiscount(member.getId());
|
||||
if(discount != null) {
|
||||
for(PmsProduct product : productList) {
|
||||
product.setPrice(product.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (member != null) {
|
||||
BigDecimal discount = commonService.getDiscount(member.getId());
|
||||
if (discount != null) {
|
||||
for (PmsProduct product : productList) {
|
||||
product.setPrice(product.getPrice().multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return productList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,410 @@
|
||||
package com.buy507.mall.portal.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.buy507.mall.mapper.*;
|
||||
import com.buy507.mall.model.*;
|
||||
import com.buy507.mall.portal.service.MemberCommissionService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class MemberPointsSplitProfitService{
|
||||
|
||||
@Resource
|
||||
private UmsMemberMapper memberMapper;
|
||||
/**
|
||||
* 会员分成流水
|
||||
*/
|
||||
@Resource
|
||||
private UmsMemberAccountTransactionMapper umsMemberAccountTransactionMapper;
|
||||
|
||||
/**
|
||||
* 会员上下关系
|
||||
*/
|
||||
@Resource
|
||||
private UmsMemberRelationTreeMapper umsMemberRelationTreeMapper;
|
||||
/**
|
||||
* 会员等级
|
||||
*/
|
||||
@Resource
|
||||
private UmsMemberLevelMapper umsMemberLevelMapper;
|
||||
|
||||
@Autowired
|
||||
private OmsOrderMapper orderMapper;
|
||||
|
||||
@Value("${becomeVipAmount}")
|
||||
private String becomeVipAmount;
|
||||
|
||||
@Value("${sameLevelProfit}")
|
||||
private String sameLevelProfit;
|
||||
|
||||
/**
|
||||
* 积分分润入口
|
||||
* @param order
|
||||
*/
|
||||
public void pointsSplit(OmsOrder order) {
|
||||
|
||||
UmsMember member = memberMapper.selectByPrimaryKey(order.getMemberId());
|
||||
//找到上级会员
|
||||
UmsMember higherLevelMember = this.findInOrderQueueMember(member.getId());;
|
||||
if(higherLevelMember != null){
|
||||
//进行订单分润
|
||||
this.splitProfitFroMember(member, higherLevelMember, order);
|
||||
}
|
||||
//计算会员等级
|
||||
UmsMemberRelationTree relationTree = this.getUpLevelRelationTreeById(member.getId());
|
||||
if(relationTree == null){
|
||||
return;
|
||||
}
|
||||
//上级为空或者为普通用户
|
||||
UmsMember higherMember = memberMapper.selectByPrimaryKey(relationTree.getHigherLevelId());
|
||||
if(higherMember == null && higherMember.getMemberLevel().equals(MemberLevel.Member)){
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 为订单上级进行分润
|
||||
* @param member
|
||||
* @param higherLevelMember
|
||||
* @param order
|
||||
*/
|
||||
private void splitProfitFroMember(UmsMember member, UmsMember higherLevelMember, OmsOrder order) {
|
||||
|
||||
//新订单及直属上级分润,返回的分润金额
|
||||
Integer revenuePoints = this.newMemberSplitProfit(member, higherLevelMember, order);
|
||||
|
||||
UmsMember moreHigherMember = new UmsMember();
|
||||
//如果上级是vip会员
|
||||
if(higherLevelMember.getMemberLevel().equals(MemberLevel.Consumer)) {
|
||||
moreHigherMember = this.findNextHigherLevelMemberByType(higherLevelMember.getId(), MemberLevel.Consumer);
|
||||
}
|
||||
//没有更高的上级退出分润
|
||||
if(moreHigherMember == null){
|
||||
return;
|
||||
}
|
||||
//给三个级别代理分润
|
||||
this.twoLevelSplitProfit(higherLevelMember, moreHigherMember, order, revenuePoints);
|
||||
|
||||
this.threeLevelSplitProfit(higherLevelMember, moreHigherMember, order, revenuePoints);
|
||||
|
||||
this.fourLevelSplitProfit(higherLevelMember, moreHigherMember, order, revenuePoints);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询到下一个级别的上级会员
|
||||
* @param id
|
||||
* @param consumer
|
||||
* @return
|
||||
*/
|
||||
private UmsMember findNextHigherLevelMemberByType(Long id, MemberLevel consumer) {
|
||||
//找到上级
|
||||
UmsMember moreHigherMember = this.findInOrderQueueMember(id);
|
||||
if(moreHigherMember == null){
|
||||
return null;
|
||||
}
|
||||
while (moreHigherMember != null){
|
||||
if(moreHigherMember.getMemberLevel().getValue() > consumer.getValue()){
|
||||
return moreHigherMember;
|
||||
}
|
||||
moreHigherMember = this.findInOrderQueueMember(moreHigherMember.getId());
|
||||
if(moreHigherMember == null){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return moreHigherMember;
|
||||
}
|
||||
|
||||
/**
|
||||
* 寻找上级
|
||||
*/
|
||||
private UmsMember findInOrderQueueMember(Long id) {
|
||||
UmsMemberRelationTree relationTree = this.getUpLevelRelationTreeById(id);
|
||||
if(relationTree == null){
|
||||
return null;
|
||||
}
|
||||
UmsMember higherMember = memberMapper.selectByPrimaryKey(relationTree.getHigherLevelId());
|
||||
if(higherMember == null){
|
||||
return null;
|
||||
}
|
||||
return higherMember;
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员分润
|
||||
* @param currentMember
|
||||
* @param higherLevelMember
|
||||
* @param order
|
||||
*/
|
||||
private Integer newMemberSplitProfit(UmsMember currentMember, UmsMember higherLevelMember, OmsOrder order){
|
||||
|
||||
//直推会员分润比例
|
||||
String ratio = "0."+ 3;
|
||||
|
||||
Integer revenuePoints = order.getPayAmount().multiply(new BigDecimal(ratio)).intValue();
|
||||
UmsMemberAccountTransaction accountTransaction = new UmsMemberAccountTransaction();
|
||||
accountTransaction.setMemberId(higherLevelMember.getId());
|
||||
accountTransaction.setOrderId(order.getId());
|
||||
accountTransaction.setRemarks("直推VIP积分分润");
|
||||
accountTransaction.setTransactionState(UmsMemberAccountTransaction.TRANSACTION_STATE_YES);
|
||||
accountTransaction.setRevenuePoints(revenuePoints);
|
||||
accountTransaction.setTransferPaymentTime(DateUtil.date());
|
||||
accountTransaction.setFlowType(2);
|
||||
umsMemberAccountTransactionMapper.insert(accountTransaction);
|
||||
log.info("new Account Transaction {}" , JSONUtil.toJsonStr(accountTransaction));
|
||||
|
||||
//会员积分到账
|
||||
higherLevelMember.setIntegration(revenuePoints + (higherLevelMember.getIntegration() == null ? 0 : higherLevelMember.getIntegration()));
|
||||
memberMapper.updateByPrimaryKey(higherLevelMember);
|
||||
|
||||
|
||||
return revenuePoints;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 二级店长分润
|
||||
* @param lowerMember
|
||||
* @param higherMember
|
||||
* @param order
|
||||
*/
|
||||
private void twoLevelSplitProfit(UmsMember lowerMember, UmsMember higherMember, OmsOrder order,
|
||||
Integer revenuePoints){
|
||||
//先判断是否为店长
|
||||
if(higherMember.getMemberLevel().equals(MemberLevel.Partner)){
|
||||
//上下级关系
|
||||
if(higherMember.getMemberLevel().getValue() > lowerMember.getMemberLevel().getValue()){
|
||||
|
||||
UmsMemberLevel lowerLevel = umsMemberLevelMapper.selectByPrimaryKey(lowerMember.getMemberLevelId());
|
||||
UmsMemberLevel higherLevel = umsMemberLevelMapper.selectByPrimaryKey(higherMember.getMemberLevelId());
|
||||
|
||||
Integer profitRatio = 0;
|
||||
if(higherLevel.getPointsRatio() != null && lowerLevel.getPointsRatio() != null){
|
||||
profitRatio = higherLevel.getPointsRatio() - lowerLevel.getPointsRatio();
|
||||
}
|
||||
String ratioStr = profitRatio < 10 ? "0.0" + profitRatio : "0."+profitRatio;
|
||||
//计算上级的分积分分润
|
||||
Integer pointsCommission = order.getPayAmount().multiply(new BigDecimal(ratioStr)).intValue();
|
||||
|
||||
UmsMemberAccountTransaction accountTransaction = new UmsMemberAccountTransaction();
|
||||
accountTransaction.setCommissionRatio(profitRatio);
|
||||
accountTransaction.setMemberId(higherMember.getId());
|
||||
accountTransaction.setOrderId(order.getId());
|
||||
accountTransaction.setRemarks("二级店长上级积分分润");
|
||||
accountTransaction.setRevenuePoints(pointsCommission);
|
||||
//即时到账
|
||||
accountTransaction.setTransferPaymentTime(DateUtil.date());
|
||||
accountTransaction.setFlowType(2);
|
||||
umsMemberAccountTransactionMapper.insert(accountTransaction);
|
||||
|
||||
//会员金额到账
|
||||
higherMember.setIntegration(pointsCommission + (higherMember.getIntegration() == null ? 0 : higherMember.getIntegration()));
|
||||
memberMapper.updateByPrimaryKeySelective(higherMember);
|
||||
|
||||
//查询上级
|
||||
UmsMember next = this.findInOrderQueueMember(higherMember.getId());
|
||||
|
||||
if(next != null){
|
||||
if (next.getMemberLevel().equals(higherMember.getMemberLevel())){
|
||||
twoLevelSplitProfit(higherMember, next, order, pointsCommission);
|
||||
}else {
|
||||
threeLevelSplitProfit(higherMember, next, order, pointsCommission);
|
||||
fourLevelSplitProfit(higherMember, next, order, pointsCommission);
|
||||
}
|
||||
}
|
||||
//平级关系
|
||||
}else if(lowerMember.getMemberLevel().equals(lowerMember.getMemberLevel())){
|
||||
Integer pointsCommission = revenuePoints * (new BigDecimal("0."+sameLevelProfit)).intValue();
|
||||
|
||||
UmsMemberAccountTransaction accountTransaction = new UmsMemberAccountTransaction();
|
||||
accountTransaction.setCommissionRatio(Integer.valueOf(sameLevelProfit));
|
||||
accountTransaction.setMemberId(higherMember.getId());
|
||||
accountTransaction.setOrderId(order.getId());
|
||||
accountTransaction.setRemarks("二级店长平级积分分润");
|
||||
accountTransaction.setRevenuePoints(pointsCommission);
|
||||
//即时到账
|
||||
accountTransaction.setTransferPaymentTime(DateUtil.date());
|
||||
accountTransaction.setFlowType(2);
|
||||
umsMemberAccountTransactionMapper.insert(accountTransaction);
|
||||
|
||||
//会员金额到账
|
||||
higherMember.setIntegration(pointsCommission + (higherMember.getIntegration() == null ? 0 : higherMember.getIntegration()));
|
||||
memberMapper.updateByPrimaryKeySelective(higherMember);
|
||||
|
||||
//查询比当前级别大的会员
|
||||
UmsMember next = this.findNextHigherLevelMemberByType(higherMember.getId(), MemberLevel.Partner);
|
||||
if(next != null){
|
||||
threeLevelSplitProfit(higherMember, next, order, pointsCommission);
|
||||
fourLevelSplitProfit(higherMember, next, order, pointsCommission);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 三级代理分润
|
||||
* @param lowerMember
|
||||
* @param higherMember
|
||||
* @param order
|
||||
*/
|
||||
private void threeLevelSplitProfit(UmsMember lowerMember, UmsMember higherMember, OmsOrder order, Integer revenuePoints){
|
||||
if(higherMember.getMemberLevel().equals(MemberLevel.Diamond)){
|
||||
//上下级关系
|
||||
if(higherMember.getMemberLevel().getValue() > lowerMember.getMemberLevel().getValue()){
|
||||
|
||||
UmsMemberLevel lowerLevel = umsMemberLevelMapper.selectByPrimaryKey(lowerMember.getMemberLevelId());
|
||||
UmsMemberLevel higherLevel = umsMemberLevelMapper.selectByPrimaryKey(higherMember.getMemberLevelId());
|
||||
|
||||
Integer profitRatio = 0;
|
||||
if(higherLevel.getPointsRatio() != null && lowerLevel.getPointsRatio() != null){
|
||||
profitRatio = higherLevel.getPointsRatio() - lowerLevel.getPointsRatio();
|
||||
}
|
||||
|
||||
String ratioStr = profitRatio < 10 ? "0.0" + profitRatio : "0."+profitRatio;
|
||||
//计算上级的分积分分润
|
||||
Integer pointsCommission = order.getPayAmount().multiply(new BigDecimal(ratioStr)).intValue();
|
||||
UmsMemberAccountTransaction accountTransaction = new UmsMemberAccountTransaction();
|
||||
accountTransaction.setCommissionRatio(profitRatio);
|
||||
accountTransaction.setMemberId(higherMember.getId());
|
||||
accountTransaction.setOrderId(order.getId());
|
||||
accountTransaction.setRemarks("三级代理上级积分分润");
|
||||
accountTransaction.setRevenuePoints(pointsCommission);
|
||||
accountTransaction.setTransferPaymentTime(DateUtil.date());
|
||||
accountTransaction.setFlowType(2);
|
||||
umsMemberAccountTransactionMapper.insert(accountTransaction);
|
||||
|
||||
//会员金额到账
|
||||
higherMember.setIntegration(pointsCommission + (higherMember.getIntegration() == null ? 0 : higherMember.getIntegration()));
|
||||
memberMapper.updateByPrimaryKeySelective(higherMember);
|
||||
|
||||
//查询上级
|
||||
UmsMember next = this.findInOrderQueueMember(higherMember.getId());
|
||||
|
||||
if(next != null){
|
||||
if (next.getMemberLevel().equals(higherMember.getMemberLevel())){
|
||||
threeLevelSplitProfit(higherMember, next, order, pointsCommission);
|
||||
}else {
|
||||
fourLevelSplitProfit(higherMember, next, order, pointsCommission);
|
||||
}
|
||||
}
|
||||
//平级关系
|
||||
}else if(lowerMember.getMemberLevel().equals(lowerMember.getMemberLevel())){
|
||||
Integer pointsCommission = revenuePoints * (new BigDecimal("0."+sameLevelProfit)).intValue();
|
||||
UmsMemberAccountTransaction accountTransaction = new UmsMemberAccountTransaction();
|
||||
accountTransaction.setCommissionRatio(Integer.valueOf(sameLevelProfit));
|
||||
accountTransaction.setMemberId(higherMember.getId());
|
||||
accountTransaction.setOrderId(order.getId());
|
||||
accountTransaction.setRemarks("三级代理平级积分分润");
|
||||
accountTransaction.setRevenuePoints(pointsCommission);
|
||||
//24小时后到账
|
||||
accountTransaction.setTransferPaymentTime(DateUtil.tomorrow());
|
||||
accountTransaction.setFlowType(2);
|
||||
umsMemberAccountTransactionMapper.insert(accountTransaction);
|
||||
|
||||
//会员金额到账
|
||||
higherMember.setIntegration(pointsCommission + (higherMember.getIntegration() == null ? 0 : higherMember.getIntegration()));
|
||||
memberMapper.updateByPrimaryKeySelective(higherMember);
|
||||
|
||||
UmsMember next = this.findNextHigherLevelMemberByType(higherMember.getId(), MemberLevel.Diamond);
|
||||
if(next != null){
|
||||
fourLevelSplitProfit(higherMember, next, order, pointsCommission);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 四级市代分润
|
||||
* @param lowerMember
|
||||
* @param higherMember
|
||||
* @param order
|
||||
*/
|
||||
private void fourLevelSplitProfit(UmsMember lowerMember, UmsMember higherMember, OmsOrder order, Integer revenuePoints){
|
||||
if(higherMember.getMemberLevel().equals(MemberLevel.OneDiamond)){
|
||||
//上下级关系
|
||||
if(higherMember.getMemberLevel().getValue() > lowerMember.getMemberLevel().getValue()){
|
||||
|
||||
UmsMemberLevel lowerLevel = umsMemberLevelMapper.selectByPrimaryKey(lowerMember.getMemberLevelId());
|
||||
UmsMemberLevel higherLevel = umsMemberLevelMapper.selectByPrimaryKey(higherMember.getMemberLevelId());
|
||||
|
||||
Integer profitRatio = 0;
|
||||
if(higherLevel.getPointsRatio() != null && lowerLevel.getPointsRatio() != null){
|
||||
profitRatio = higherLevel.getPointsRatio() - lowerLevel.getPointsRatio();
|
||||
}
|
||||
String ratioStr = profitRatio < 10 ? "0.0" + profitRatio : "0."+profitRatio;
|
||||
//计算上级的分积分分润
|
||||
Integer pointsCommission = order.getPayAmount().multiply(new BigDecimal(ratioStr)).intValue();
|
||||
UmsMemberAccountTransaction accountTransaction = new UmsMemberAccountTransaction();
|
||||
accountTransaction.setCommissionRatio(profitRatio);
|
||||
accountTransaction.setMemberId(higherMember.getId());
|
||||
accountTransaction.setOrderId(order.getId());
|
||||
accountTransaction.setRemarks("四级市代理上级积分分润");
|
||||
accountTransaction.setRevenuePoints(pointsCommission);
|
||||
//24小时后到账
|
||||
accountTransaction.setTransferPaymentTime(DateUtil.date());
|
||||
accountTransaction.setFlowType(2);
|
||||
umsMemberAccountTransactionMapper.insert(accountTransaction);
|
||||
|
||||
//会员金额到账
|
||||
higherMember.setIntegration(pointsCommission + (higherMember.getIntegration() == null ? 0 : higherMember.getIntegration()));
|
||||
memberMapper.updateByPrimaryKeySelective(higherMember);
|
||||
|
||||
//查询上级
|
||||
UmsMember next = this.findInOrderQueueMember(higherMember.getId());
|
||||
|
||||
if(next != null && next.getMemberLevel().equals(higherMember.getMemberLevel())){
|
||||
fourLevelSplitProfit(higherMember, next, order, pointsCommission);
|
||||
}
|
||||
//平级关系
|
||||
}else if(lowerMember.getMemberLevel().equals(lowerMember.getMemberLevel())){
|
||||
Integer pointsCommission = revenuePoints * (new BigDecimal("0."+sameLevelProfit)).intValue();
|
||||
UmsMemberAccountTransaction accountTransaction = new UmsMemberAccountTransaction();
|
||||
accountTransaction.setCommissionRatio(Integer.valueOf(sameLevelProfit));
|
||||
accountTransaction.setMemberId(higherMember.getId());
|
||||
accountTransaction.setOrderId(order.getId());
|
||||
accountTransaction.setRemarks("四级市代理平级积分分润");
|
||||
accountTransaction.setFlowType(2);
|
||||
accountTransaction.setRevenuePoints(pointsCommission);
|
||||
|
||||
//会员金额到账
|
||||
higherMember.setIntegration(pointsCommission + (higherMember.getIntegration() == null ? 0 : higherMember.getIntegration()));
|
||||
memberMapper.updateByPrimaryKeySelective(higherMember);
|
||||
|
||||
//24小时后到账
|
||||
accountTransaction.setTransferPaymentTime(DateUtil.tomorrow());
|
||||
umsMemberAccountTransactionMapper.insert(accountTransaction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取会员的上级关系
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
private UmsMemberRelationTree getUpLevelRelationTreeById(Long id) {
|
||||
UmsMemberRelationTree relationTree = null;
|
||||
UmsMemberRelationTreeExample relationTreeExample = new UmsMemberRelationTreeExample();
|
||||
relationTreeExample.createCriteria().andMemberIdEqualTo(id);
|
||||
List<UmsMemberRelationTree> relationTreeList = umsMemberRelationTreeMapper.selectByExample(relationTreeExample);
|
||||
if(!relationTreeList.isEmpty()) {
|
||||
//找到上级关系
|
||||
relationTree = relationTreeList.get(0);
|
||||
}
|
||||
return relationTree;
|
||||
}
|
||||
}
|
||||
@@ -63,42 +63,6 @@ public class MemberSplitProfitService{
|
||||
|
||||
public void updateOderAndMemberInfo(OmsOrder order) {
|
||||
|
||||
/*UmsMember member = memberMapper.selectByPrimaryKey(order.getMemberId());
|
||||
//找到上级会员
|
||||
UmsMember higherLevelMember = this.findInOrderQueueMember(member.getId());;
|
||||
*
|
||||
* 先验证该订单是否是五联单加速,如果不是则普通计算上级提成
|
||||
* 如果是提成,则全额给上级
|
||||
|
||||
|
||||
|
||||
boolean splitForFiveQueue = false; //是否加速完成
|
||||
//在此判断是否是首单新用户
|
||||
UmsMemberOrderQueueExample orderQueueExample1 = new UmsMemberOrderQueueExample();
|
||||
orderQueueExample1.createCriteria().andMemberIdEqualTo(order.getMemberId());
|
||||
long memberOrderCount = umsMemberOrderQueueMapper.countByExample(orderQueueExample1);
|
||||
if(memberOrderCount == 1){
|
||||
splitForFiveQueue = fiveQuickQueueBusiness(order, member, higherLevelMember);
|
||||
}
|
||||
|
||||
//未进行满5联单分润,开始进行普通分润流程
|
||||
if(!splitForFiveQueue && higherLevelMember != null){
|
||||
//进行订单分润
|
||||
this.splitProfitFroMember(member, higherLevelMember, order);
|
||||
}
|
||||
|
||||
//计算会员等级
|
||||
UmsMemberRelationTree relationTree = this.getUpLevelRelationTreeById(member.getId());
|
||||
if(relationTree == null){
|
||||
return;
|
||||
}
|
||||
//上级为空或者为普通用户
|
||||
UmsMember higherMember = memberMapper.selectByPrimaryKey(relationTree.getHigherLevelId());
|
||||
if(higherMember == null && higherMember.getMemberLevel().equals(MemberLevel.Member)){
|
||||
return;
|
||||
}
|
||||
memberCommissionService.computeCommission(higherMember);*/
|
||||
|
||||
UmsMember member = memberMapper.selectByPrimaryKey(order.getMemberId());
|
||||
//找到上级会员
|
||||
UmsMember higherLevelMember = this.findInOrderQueueMember(member.getId());;
|
||||
@@ -211,6 +175,7 @@ public class MemberSplitProfitService{
|
||||
accountTransaction.setRemarks("会员此订单退出队列到账");
|
||||
accountTransaction.setRevenueAmount(orderQueue.getOrderAmount());
|
||||
accountTransaction.setTransferPaymentTime(DateUtil.date());
|
||||
accountTransaction.setFlowType(1);
|
||||
umsMemberAccountTransactionMapper.insert(accountTransaction);
|
||||
|
||||
//出局后订单状态置为2
|
||||
@@ -280,10 +245,6 @@ public class MemberSplitProfitService{
|
||||
if(higherQueue != null){
|
||||
return splitMark;
|
||||
}
|
||||
//添加帮助加速的订单号
|
||||
/*UmsMemberOrderQueue orderQ = umsMemberOrderQueueMapper.selectByExample(orderQueueExample);
|
||||
orderQ.setAccelerateOrderId(higherQueue.getOrderId());
|
||||
umsMemberOrderQueueMapper.updateByPrimaryKeySelective(orderQ);*/
|
||||
|
||||
//查找上级还有多少下级(查看同级别的用户)
|
||||
UmsMemberRelationTreeExample umrtExample = new UmsMemberRelationTreeExample();
|
||||
@@ -335,6 +296,7 @@ public class MemberSplitProfitService{
|
||||
accountTransaction.setRevenueAmount(higherQueue.getOrderAmount());
|
||||
//即时到账
|
||||
accountTransaction.setTransferPaymentTime(DateUtil.date());
|
||||
accountTransaction.setFlowType(1);
|
||||
umsMemberAccountTransactionMapper.insert(accountTransaction);
|
||||
|
||||
//快速出局后将订单状态置为2
|
||||
@@ -431,16 +393,6 @@ public class MemberSplitProfitService{
|
||||
umsMemberOrderQueueMapper.insert(record);
|
||||
log.info("new Order Queue {}" , JSONUtil.toJsonStr(record));
|
||||
|
||||
/*UmsMemberLevel higherLevel = umsMemberLevelMapper.selectByPrimaryKey(higherLevelMember.getMemberLevelId());
|
||||
//直推会员分润
|
||||
String ratio = "0."+higherLevel.getCommissionRatio();
|
||||
BigDecimal revenueAmount = order.getPayAmount().multiply(new BigDecimal(ratio)).setScale(2, RoundingMode.HALF_UP);
|
||||
UmsMemberAccountTransaction accountTransaction = new UmsMemberAccountTransaction();
|
||||
accountTransaction.setCommissionRatio(higherLevel.getCommissionRatio());*/
|
||||
|
||||
//UmsMemberLevel higherLevel = umsMemberLevelMapper.selectByPrimaryKey(higherLevelMember.getMemberLevelId());
|
||||
//直推会员分润
|
||||
//String ratio = "0."+higherLevel.getCommissionRatio(); mcoo Integer()
|
||||
String ratio = "0."+ 2;
|
||||
BigDecimal revenueAmount = order.getPayAmount().multiply(new BigDecimal(ratio)).setScale(2, RoundingMode.HALF_UP);
|
||||
UmsMemberAccountTransaction accountTransaction = new UmsMemberAccountTransaction();
|
||||
@@ -452,6 +404,7 @@ public class MemberSplitProfitService{
|
||||
accountTransaction.setRevenueAmount(revenueAmount);
|
||||
//
|
||||
accountTransaction.setTransferPaymentTime(DateUtil.date());
|
||||
accountTransaction.setFlowType(1);
|
||||
umsMemberAccountTransactionMapper.insert(accountTransaction);
|
||||
log.info("new Account Transaction {}" , JSONUtil.toJsonStr(accountTransaction));
|
||||
|
||||
@@ -495,6 +448,7 @@ public class MemberSplitProfitService{
|
||||
accountTransaction.setRevenueAmount(payAmountPercent);
|
||||
//即时到账
|
||||
accountTransaction.setTransferPaymentTime(DateUtil.date());
|
||||
accountTransaction.setFlowType(1);
|
||||
umsMemberAccountTransactionMapper.insert(accountTransaction);
|
||||
|
||||
//会员金额到账
|
||||
@@ -524,6 +478,7 @@ public class MemberSplitProfitService{
|
||||
accountTransaction.setRevenueAmount(tenPercent);
|
||||
//即时到账
|
||||
accountTransaction.setTransferPaymentTime(DateUtil.date());
|
||||
accountTransaction.setFlowType(1);
|
||||
umsMemberAccountTransactionMapper.insert(accountTransaction);
|
||||
|
||||
//会员金额到账
|
||||
@@ -570,6 +525,7 @@ public class MemberSplitProfitService{
|
||||
accountTransaction.setRemarks("三级代理上级分润");
|
||||
accountTransaction.setRevenueAmount(payAmountPercent);
|
||||
accountTransaction.setTransferPaymentTime(DateUtil.date());
|
||||
accountTransaction.setFlowType(1);
|
||||
umsMemberAccountTransactionMapper.insert(accountTransaction);
|
||||
|
||||
//会员金额到账
|
||||
@@ -597,6 +553,7 @@ public class MemberSplitProfitService{
|
||||
accountTransaction.setRevenueAmount(tenPercent);
|
||||
//24小时后到账
|
||||
accountTransaction.setTransferPaymentTime(DateUtil.tomorrow());
|
||||
accountTransaction.setFlowType(1);
|
||||
umsMemberAccountTransactionMapper.insert(accountTransaction);
|
||||
|
||||
//会员金额到账
|
||||
@@ -641,6 +598,7 @@ public class MemberSplitProfitService{
|
||||
accountTransaction.setRevenueAmount(payAmountPercent);
|
||||
//24小时后到账
|
||||
accountTransaction.setTransferPaymentTime(DateUtil.date());
|
||||
accountTransaction.setFlowType(1);
|
||||
umsMemberAccountTransactionMapper.insert(accountTransaction);
|
||||
|
||||
//会员金额到账
|
||||
@@ -670,6 +628,7 @@ public class MemberSplitProfitService{
|
||||
|
||||
//24小时后到账
|
||||
accountTransaction.setTransferPaymentTime(DateUtil.tomorrow());
|
||||
accountTransaction.setFlowType(1);
|
||||
umsMemberAccountTransactionMapper.insert(accountTransaction);
|
||||
}
|
||||
}
|
||||
@@ -688,14 +647,6 @@ public class MemberSplitProfitService{
|
||||
if(higherMember == null){
|
||||
return null;
|
||||
}
|
||||
/* if(higherMember.getOrderStatus() == 0){
|
||||
UmsMember nextMember = this.findInOrderQueueMember(higherMember.getId());
|
||||
if(nextMember != null){
|
||||
return nextMember;
|
||||
}
|
||||
}else if(higherMember.getOrderStatus() == 1){
|
||||
return higherMember;
|
||||
}*/
|
||||
if( higherMember.getOrderStatus() == 1){
|
||||
return higherMember;
|
||||
}
|
||||
@@ -715,7 +666,4 @@ public class MemberSplitProfitService{
|
||||
}
|
||||
return relationTree;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.buy507.mall.portal.service.impl;
|
||||
|
||||
import com.buy507.mall.portal.dao.MyWalletMapper;
|
||||
import com.buy507.mall.portal.service.MyWalletService;
|
||||
import com.buy507.mall.portal.vo.WalletCashVo;
|
||||
import com.buy507.mall.portal.vo.WalletPointsVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class MyWalletServiceImpl implements MyWalletService {
|
||||
|
||||
@Autowired
|
||||
private MyWalletMapper myWalletMapper;
|
||||
|
||||
/**
|
||||
* 获取现金余额和流水
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public WalletCashVo getBalanceAndCashFlow(Long userId) {
|
||||
|
||||
WalletCashVo walletCashVo = new WalletCashVo();
|
||||
//获取现金余额
|
||||
walletCashVo.setBalance(myWalletMapper.getBalance(userId));
|
||||
//获取现金流水
|
||||
walletCashVo.setCashVoList(myWalletMapper.getCashFlow(userId));
|
||||
|
||||
return walletCashVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取积分余额和流水
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public WalletPointsVo getIntegrationAndPointsFlow(Long userId) {
|
||||
WalletPointsVo walletPointsVo = new WalletPointsVo();
|
||||
|
||||
//获取积分余额
|
||||
walletPointsVo.setIntegration(myWalletMapper.getIntegration(userId));
|
||||
//获取积分流水
|
||||
walletPointsVo.setPointsVoList(myWalletMapper.getPointsFlow(userId));
|
||||
|
||||
return walletPointsVo;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -55,7 +55,7 @@ public class PortalCommonServiceImpl implements PortalCommonService {
|
||||
|
||||
/**
|
||||
* 获取会员的折扣
|
||||
* @param member
|
||||
* @param memberId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -128,6 +128,9 @@ public class UmsMemberServiceImpl implements UmsMemberService {
|
||||
|
||||
@Autowired
|
||||
private RedisLock redisLock;
|
||||
|
||||
@Resource
|
||||
private UmsDevelopmentFundMapper umsDevelopmentFundMapper;
|
||||
|
||||
@Value("${jwt.tokenHead}")
|
||||
private String tokenHead;
|
||||
@@ -510,7 +513,7 @@ public class UmsMemberServiceImpl implements UmsMemberService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemberInfoResult getMemberInfo() {
|
||||
public MemberInfoResult getMemberInfo() {
|
||||
UmsMember loginMember = getCurrentMember();
|
||||
UmsMember member = memberMapper.selectByPrimaryKey(loginMember.getId());
|
||||
DmsTeamTotalConsume teamTotalConsume = teamTotalConsumeMapper.selectOneByMemberId(loginMember.getId());
|
||||
@@ -563,7 +566,7 @@ public class UmsMemberServiceImpl implements UmsMemberService {
|
||||
result.setNickname(member.getNickname() == null ? "" : member.getNickname());
|
||||
result.setHeadPicture(member.getIcon() == null ? "" :member.getIcon());
|
||||
result.setGender(member.getGender());
|
||||
result.setMemberLevel(member.getMemberLevel().getValue());
|
||||
result.setMemberLevel(member.getMemberLevel().getValue()-1);
|
||||
result.setMemberId(loginMember.getId());
|
||||
result.setRealName(member.getRealName());
|
||||
result.setDetailAddress(member.getDetailAddress());
|
||||
@@ -618,7 +621,7 @@ public class UmsMemberServiceImpl implements UmsMemberService {
|
||||
if(teamLevel != null) {
|
||||
result.setInviter(memberMapper.selectByPrimaryKey(teamLevel.getParentId()).getNickname());
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -855,6 +858,12 @@ public class UmsMemberServiceImpl implements UmsMemberService {
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取提现申请列表
|
||||
* @param pageSize
|
||||
* @param pageNum
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<MemberWithdrawApplyResult> getWithdrawApply(Integer pageSize, Integer pageNum) {
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
@@ -863,6 +872,11 @@ public class UmsMemberServiceImpl implements UmsMemberService {
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员提现申请
|
||||
* @param applyParam
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public CommonResult withdrawApply(WithdrawApplyParam applyParam) {
|
||||
|
||||
@@ -904,7 +918,7 @@ public class UmsMemberServiceImpl implements UmsMemberService {
|
||||
}
|
||||
|
||||
if(applyParam.getValue() <= 0) {
|
||||
return CommonResult.validateFailed("提现积分无效");
|
||||
return CommonResult.validateFailed("提现无效");
|
||||
}
|
||||
|
||||
String withdrawMultipleStr = commonService.getDictionaryValue(Constants.D_WITHDRAW_MULTIPLE);
|
||||
@@ -1294,6 +1308,17 @@ public class UmsMemberServiceImpl implements UmsMemberService {
|
||||
return CommonResult.success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询发展基金
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public UmsDevelopmentFund getDevelopmentFund() {
|
||||
UmsDevelopmentFund developmentFund = new UmsDevelopmentFund();
|
||||
developmentFund = umsDevelopmentFundMapper.selectAll();
|
||||
return developmentFund;
|
||||
}
|
||||
|
||||
private Map<String, Object> getOrderInfoByDate(DateTime begin, DateTime end, UmsMember currentMember, List<Long> teamIdList) {
|
||||
|
||||
Map<String, Object> infoMap = new HashMap<>();
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.buy507.mall.portal.service.impl;
|
||||
|
||||
import cn.hutool.db.sql.Order;
|
||||
import com.buy507.mall.common.api.CommonResult;
|
||||
import com.buy507.mall.mapper.OmsOrderMapper;
|
||||
import com.buy507.mall.model.MemberLevel;
|
||||
import com.buy507.mall.model.OmsOrder;
|
||||
import com.buy507.mall.portal.domain.OrderParam;
|
||||
import com.buy507.mall.portal.domain.OrderResult;
|
||||
import com.buy507.mall.portal.service.RedisService;
|
||||
import com.buy507.mall.portal.service.VipCenterService;
|
||||
import com.buy507.mall.portal.vo.OmsOrderDTO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class VipCenterServiceImpl implements VipCenterService {
|
||||
|
||||
//店长升级金额
|
||||
@Value("${storeManagerAmount}")
|
||||
private BigDecimal storeManagerAmount;
|
||||
|
||||
//代理升级金额
|
||||
@Value("${agentAmount}")
|
||||
private BigDecimal agentAmount;
|
||||
|
||||
//市代理升级金额
|
||||
@Value("${cityAgentAmount}")
|
||||
private BigDecimal cityAgentAmount;
|
||||
|
||||
@Value("${redis.key.prefix.orderId}")
|
||||
private String REDIS_KEY_PREFIX_ORDER_ID;
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
@Autowired
|
||||
private OmsOrderMapper orderMapper;
|
||||
|
||||
@Override
|
||||
public BigDecimal getUpgradeAmount(Long memberLevelId) {
|
||||
BigDecimal amount = null;
|
||||
if (MemberLevel.Partner.getValue() == memberLevelId){
|
||||
amount = storeManagerAmount;
|
||||
}
|
||||
if (MemberLevel.Diamond.getValue() == memberLevelId){
|
||||
amount = agentAmount;
|
||||
}
|
||||
if (MemberLevel.OneDiamond.getValue() == memberLevelId){
|
||||
amount = cityAgentAmount;
|
||||
}
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建购买权益订单
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public CommonResult createUpgradeOrder(OmsOrderDTO param) {
|
||||
if (param == null){
|
||||
return CommonResult.validateFailed("订单数据为空");
|
||||
}else {
|
||||
//创建权益订单
|
||||
OmsOrder order = new OmsOrder();
|
||||
BeanUtils.copyProperties(param, order);
|
||||
order.setOrderSn(generateUpgradeOrderSn(param)); //生成orderSn
|
||||
order.setCreateTime(new Date()); //创建订单时间
|
||||
order.setStatus(0); //订单状态--未支付
|
||||
order.setOrderType(3); //订单类型--虚拟订单
|
||||
orderMapper.insert(order);
|
||||
|
||||
//返回订单id
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("orderId", order.getId());
|
||||
return CommonResult.success(result, "下单成功");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成18位订单编号:8位日期+2位订单类型+2位支付方式+6位以上自增id
|
||||
*/
|
||||
private String generateUpgradeOrderSn(OmsOrderDTO param) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String date = new SimpleDateFormat("yyyyMMdd").format(new Date());
|
||||
String key = REDIS_KEY_PREFIX_ORDER_ID + date;
|
||||
Long increment = redisService.increment(key, 1);
|
||||
sb.append(date);
|
||||
sb.append(String.format("%02d", param.getOrderType()));
|
||||
sb.append(String.format("%02d", param.getPayType()));
|
||||
String incrementStr = increment.toString();
|
||||
if (incrementStr.length() <= 6) {
|
||||
sb.append(String.format("%06d", increment));
|
||||
} else {
|
||||
sb.append(incrementStr);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.buy507.mall.portal.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class OmsOrderDTO {
|
||||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Long memberId;
|
||||
|
||||
@ApiModelProperty(value = "用户帐号")
|
||||
private String memberUsername;
|
||||
|
||||
@ApiModelProperty(value = "应付金额(实际支付金额)")
|
||||
private BigDecimal payAmount;
|
||||
|
||||
@ApiModelProperty(value = "支付方式:0->未支付;1->支付宝;2->微信;3->线下支付;4->积分支付;5—>余额支付")
|
||||
private Integer payType;
|
||||
|
||||
@ApiModelProperty(value = "订单类型:0->正常订单;1->秒杀订单;3->虚拟订单")
|
||||
private Integer orderType;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.buy507.mall.portal.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TransactionCashVo implements Serializable {
|
||||
|
||||
//现金数额
|
||||
private Integer revenueAmount;
|
||||
|
||||
//备注
|
||||
private String remarks;
|
||||
|
||||
//时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date transferPaymentTime;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.buy507.mall.portal.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TransactionPointsVo implements Serializable {
|
||||
//积分数额
|
||||
private Integer revenuePoints;
|
||||
|
||||
//备注
|
||||
private String remarks;
|
||||
|
||||
//时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date transferPaymentTime;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.buy507.mall.portal.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class WalletCashVo {
|
||||
|
||||
// 余额现金
|
||||
private BigDecimal balance;
|
||||
|
||||
//现金流水
|
||||
private List<TransactionCashVo> cashVoList;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.buy507.mall.portal.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class WalletPointsVo {
|
||||
// 余额积分
|
||||
private Integer integration;
|
||||
|
||||
//积分流水
|
||||
private List<TransactionPointsVo> pointsVoList;
|
||||
}
|
||||
@@ -104,4 +104,10 @@ alipay:
|
||||
# 成为vip金额
|
||||
becomeVipAmount: 899
|
||||
# 同等级分润比例
|
||||
sameLevelProfit: 10
|
||||
sameLevelProfit: 10
|
||||
#店长升级金额
|
||||
storeManagerAmount: 1000
|
||||
#代理升级金额
|
||||
agentAmount: 1000
|
||||
#市代理升级金额
|
||||
cityAgentAmount: 1000
|
||||
@@ -8,6 +8,9 @@ mybatis:
|
||||
mapper-locations:
|
||||
- classpath:dao/*.xml
|
||||
- classpath*:com/**/mapper/*.xml
|
||||
configuration:
|
||||
#开启驼峰命名
|
||||
map-underscore-to-camel-case: true
|
||||
|
||||
jwt:
|
||||
tokenHeader: Authorization #JWT存储的请求头
|
||||
|
||||
@@ -78,5 +78,56 @@
|
||||
hs.sort DESC
|
||||
LIMIT #{offset}, #{limit};
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getProductVipStatus" resultType="com.buy507.mall.model.PmsProduct">
|
||||
SELECT *
|
||||
FROM
|
||||
pms_product
|
||||
WHERE
|
||||
vip_status = 1
|
||||
LIMIT #{offset}, #{limit};
|
||||
</select>
|
||||
|
||||
<select id="getProductpointSareaStatus" resultType="com.buy507.mall.model.PmsProduct">
|
||||
SELECT *
|
||||
FROM
|
||||
pms_product
|
||||
WHERE
|
||||
points_area_status = 1
|
||||
LIMIT #{offset}, #{limit};
|
||||
</select>
|
||||
|
||||
<select id="getProductpointsExchangeStatus" resultType="com.buy507.mall.model.PmsProduct">
|
||||
|
||||
SELECT *
|
||||
FROM
|
||||
pms_product
|
||||
WHERE
|
||||
points_exchange_status = 1
|
||||
LIMIT #{offset}, #{limit};
|
||||
</select>
|
||||
|
||||
<select id="getVipStatusList" resultType="com.buy507.mall.model.PmsProduct">
|
||||
SELECT *
|
||||
FROM
|
||||
pms_product
|
||||
WHERE
|
||||
vip_status = 1
|
||||
</select>
|
||||
|
||||
<select id="getPointStatusList" resultType="com.buy507.mall.model.PmsProduct">
|
||||
SELECT *
|
||||
FROM
|
||||
pms_product
|
||||
WHERE
|
||||
points_area_status = 1
|
||||
</select>
|
||||
|
||||
<select id="getPointExchangeProductList" resultType="com.buy507.mall.model.PmsProduct">
|
||||
SELECT *
|
||||
FROM
|
||||
pms_product
|
||||
WHERE
|
||||
points_exchange_status = 1
|
||||
</select>
|
||||
</mapper>
|
||||
5
mall-portal/src/main/resources/dao/MyWalletMapper.xml
Normal file
5
mall-portal/src/main/resources/dao/MyWalletMapper.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.buy507.mall.portal.dao.MyWalletMapper">
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user