Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div
# Conflicts:
# fanli/src/main/java/com/yeshi/fanli/entity/redpack/RedPackDetail.java
# fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackBalanceServiceImpl.java
# fanli/src/main/java/com/yeshi/fanli/util/factory/RedPackDetailFactory.java
1个文件已删除
2 文件已重命名
28个文件已修改
46个文件已添加
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.shop; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsClass; |
| | | |
| | | public interface BanLiShopGoodsClassMapper extends BaseMapper<BanLiShopGoodsClass> { |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.shop; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsImg; |
| | | |
| | | public interface BanLiShopGoodsImgMapper extends BaseMapper<BanLiShopGoodsImg> { |
| | | |
| | | List<BanLiShopGoodsImg> listByGoodsId(Long goodsId); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.shop; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoods; |
| | | |
| | | public interface BanLiShopGoodsMapper extends BaseMapper<BanLiShopGoods> { |
| | | |
| | | BanLiShopGoods selectDetailByPrimaryKey(Long id); |
| | | |
| | | /** |
| | | * 商品列表查询 |
| | | * |
| | | * @param key |
| | | * @param state |
| | | * @param start |
| | | * @param count |
| | | * @return |
| | | */ |
| | | List<BanLiShopGoods> listGoods(@Param("key") String key, @Param("state") Integer state, @Param("start") long start, |
| | | @Param("count") int count); |
| | | |
| | | /** |
| | | * 商品计数 |
| | | * |
| | | * @param key |
| | | * @param state |
| | | * @return |
| | | */ |
| | | long countGoods(@Param("key") String key, @Param("state") Integer state); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.shop; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsSets; |
| | | |
| | | public interface BanLiShopGoodsSetsMapper extends BaseMapper<BanLiShopGoodsSets> { |
| | | |
| | | BanLiShopGoodsSets selectDetailByPrimaryKey(Long id); |
| | | |
| | | List<BanLiShopGoodsSets> listDetailByGoodsId(Long goodsId); |
| | | |
| | | long countByGoodsId(Long goodsId); |
| | | |
| | | List<BanLiShopGoodsSets> listByGoodsId(Long goodsId); |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.shop; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsSetsPay; |
| | | |
| | | public interface BanLiShopGoodsSetsPayMapper extends BaseMapper<BanLiShopGoodsSetsPay> { |
| | | |
| | | /** |
| | | * 根据套餐ID查询列表 |
| | | * @param goodsSetId |
| | | * @return |
| | | */ |
| | | List<BanLiShopGoodsSetsPay> listByGoodsSetId(Long goodsSetId); |
| | | |
| | | /** |
| | | * 根据套餐ID计数 |
| | | * @param goodsSetId |
| | | * @return |
| | | */ |
| | | long countByGoodsSetId(Long goodsSetId); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.shop; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.shop.BanLiShopOrder; |
| | | |
| | | public interface BanLiShopOrderMapper extends BaseMapper<BanLiShopOrder> { |
| | | |
| | | BanLiShopOrder selectByPrimaryKeyForUpdate(Long id); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dto.mq;
|
| | |
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
|
| | | public abstract class BaseMQMsgBody {
|
| | | private boolean test;// 是否是测试
|
| | |
|
| | | public BaseMQMsgBody() {
|
| | | this.test = Constant.IS_TEST;
|
| | | }
|
| | |
|
| | | public boolean isTest() {
|
| | | return test;
|
| | | }
|
| | |
|
| | | public void setTest(boolean test) {
|
| | | this.test = test;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dto.mq.order;
|
| | |
|
| | | import com.yeshi.fanli.dto.mq.order.body.BanLiShopOrderMQMsg;
|
| | | import com.yeshi.fanli.util.annotation.UserActive;
|
| | |
|
| | | public enum OrderTopicTagEnum {
|
| | | orderStatistic(UserActive.class), // 订单统计
|
| | | orderUpdate(UserActive.class), // 订单修改
|
| | | orderFanLiActual(UserActive.class), // 订单实时到账
|
| | | orderFanLiDelay(UserActive.class), // 订单到账延时消息
|
| | | banLiShopOrderDelay(BanLiShopOrderMQMsg.class),// 板栗商城下单
|
| | | banLiShopOrderRefund(BanLiShopOrderMQMsg.class);//板栗商城订单退款
|
| | |
|
| | | private final Class<?> clazz;
|
| | |
|
| | | private OrderTopicTagEnum(Class<?> clazz) {
|
| | | this.clazz = clazz;
|
| | | }
|
| | |
|
| | | public Class<?> getClazz() {
|
| | | return this.clazz;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dto.mq.order.body;
|
| | |
|
| | | import com.yeshi.fanli.dto.mq.BaseMQMsgBody;
|
| | |
|
| | | public class BanLiShopOrderMQMsg extends BaseMQMsgBody {
|
| | | private Long orderId;// 订单ID
|
| | | private Long uid;// 用户ID
|
| | |
|
| | | public BanLiShopOrderMQMsg(Long orderId, Long uid) {
|
| | | super();
|
| | | this.orderId = orderId;
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public BanLiShopOrderMQMsg() {
|
| | | super();
|
| | | }
|
| | |
|
| | | public Long getOrderId() {
|
| | | return orderId;
|
| | | }
|
| | |
|
| | | public void setOrderId(Long orderId) {
|
| | | this.orderId = orderId;
|
| | | }
|
| | |
|
| | | public Long getUid() {
|
| | | return uid;
|
| | | }
|
| | |
|
| | | public void setUid(Long uid) {
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | }
|
File was renamed from fanli/src/main/java/com/yeshi/fanli/dto/order/OrderMQMsgDTO.java |
| | |
| | | package com.yeshi.fanli.dto.order;
|
| | | package com.yeshi.fanli.dto.mq.order.body;
|
| | |
|
| | | import com.yeshi.fanli.dto.mq.BaseMQMsgBody;
|
| | |
|
| | | /**
|
| | | * 红包MQ消息
|
| | |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public class OrderMQMsgDTO {
|
| | | public class OrderMQMsg extends BaseMQMsgBody{
|
| | | private String orderId;
|
| | | private Integer type;
|
| | | private Long uid;
|
| | |
|
| | | public OrderMQMsgDTO(String orderId, Integer type, Long uid) {
|
| | | public OrderMQMsg(String orderId, Integer type, Long uid) {
|
| | | super();
|
| | | this.orderId = orderId;
|
| | | this.type = type;
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public OrderMQMsgDTO() {
|
| | | |
| | | public OrderMQMsg() {
|
| | | super();
|
| | | }
|
| | |
|
| | |
|
File was renamed from fanli/src/main/java/com/yeshi/fanli/dto/order/OrderMoneyRecievedMQMsgDTO.java |
| | |
| | | package com.yeshi.fanli.dto.order;
|
| | | package com.yeshi.fanli.dto.mq.order.body;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import com.yeshi.fanli.dto.mq.BaseMQMsgBody;
|
| | |
|
| | | /**
|
| | | * 订单到账MQ消息
|
| | |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public class OrderMoneyRecievedMQMsgDTO {
|
| | | public class OrderMoneyRecievedMQMsg extends BaseMQMsgBody {
|
| | | public static final int TYPE_ZIGOU = 1;// 自购到账
|
| | | public static final int TYPE_SHARE = 2;// 分享到账
|
| | | public static final int TYPE_INVITE = 3;// 邀请到账
|
| | |
| | | this.orderFirst = orderFirst;
|
| | | }
|
| | |
|
| | | public OrderMoneyRecievedMQMsgDTO() {
|
| | |
|
| | | public OrderMoneyRecievedMQMsg() {
|
| | | super();
|
| | | }
|
| | |
|
| | | public OrderMoneyRecievedMQMsgDTO(int type, Long uid, Integer sourceType, String orderId, BigDecimal money,
|
| | | public OrderMoneyRecievedMQMsg(int type, Long uid, Integer sourceType, String orderId, BigDecimal money,
|
| | | Date date) {
|
| | | super();
|
| | | this.type = type;
|
| | | this.uid = uid;
|
| | | this.sourceType = sourceType;
|
New file |
| | |
| | | package com.yeshi.fanli.dto.mq.user;
|
| | |
|
| | | import com.yeshi.fanli.util.annotation.UserActive;
|
| | |
|
| | | public enum UserTopicTagEnum {
|
| | | userAccountBinding(UserActive.class), // 用户账号绑定
|
| | | userActve(UserActive.class), // 用户活跃
|
| | | useSystemCoupon(UserActive.class), // 系统券使用
|
| | | inviteSuccess(UserActive.class), // 邀请成功
|
| | | integralTaskFinish(UserActive.class);// 完成金币任务
|
| | |
|
| | | private final Class<?> clazz;
|
| | |
|
| | | private UserTopicTagEnum(Class<?> clazz) {
|
| | | this.clazz = clazz;
|
| | | }
|
| | |
|
| | | public Class<?> getClazz() {
|
| | | return this.clazz;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dto.mq.user.body;
|
| | |
|
| | | import com.yeshi.fanli.dto.mq.BaseMQMsgBody;
|
| | |
|
| | | /**
|
| | | * 用券的mq消息实体
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public class UserSystemCouponUseMQMsg extends BaseMQMsgBody {
|
| | | private Long userSystemCouponId;// 用户的券ID
|
| | | private String orderId;// 订单号
|
| | | private Integer sourceType;// 订单来源
|
| | | private String couponType;// 券类型
|
| | |
|
| | | public UserSystemCouponUseMQMsg(Long userSystemCouponId, String orderId, Integer sourceType, String couponType) {
|
| | | super();
|
| | | this.userSystemCouponId = userSystemCouponId;
|
| | | this.orderId = orderId;
|
| | | this.sourceType = sourceType;
|
| | | this.couponType = couponType;
|
| | | }
|
| | |
|
| | | public String getCouponType() {
|
| | | return couponType;
|
| | | }
|
| | |
|
| | | public void setCouponType(String couponType) {
|
| | | this.couponType = couponType;
|
| | | }
|
| | |
|
| | | public UserSystemCouponUseMQMsg() {
|
| | | super();
|
| | | }
|
| | |
|
| | | public Long getUserSystemCouponId() {
|
| | | return userSystemCouponId;
|
| | | }
|
| | |
|
| | | public void setUserSystemCouponId(Long userSystemCouponId) {
|
| | | this.userSystemCouponId = userSystemCouponId;
|
| | | }
|
| | |
|
| | | public String getOrderId() {
|
| | | return orderId;
|
| | | }
|
| | |
|
| | | public void setOrderId(String orderId) {
|
| | | this.orderId = orderId;
|
| | | }
|
| | |
|
| | | public Integer getSourceType() {
|
| | | return sourceType;
|
| | | }
|
| | |
|
| | | public void setSourceType(Integer sourceType) {
|
| | | this.sourceType = sourceType;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | @Table("yeshi_red_pack_detail")
|
| | | public class RedPackDetail {
|
| | | public enum RedPackDetailTypeEnum {
|
| | | refund("红包退回", "http://img.flqapp.com/img/tlj/icon_tlj.png"),
|
| | | violation("红包涉嫌违规", "http://img.flqapp.com/img/tlj/icon_tlj.png"),
|
| | | newUserReward("新人奖励", "http://img.flqapp.com/img/tlj/icon_tlj.png"),
|
| | | invite("立得现金", "http://img.flqapp.com/img/tlj/icon_tlj.png"),
|
| | | increaseReward("递增奖励", "http://img.flqapp.com/img/tlj/icon_tlj.png"),
|
| | | seriesReward("连续奖励", "http://img.flqapp.com/img/tlj/icon_tlj.png"),
|
| | | refund("红包退回", "http://img.flqapp.com/img/tlj/icon_tlj.png"), |
| | | videoRecharge("视频会员充值", "http://img.flqapp.com/img/tlj/icon_tlj.png"), |
| | | musicRecharge("音乐会员充值", "http://img.flqapp.com/img/tlj/icon_tlj.png"), |
| | | violation("红包涉嫌违规", "http://img.flqapp.com/img/tlj/icon_tlj.png"),
|
| | | |
| | | giveOthers("红包赠送待领取中", "http://img.flqapp.com/resource/msg/icon_hongbao_give.png"),
|
| | | giveOthersSucceed("红包赠送领取成功", "http://img.flqapp.com/resource/msg/icon_hongbao_give.png"),
|
| | | giveOthersFail("红包赠送超时退回", "http://img.flqapp.com/resource/msg/icon_hongbao_give.png"),
|
| | | giveOthersReceive("好友赠送", "http://img.flqapp.com/resource/msg/icon_hongbao_give.png"),
|
| | | |
| | | useByShopOrder("商城订单使用", "http://img.flqapp.com/img/tlj/icon_tlj.png"),
|
| | | shopOrderDrawBack("商城订单退回", "http://img.flqapp.com/img/tlj/icon_tlj.png"),
|
| | | redExchange("红包提现中", "http://img.flqapp.com/resource/msg/icon_hongbao_tixian.png"),
|
| | | redExchangePass("红包提现成功", "http://img.flqapp.com/resource/msg/icon_hongbao_tixian.png"),
|
| | | redExchangeReject("红包提现失败", "http://img.flqapp.com/resource/msg/icon_hongbao_tixian.png");
|
| | |
| | | public String getDesc() {
|
| | | return desc;
|
| | | }
|
| | | |
| | |
|
| | | public String getPicture() {
|
| | | return picture;
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.shop;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | /**
|
| | | * 板栗商城商品
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_shop_goods")
|
| | | public class BanLiShopGoods {
|
| | | public final static int STATE_ONLINE = 1;// 在线
|
| | | public final static int STATE_OFFLINE = 0;// 下线
|
| | |
|
| | | @Column(name = "sg_id")
|
| | | private Long id;
|
| | | @Column(name = "sg_title")
|
| | | private String title;
|
| | | @Column(name = "sg_class_id")
|
| | | private BanLiShopGoodsClass goodsClass;
|
| | | @Column(name = "sg_sales_count")
|
| | | private Long salesCount;
|
| | | @Column(name = "sg_picture")
|
| | | private String picture;// 封面图标
|
| | | @Column(name = "sg_desc")
|
| | | private String desc;// 简介
|
| | | @Column(name = "sg_charge_type")
|
| | | private ChargeTypeEnum chargeType;// 充值类型 充值类商品有此属性
|
| | | @Column(name = "sg_state")
|
| | | private Integer state;// 商品状态 0-下线 1-在线
|
| | | @Column(name = "sg_create_time")
|
| | | private Date createTime;
|
| | | @Column(name = "sg_update_time")
|
| | | private Date updateTime;
|
| | | @Column(name = "sg_weight")
|
| | | private Integer weight;
|
| | |
|
| | | // 套餐
|
| | | private List<BanLiShopGoodsSets> setsList;
|
| | | // 图片
|
| | | private List<BanLiShopGoodsImg> imgList;
|
| | |
|
| | | public BanLiShopGoods() {
|
| | | }
|
| | |
|
| | | public BanLiShopGoods(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public List<BanLiShopGoodsImg> getImgList() {
|
| | | return imgList;
|
| | | }
|
| | |
|
| | | public void setImgList(List<BanLiShopGoodsImg> imgList) {
|
| | | this.imgList = imgList;
|
| | | }
|
| | |
|
| | | public List<BanLiShopGoodsSets> getSetsList() {
|
| | | return setsList;
|
| | | }
|
| | |
|
| | | public void setSetsList(List<BanLiShopGoodsSets> setsList) {
|
| | | this.setsList = setsList;
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public String getTitle() {
|
| | | return title;
|
| | | }
|
| | |
|
| | | public void setTitle(String title) {
|
| | | this.title = title;
|
| | | }
|
| | |
|
| | | public BanLiShopGoodsClass getGoodsClass() {
|
| | | return goodsClass;
|
| | | }
|
| | |
|
| | | public void setGoodsClass(BanLiShopGoodsClass goodsClass) {
|
| | | this.goodsClass = goodsClass;
|
| | | }
|
| | |
|
| | | public Long getSalesCount() {
|
| | | return salesCount;
|
| | | }
|
| | |
|
| | | public void setSalesCount(Long salesCount) {
|
| | | this.salesCount = salesCount;
|
| | | }
|
| | |
|
| | | public String getPicture() {
|
| | | return picture;
|
| | | }
|
| | |
|
| | | public void setPicture(String picture) {
|
| | | this.picture = picture;
|
| | | }
|
| | |
|
| | | public String getDesc() {
|
| | | return desc;
|
| | | }
|
| | |
|
| | | public void setDesc(String desc) {
|
| | | this.desc = desc;
|
| | | }
|
| | |
|
| | | public ChargeTypeEnum getChargeType() {
|
| | | return chargeType;
|
| | | }
|
| | |
|
| | | public void setChargeType(ChargeTypeEnum chargeType) {
|
| | | this.chargeType = chargeType;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | |
|
| | | public Integer getState() {
|
| | | return state;
|
| | | }
|
| | |
|
| | | public void setState(Integer state) {
|
| | | this.state = state;
|
| | | }
|
| | |
|
| | | public Integer getWeight() {
|
| | | return weight;
|
| | | }
|
| | |
|
| | | public void setWeight(Integer weight) {
|
| | | this.weight = weight;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.shop;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | /**
|
| | | * 商品分类
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_shop_goods_class")
|
| | | public class BanLiShopGoodsClass {
|
| | | @Column(name = "sgc_id")
|
| | | private Long id;
|
| | | @Column(name = "sgc_name")
|
| | | private String name;// 分类名称
|
| | | @Column(name = "sgc_picture")
|
| | | private String picture;// 分类图标
|
| | | @Column(name = "sgc_create_time")
|
| | | private Date createTime;
|
| | | @Column(name = "sgc_update_time")
|
| | | private Date updateTime;
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public String getName() {
|
| | | return name;
|
| | | }
|
| | |
|
| | | public void setName(String name) {
|
| | | this.name = name;
|
| | | }
|
| | |
|
| | | public String getPicture() {
|
| | | return picture;
|
| | | }
|
| | |
|
| | | public void setPicture(String picture) {
|
| | | this.picture = picture;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.shop;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | @Table("yeshi_ec_shop_goods_imgs")
|
| | | public class BanLiShopGoodsImg {
|
| | | @Column(name = "sgi_id")
|
| | | private Long id;
|
| | | @Column(name = "sgi_goods_id")
|
| | | private BanLiShopGoods goods;
|
| | | @Column(name = "sgi_url")
|
| | | private String url;
|
| | | @Column(name = "sgi_url_md5")
|
| | | private String urlMD5;
|
| | | @Column(name = "sgi_create_time")
|
| | | private Date createTime;
|
| | | @Column(name = "sgi_weight")
|
| | | private Integer weight;
|
| | |
|
| | | public Integer getWeight() {
|
| | | return weight;
|
| | | }
|
| | |
|
| | | public void setWeight(Integer weight) {
|
| | | this.weight = weight;
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public BanLiShopGoods getGoods() {
|
| | | return goods;
|
| | | }
|
| | |
|
| | | public void setGoods(BanLiShopGoods goods) {
|
| | | this.goods = goods;
|
| | | }
|
| | |
|
| | | public String getUrl() {
|
| | | return url;
|
| | | }
|
| | |
|
| | | public void setUrl(String url) {
|
| | | this.url = url;
|
| | | }
|
| | |
|
| | | public String getUrlMD5() {
|
| | | return urlMD5;
|
| | | }
|
| | |
|
| | | public void setUrlMD5(String urlMD5) {
|
| | | this.urlMD5 = urlMD5;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.shop;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | /**
|
| | | * 商品套餐
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_shop_goods_set")
|
| | | public class BanLiShopGoodsSets {
|
| | |
|
| | | public final static int STATE_ONLINE = 1;// 在线
|
| | | public final static int STATE_OFFLINE = 0;// 下线
|
| | |
|
| | | @Column(name = "sgs_id")
|
| | | private Long id;
|
| | | @Column(name = "sgs_name")
|
| | | private String name;// 套餐全名
|
| | | @Column(name = "sgs_sub_name")
|
| | | private String subName;// 套餐简称
|
| | | @Column(name = "sgs_goods_id")
|
| | | private BanLiShopGoods goods;// 商品
|
| | | @Column(name = "sgs_original_price")
|
| | | private BigDecimal originalPrice;// 原价/官方价
|
| | | @Column(name = "sgs_zk_price")
|
| | | private BigDecimal zkPrice;// 折扣价
|
| | | @Column(name = "sgs_sales_count")
|
| | | private Long salesCount;// 销量
|
| | | @Column(name = "sgs_stock")
|
| | | private Integer stock;// 库存
|
| | | @Column(name = "sgs_charge_fulu_num")
|
| | | private String chargeFuLuNum;// 福禄充值平台的商品ID
|
| | | @Column(name = "sgs_create_time")
|
| | | private Date createTime;
|
| | | @Column(name = "sgs_update_time")
|
| | | private Date updateTime;
|
| | | private List<BanLiShopGoodsSetsPay> payList;// 支付方式列表
|
| | | @Column(name = "sgs_weight")
|
| | | private Integer weight;
|
| | |
|
| | | @Column(name = "sgs_state")
|
| | | private Integer state;
|
| | |
|
| | | public String getSubName() {
|
| | | return subName;
|
| | | }
|
| | |
|
| | | public void setSubName(String subName) {
|
| | | this.subName = subName;
|
| | | }
|
| | |
|
| | | public Integer getState() {
|
| | | return state;
|
| | | }
|
| | |
|
| | | public void setState(Integer state) {
|
| | | this.state = state;
|
| | | }
|
| | |
|
| | | public Integer getWeight() {
|
| | | return weight;
|
| | | }
|
| | |
|
| | | public void setWeight(Integer weight) {
|
| | | this.weight = weight;
|
| | | }
|
| | |
|
| | | public List<BanLiShopGoodsSetsPay> getPayList() {
|
| | | return payList;
|
| | | }
|
| | |
|
| | | public void setPayList(List<BanLiShopGoodsSetsPay> payList) {
|
| | | this.payList = payList;
|
| | | }
|
| | |
|
| | | public String getChargeFuLuNum() {
|
| | | return chargeFuLuNum;
|
| | | }
|
| | |
|
| | | public void setChargeFuLuNum(String chargeFuLuNum) {
|
| | | this.chargeFuLuNum = chargeFuLuNum;
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public String getName() {
|
| | | return name;
|
| | | }
|
| | |
|
| | | public void setName(String name) {
|
| | | this.name = name;
|
| | | }
|
| | |
|
| | | public BanLiShopGoods getGoods() {
|
| | | return goods;
|
| | | }
|
| | |
|
| | | public void setGoods(BanLiShopGoods goods) {
|
| | | this.goods = goods;
|
| | | }
|
| | |
|
| | | public BigDecimal getOriginalPrice() {
|
| | | return originalPrice;
|
| | | }
|
| | |
|
| | | public void setOriginalPrice(BigDecimal originalPrice) {
|
| | | this.originalPrice = originalPrice;
|
| | | }
|
| | |
|
| | | public BigDecimal getZkPrice() {
|
| | | return zkPrice;
|
| | | }
|
| | |
|
| | | public void setZkPrice(BigDecimal zkPrice) {
|
| | | this.zkPrice = zkPrice;
|
| | | }
|
| | |
|
| | | public Long getSalesCount() {
|
| | | return salesCount;
|
| | | }
|
| | |
|
| | | public void setSalesCount(Long salesCount) {
|
| | | this.salesCount = salesCount;
|
| | | }
|
| | |
|
| | | public Integer getStock() {
|
| | | return stock;
|
| | | }
|
| | |
|
| | | public void setStock(Integer stock) {
|
| | | this.stock = stock;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.shop;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | /**
|
| | | * 套餐支付方式配置
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_shop_goods_set_pay")
|
| | | public class BanLiShopGoodsSetsPay {
|
| | | public static final int PAY_TYPE_HONGBAO = 1;// 红包支付
|
| | | public static final int PAY_TYPE_BALANCE = 2;// 账户余额支付
|
| | | public static final int PAY_TYPE_MONEY = 3;// 现金支付
|
| | | public static final int PAY_TYPE_HONGBAO_MONEY = 13;// 红包+现金支付
|
| | |
|
| | | @Column(name = "sp_id")
|
| | | private Long id;
|
| | | @Column(name = "sp_goods_set_id")
|
| | | private BanLiShopGoodsSets goodsSet;// 商品套餐
|
| | | @Column(name = "sp_discount")
|
| | | private BigDecimal disCount;// 折扣
|
| | | @Column(name = "sp_price_hongbao")
|
| | | private BigDecimal hongBaoPrice;// 红包支付价格
|
| | | @Column(name = "sp_price_balance")
|
| | | private BigDecimal balancePrice;// 余额支付价格
|
| | | @Column(name = "sp_price_money")
|
| | | private BigDecimal moneyPrice;// 现金支付价格
|
| | | @Column(name = "sp_pay_type")
|
| | | private Integer payType;// 支付方式
|
| | | @Column(name = "sp_tag")
|
| | | private String tag;// 标签
|
| | | @Column(name = "sp_create_time")
|
| | | private Date createTime;
|
| | | @Column(name = "sp_update_time")
|
| | | private Date updateTime;
|
| | | @Column(name = "sp_weight")
|
| | | private Integer weight;//排序权重
|
| | |
|
| | | public Integer getWeight() {
|
| | | return weight;
|
| | | }
|
| | |
|
| | | public void setWeight(Integer weight) {
|
| | | this.weight = weight;
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public BanLiShopGoodsSets getGoodsSet() {
|
| | | return goodsSet;
|
| | | }
|
| | |
|
| | | public void setGoodsSet(BanLiShopGoodsSets goodsSet) {
|
| | | this.goodsSet = goodsSet;
|
| | | }
|
| | |
|
| | | public BigDecimal getDisCount() {
|
| | | return disCount;
|
| | | }
|
| | |
|
| | | public void setDisCount(BigDecimal disCount) {
|
| | | this.disCount = disCount;
|
| | | }
|
| | |
|
| | | public BigDecimal getHongBaoPrice() {
|
| | | return hongBaoPrice;
|
| | | }
|
| | |
|
| | | public void setHongBaoPrice(BigDecimal hongBaoPrice) {
|
| | | this.hongBaoPrice = hongBaoPrice;
|
| | | }
|
| | |
|
| | | public BigDecimal getBalancePrice() {
|
| | | return balancePrice;
|
| | | }
|
| | |
|
| | | public void setBalancePrice(BigDecimal balancePrice) {
|
| | | this.balancePrice = balancePrice;
|
| | | }
|
| | |
|
| | | public BigDecimal getMoneyPrice() {
|
| | | return moneyPrice;
|
| | | }
|
| | |
|
| | | public void setMoneyPrice(BigDecimal moneyPrice) {
|
| | | this.moneyPrice = moneyPrice;
|
| | | }
|
| | |
|
| | | public Integer getPayType() {
|
| | | return payType;
|
| | | }
|
| | |
|
| | | public void setPayType(Integer payType) {
|
| | | this.payType = payType;
|
| | | }
|
| | |
|
| | | public String getTag() {
|
| | | return tag;
|
| | | }
|
| | |
|
| | | public void setTag(String tag) {
|
| | | this.tag = tag;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.shop;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | /**
|
| | | * 订单
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_shop_order")
|
| | | public class BanLiShopOrder {
|
| | |
|
| | | public final static int PAY_STATE_NOPAY = 0;// 未支付
|
| | | public final static int PAY_STATE_PAID = 1;// 已支付
|
| | | public final static int PAY_STATE_REFUND = 2;// 以退款
|
| | |
|
| | | public final static int STATE_INVALID = -1;// 失效
|
| | | public final static int STATE_NO_PAY = 0;// 未支付
|
| | | public final static int STATE_PART_PAY = 1;// 部分支付
|
| | | public final static int STATE_PAID = 5;// 已支付,待审核
|
| | | public final static int STATE_REJECT = 10;// 审核拒绝,退款中
|
| | | public final static int STATE_REJECT_REFUND_SUCCESS = 11;// 审核拒绝-退款成功
|
| | | public final static int STATE_REJECT_REFUND_FAIL = 12;// 审核拒绝-退款失败
|
| | | public final static int STATE_SUCCESS = 20;// 交易成功
|
| | |
|
| | | @Column(name = "so_id")
|
| | | private Long id;
|
| | | @Column(name = "so_uid")
|
| | | private Long uid;
|
| | | @Column(name = "so_order_no")
|
| | | private String orderNo;
|
| | | @Column(name = "so_goods_id")
|
| | | private BanLiShopGoods goods;
|
| | | @Column(name = "so_goods_set_id")
|
| | | private BanLiShopGoodsSets goodsSet;
|
| | | @Column(name = "so_payment_hongbao")
|
| | | private BigDecimal hongBaoPayment;// 红包支付金额
|
| | | @Column(name = "so_payment_hongbao_state")
|
| | | private Integer hongBaoPaymentState;// 支付金额状态
|
| | | @Column(name = "so_payment_money")
|
| | | private BigDecimal balancePayment;// 余额支付金额
|
| | | @Column(name = "so_payment_money_state")
|
| | | private Integer balancePaymentState;// 余额金额状态
|
| | | @Column(name = "so_payment_balance")
|
| | | private BigDecimal moneyPayment;// 现金支付金额
|
| | | @Column(name = "so_payment_balance_state")
|
| | | private Integer moneyPaymentState;// 现金金额状态
|
| | | @Column(name = "so_pay_time")
|
| | | private Date payTime;// 订单支付时间
|
| | | @Column(name = "so_reject_time")
|
| | | private Date rejectTime;// 拒绝时间
|
| | | @Column(name = "so_success_time")
|
| | | private Date successTime;// 交易成功时间
|
| | | @Column(name = "so_state") // -1-已失效 0-未支付 1-已支付,待审核 10-审核拒绝 20-交易成功
|
| | | private Integer state;// 状态
|
| | | @Column(name = "so_state_desc")
|
| | | private String stateDesc;// 状态简介
|
| | | @Column(name = "so_charge_account")
|
| | | private String chargeAccount;// 充值账号
|
| | | @Column(name = "so_charge_account2")
|
| | | private String chargeAccount2;// 充值账号2(备用)
|
| | | @Column(name = "so_beizhu")
|
| | | private String beiZhu;// 备注
|
| | | @Column(name = "so_create_time")
|
| | | private Date createTime;// 创建时间
|
| | | @Column(name = "so_update_time")
|
| | | private Date updateTime;// 更新时间
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public Long getUid() {
|
| | | return uid;
|
| | | }
|
| | |
|
| | | public void setUid(Long uid) {
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public String getOrderNo() {
|
| | | return orderNo;
|
| | | }
|
| | |
|
| | | public void setOrderNo(String orderNo) {
|
| | | this.orderNo = orderNo;
|
| | | }
|
| | |
|
| | | public BanLiShopGoods getGoods() {
|
| | | return goods;
|
| | | }
|
| | |
|
| | | public void setGoods(BanLiShopGoods goods) {
|
| | | this.goods = goods;
|
| | | }
|
| | |
|
| | | public BanLiShopGoodsSets getGoodsSet() {
|
| | | return goodsSet;
|
| | | }
|
| | |
|
| | | public void setGoodsSet(BanLiShopGoodsSets goodsSet) {
|
| | | this.goodsSet = goodsSet;
|
| | | }
|
| | |
|
| | | public BigDecimal getHongBaoPayment() {
|
| | | return hongBaoPayment;
|
| | | }
|
| | |
|
| | | public void setHongBaoPayment(BigDecimal hongBaoPayment) {
|
| | | this.hongBaoPayment = hongBaoPayment;
|
| | | }
|
| | |
|
| | | public Integer getHongBaoPaymentState() {
|
| | | return hongBaoPaymentState;
|
| | | }
|
| | |
|
| | | public void setHongBaoPaymentState(Integer hongBaoPaymentState) {
|
| | | this.hongBaoPaymentState = hongBaoPaymentState;
|
| | | }
|
| | |
|
| | | public BigDecimal getBalancePayment() {
|
| | | return balancePayment;
|
| | | }
|
| | |
|
| | | public void setBalancePayment(BigDecimal balancePayment) {
|
| | | this.balancePayment = balancePayment;
|
| | | }
|
| | |
|
| | | public Integer getBalancePaymentState() {
|
| | | return balancePaymentState;
|
| | | }
|
| | |
|
| | | public void setBalancePaymentState(Integer balancePaymentState) {
|
| | | this.balancePaymentState = balancePaymentState;
|
| | | }
|
| | |
|
| | | public BigDecimal getMoneyPayment() {
|
| | | return moneyPayment;
|
| | | }
|
| | |
|
| | | public void setMoneyPayment(BigDecimal moneyPayment) {
|
| | | this.moneyPayment = moneyPayment;
|
| | | }
|
| | |
|
| | | public Integer getMoneyPaymentState() {
|
| | | return moneyPaymentState;
|
| | | }
|
| | |
|
| | | public void setMoneyPaymentState(Integer moneyPaymentState) {
|
| | | this.moneyPaymentState = moneyPaymentState;
|
| | | }
|
| | |
|
| | | public Date getPayTime() {
|
| | | return payTime;
|
| | | }
|
| | |
|
| | | public void setPayTime(Date payTime) {
|
| | | this.payTime = payTime;
|
| | | }
|
| | |
|
| | | public Date getRejectTime() {
|
| | | return rejectTime;
|
| | | }
|
| | |
|
| | | public void setRejectTime(Date rejectTime) {
|
| | | this.rejectTime = rejectTime;
|
| | | }
|
| | |
|
| | | public Date getSuccessTime() {
|
| | | return successTime;
|
| | | }
|
| | |
|
| | | public void setSuccessTime(Date successTime) {
|
| | | this.successTime = successTime;
|
| | | }
|
| | |
|
| | | public Integer getState() {
|
| | | return state;
|
| | | }
|
| | |
|
| | | public void setState(Integer state) {
|
| | | this.state = state;
|
| | | }
|
| | |
|
| | | public String getStateDesc() {
|
| | | return stateDesc;
|
| | | }
|
| | |
|
| | | public void setStateDesc(String stateDesc) {
|
| | | this.stateDesc = stateDesc;
|
| | | }
|
| | |
|
| | | public String getChargeAccount() {
|
| | | return chargeAccount;
|
| | | }
|
| | |
|
| | | public void setChargeAccount(String chargeAccount) {
|
| | | this.chargeAccount = chargeAccount;
|
| | | }
|
| | |
|
| | | public String getChatgeAccount2() {
|
| | | return chargeAccount2;
|
| | | }
|
| | |
|
| | | public void setChatgeAccount2(String chargeAccount2) {
|
| | | this.chargeAccount2 = chargeAccount2;
|
| | | }
|
| | |
|
| | | public String getBeiZhu() {
|
| | | return beiZhu;
|
| | | }
|
| | |
|
| | | public void setBeiZhu(String beiZhu) {
|
| | | this.beiZhu = beiZhu;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.shop;
|
| | |
|
| | | public enum ChargeTypeEnum {
|
| | | qq("QQ号", "请输入常用QQ号码充值"), phone("手机号码", "请输入常用手机号");
|
| | | |
| | | private final String name;
|
| | | private final String desc;
|
| | |
|
| | | private ChargeTypeEnum(String name, String desc) {
|
| | | this.name = name;
|
| | | this.desc = desc;
|
| | | }
|
| | |
|
| | | public String getName() {
|
| | | return this.name;
|
| | | }
|
| | |
|
| | | public String getDesc() {
|
| | | return this.desc;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.exception.shop;
|
| | |
|
| | | import com.yeshi.fanli.exception.BaseException;
|
| | |
|
| | | public class BanLiShopGoodsException extends BaseException {
|
| | |
|
| | | private static final long serialVersionUID = 572112205824229000L;
|
| | |
|
| | | public BanLiShopGoodsException(int code, String msg) {
|
| | | super(code, msg);
|
| | | }
|
| | |
|
| | | public BanLiShopGoodsException() {
|
| | | super();
|
| | | }
|
| | | |
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.exception.shop;
|
| | |
|
| | | import com.yeshi.fanli.exception.BaseException;
|
| | |
|
| | | public class BanLiShopGoodsSetException extends BaseException {
|
| | |
|
| | | private static final long serialVersionUID = 572112205824229000L;
|
| | |
|
| | | public BanLiShopGoodsSetException(int code, String msg) {
|
| | | super(code, msg);
|
| | | }
|
| | |
|
| | | public BanLiShopGoodsSetException() {
|
| | | super();
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.exception.shop;
|
| | |
|
| | | import com.yeshi.fanli.exception.BaseException;
|
| | |
|
| | | public class BanLiShopGoodsSetPayException extends BaseException {
|
| | |
|
| | | private static final long serialVersionUID = 572112205824229000L;
|
| | |
|
| | | public BanLiShopGoodsSetPayException(int code, String msg) {
|
| | | super(code, msg);
|
| | | }
|
| | |
|
| | | public BanLiShopGoodsSetPayException() {
|
| | | super();
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.exception.shop;
|
| | |
|
| | | import com.yeshi.fanli.exception.BaseException;
|
| | |
|
| | | public class BanLiShopOrderException extends BaseException {
|
| | |
|
| | | private static final long serialVersionUID = 572112205824229000L;
|
| | |
|
| | | public BanLiShopOrderException(int code, String msg) {
|
| | | super(code, msg);
|
| | | }
|
| | |
|
| | | public BanLiShopOrderException() {
|
| | | super();
|
| | | }
|
| | | }
|
New file |
| | |
| | | <?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.yeshi.fanli.dao.mybatis.shop.BanLiShopGoodsClassMapper"> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.entity.shop.BanLiShopGoodsClass"> |
| | | <id column="sgc_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="sgc_name" property="name" jdbcType="VARCHAR" /> |
| | | <result column="sgc_picture" property="picture" jdbcType="VARCHAR" /> |
| | | <result column="sgc_create_time" property="createTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="sgc_update_time" property="updateTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">sgc_id,sgc_name,sgc_picture,sgc_create_time,sgc_update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_shop_goods_class where sgc_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_shop_goods_class where sgc_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoodsClass" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_shop_goods_class |
| | | (sgc_id,sgc_name,sgc_picture,sgc_create_time,sgc_update_time) values |
| | | (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoodsClass" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_shop_goods_class |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">sgc_id,</if> |
| | | <if test="name != null">sgc_name,</if> |
| | | <if test="picture != null">sgc_picture,</if> |
| | | <if test="createTime != null">sgc_create_time,</if> |
| | | <if test="updateTime != null">sgc_update_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="name != null">#{name,jdbcType=VARCHAR},</if> |
| | | <if test="picture != null">#{picture,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoodsClass">update |
| | | yeshi_ec_shop_goods_class set sgc_name = |
| | | #{name,jdbcType=VARCHAR},sgc_picture = |
| | | #{picture,jdbcType=VARCHAR},sgc_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},sgc_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} where sgc_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoodsClass"> |
| | | update yeshi_ec_shop_goods_class |
| | | <set> |
| | | <if test="name != null">sgc_name=#{name,jdbcType=VARCHAR},</if> |
| | | <if test="picture != null">sgc_picture=#{picture,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">sgc_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">sgc_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where sgc_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
New file |
| | |
| | | <?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.yeshi.fanli.dao.mybatis.shop.BanLiShopGoodsImgMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.shop.BanLiShopGoodsImg"> |
| | | <id column="sgi_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="sgi_url" property="url" jdbcType="VARCHAR" /> |
| | | <result column="sgi_url_md5" property="urlMD5" jdbcType="VARCHAR" /> |
| | | <result column="sgi_create_time" property="createTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="sgi_weight" property="weight" jdbcType="INTEGER" /> |
| | | <association property="goods" column="sgi_goods_id" |
| | | javaType="com.yeshi.fanli.entity.shop.BanLiShopGoods"> |
| | | <id column="sgi_goods_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | </resultMap> |
| | | <sql id="Base_Column_List">sgi_id,sgi_goods_id,sgi_url,sgi_url_md5,sgi_create_time,sgi_weight |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_shop_goods_imgs where sgi_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <select id="listByGoodsId" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_shop_goods_imgs where sgi_goods_id = #{0} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_shop_goods_imgs where sgi_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoodsImg" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_shop_goods_imgs |
| | | (sgi_id,sgi_goods_id,sgi_url,sgi_url_md5,sgi_create_time,sgi_weight) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{goods.id,jdbcType=BIGINT},#{url,jdbcType=VARCHAR},#{urlMD5,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{weight,jdbcType=INTEGER}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoodsImg" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_shop_goods_imgs |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">sgi_id,</if> |
| | | <if test="goods != null">sgi_goods_id,</if> |
| | | <if test="url != null">sgi_url,</if> |
| | | <if test="urlMD5 != null">sgi_url_md5,</if> |
| | | <if test="createTime != null">sgi_create_time,</if> |
| | | <if test="weight != null">sgi_weight,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="goods != null">#{goods.id,jdbcType=BIGINT},</if> |
| | | <if test="url != null">#{url,jdbcType=VARCHAR},</if> |
| | | <if test="urlMD5 != null">#{urlMD5,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="weight != null">#{weight,jdbcType=INTEGER}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoodsImg">update |
| | | yeshi_ec_shop_goods_imgs set sgi_goods_id = |
| | | #{goods.id,jdbcType=BIGINT},sgi_url = |
| | | #{url,jdbcType=VARCHAR},sgi_url_md5 = |
| | | #{urlMD5,jdbcType=VARCHAR},sgi_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP} ,sgi_weight |
| | | =#{weight,jdbcType=INTEGER} where sgi_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoodsImg"> |
| | | update yeshi_ec_shop_goods_imgs |
| | | <set> |
| | | <if test="goods != null">sgi_goods_id=#{goods.id,jdbcType=BIGINT},</if> |
| | | <if test="url != null">sgi_url=#{url,jdbcType=VARCHAR},</if> |
| | | <if test="urlMD5 != null">sgi_url_md5=#{urlMD5,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">sgi_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="weight !=null">sgi_weight =#{weight,jdbcType=INTEGER},</if> |
| | | </set> |
| | | where sgi_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
New file |
| | |
| | | <?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.yeshi.fanli.dao.mybatis.shop.BanLiShopGoodsMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.shop.BanLiShopGoods"> |
| | | <id column="sg_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="sg_title" property="title" jdbcType="VARCHAR" /> |
| | | <result column="sg_sales_count" property="salesCount" jdbcType="BIGINT" /> |
| | | <result column="sg_picture" property="picture" jdbcType="VARCHAR" /> |
| | | <result column="sg_desc" property="desc" jdbcType="VARCHAR" /> |
| | | <result column="sg_charge_type" property="chargeType" jdbcType="VARCHAR" /> |
| | | <result column="sg_state" property="state" jdbcType="INTEGER" /> |
| | | <result column="sg_create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="sg_update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | <result column="sg_weight" property="weight" jdbcType="INTEGER" /> |
| | | <association property="goodsClass" column="sg_class_id" |
| | | javaType="com.yeshi.fanli.entity.shop.BanLiShopGoodsClass"> |
| | | <id column="sg_class_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | </resultMap> |
| | | <resultMap id="BaseResultDetailMap" type="com.yeshi.fanli.entity.shop.BanLiShopGoods"> |
| | | <id column="sg_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="sg_title" property="title" jdbcType="VARCHAR" /> |
| | | <result column="sg_sales_count" property="salesCount" jdbcType="BIGINT" /> |
| | | <result column="sg_picture" property="picture" jdbcType="VARCHAR" /> |
| | | <result column="sg_desc" property="desc" jdbcType="VARCHAR" /> |
| | | <result column="sg_charge_type" property="chargeType" jdbcType="VARCHAR" /> |
| | | <result column="sg_state" property="state" jdbcType="INTEGER" /> |
| | | <result column="sg_create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="sg_update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | <result column="sg_weight" property="weight" jdbcType="INTEGER" /> |
| | | <association property="goodsClass" column="sg_class_id" |
| | | javaType="com.yeshi.fanli.entity.shop.BanLiShopGoodsClass" |
| | | select="com.yeshi.fanli.dao.mybatis.shop.BanLiShopGoodsClassMapper.selectByPrimaryKey" /> |
| | | <collection property="setsList" column="sg_id" |
| | | select="com.yeshi.fanli.dao.mybatis.shop.BanLiShopGoodsSetsMapper.listDetailByGoodsId" /> |
| | | <collection property="imgList" column="sg_id" |
| | | select="com.yeshi.fanli.dao.mybatis.shop.BanLiShopGoodsImgMapper.listByGoodsId" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">sg_id,sg_title,sg_class_id,sg_sales_count,sg_picture,sg_desc,sg_charge_type,sg_state,sg_create_time,sg_update_time,sg_weight |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_shop_goods where sg_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <select id="selectDetailByPrimaryKey" resultMap="BaseResultDetailMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_shop_goods where sg_id = #{0} |
| | | </select> |
| | | |
| | | <select id="listGoods" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_shop_goods where sg_title like '${key}%' |
| | | <if test="state!=null"> |
| | | and sg_state=#{state} |
| | | </if> |
| | | order by sg_weight desc #{start},#{count} |
| | | </select> |
| | | |
| | | <select id="countGoods" resultType="java.lang.Long"> |
| | | select |
| | | count(*) |
| | | from yeshi_ec_shop_goods where sg_title like '${key}%' |
| | | <if test="state!=null"> |
| | | and sg_state=#{state} |
| | | </if> |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_shop_goods where sg_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoods" |
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_shop_goods |
| | | (sg_id,sg_title,sg_class_id,sg_sales_count,sg_picture,sg_desc,sg_charge_type,sg_state,sg_create_time,sg_update_time,sg_weight) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{title,jdbcType=VARCHAR},#{goodsClass.id,jdbcType=BIGINT},#{salesCount,jdbcType=BIGINT},#{picture,jdbcType=VARCHAR},#{desc,jdbcType=VARCHAR},#{chargeType,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{weight,jdbcType=INTEGER}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoods" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_shop_goods |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">sg_id,</if> |
| | | <if test="title != null">sg_title,</if> |
| | | <if test="goodsClass != null">sg_class_id,</if> |
| | | <if test="salesCount != null">sg_sales_count,</if> |
| | | <if test="picture != null">sg_picture,</if> |
| | | <if test="desc != null">sg_desc,</if> |
| | | <if test="chargeType != null">sg_charge_type,</if> |
| | | <if test="state != null">sg_state,</if> |
| | | <if test="createTime != null">sg_create_time,</if> |
| | | <if test="updateTime != null">sg_update_time,</if> |
| | | <if test="weight != null">sg_weight,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="title != null">#{title,jdbcType=VARCHAR},</if> |
| | | <if test="goodsClass != null">#{goodsClass.id,jdbcType=BIGINT},</if> |
| | | <if test="salesCount != null">#{salesCount,jdbcType=BIGINT},</if> |
| | | <if test="picture != null">#{picture,jdbcType=VARCHAR},</if> |
| | | <if test="desc != null">#{desc,jdbcType=VARCHAR},</if> |
| | | <if test="chargeType != null">#{chargeType,jdbcType=VARCHAR},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="weight != null">#{weight,jdbcType=INTEGER}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoods">update |
| | | yeshi_ec_shop_goods set sg_title = |
| | | #{title,jdbcType=VARCHAR},sg_class_id = |
| | | #{goodsClass.id,jdbcType=BIGINT},sg_sales_count = |
| | | #{salesCount,jdbcType=BIGINT},sg_picture = |
| | | #{picture,jdbcType=VARCHAR},sg_desc = |
| | | #{desc,jdbcType=VARCHAR},sg_charge_type = |
| | | #{chargeType,jdbcType=VARCHAR},sg_state = |
| | | #{state,jdbcType=INTEGER},sg_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},sg_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} ,sg_weight |
| | | =#{weight,jdbcType=INTEGER} where sg_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoods"> |
| | | update yeshi_ec_shop_goods |
| | | <set> |
| | | <if test="title != null">sg_title=#{title,jdbcType=VARCHAR},</if> |
| | | <if test="goodsClass != null">sg_class_id=#{goodsClass.id,jdbcType=BIGINT},</if> |
| | | <if test="salesCount != null">sg_sales_count=#{salesCount,jdbcType=BIGINT},</if> |
| | | <if test="picture != null">sg_picture=#{picture,jdbcType=VARCHAR},</if> |
| | | <if test="desc != null">sg_desc=#{desc,jdbcType=VARCHAR},</if> |
| | | <if test="chargeType != null">sg_charge_type=#{chargeType,jdbcType=VARCHAR},</if> |
| | | <if test="state != null">sg_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">sg_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">sg_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="weight !=null">sg_weight =#{weight,jdbcType=INTEGER},</if> |
| | | </set> |
| | | where sg_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
New file |
| | |
| | | <?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.yeshi.fanli.dao.mybatis.shop.BanLiShopGoodsSetsMapper"> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.entity.shop.BanLiShopGoodsSets"> |
| | | <id column="sgs_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="sgs_name" property="name" jdbcType="VARCHAR" /> |
| | | <result column="sgs_original_price" property="originalPrice" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="sgs_zk_price" property="zkPrice" jdbcType="DECIMAL" /> |
| | | <result column="sgs_sales_count" property="salesCount" |
| | | jdbcType="BIGINT" /> |
| | | <result column="sgs_stock" property="stock" jdbcType="INTEGER" /> |
| | | <result column="sgs_charge_fulu_num" property="chargeFuLuNum" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="sgs_create_time" property="createTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="sgs_update_time" property="updateTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="sgs_weight" property="weight" jdbcType="INTEGER" /> |
| | | <result column="sgs_sub_name" property="subName" jdbcType="VARCHAR" /> |
| | | <result column="sgs_state" property="state" jdbcType="INTEGER" /> |
| | | <association property="goods" column="sgs_goods_id" |
| | | javaType="com.yeshi.fanli.entity.shop.BanLiShopGoods"> |
| | | <id column="sgs_goods_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | </resultMap> |
| | | <resultMap id="BaseResultDetailMap" |
| | | type="com.yeshi.fanli.entity.shop.BanLiShopGoodsSets"> |
| | | <id column="sgs_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="sgs_name" property="name" jdbcType="VARCHAR" /> |
| | | <result column="sgs_original_price" property="originalPrice" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="sgs_zk_price" property="zkPrice" jdbcType="DECIMAL" /> |
| | | <result column="sgs_sales_count" property="salesCount" |
| | | jdbcType="BIGINT" /> |
| | | <result column="sgs_stock" property="stock" jdbcType="INTEGER" /> |
| | | <result column="sgs_charge_fulu_num" property="chargeFuLuNum" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="sgs_create_time" property="createTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="sgs_update_time" property="updateTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="sgs_weight" property="weight" jdbcType="INTEGER" /> |
| | | <result column="sgs_sub_name" property="subName" jdbcType="VARCHAR" /> |
| | | <result column="sgs_state" property="state" jdbcType="INTEGER" /> |
| | | <association property="goods" column="sgs_goods_id" |
| | | javaType="com.yeshi.fanli.entity.shop.BanLiShopGoods"> |
| | | <id column="sgs_goods_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | <collection property="payList" column="sgs_id" |
| | | ofType="com.yeshi.fanli.entity.shop.BanLiShopGoodsSetsPay" |
| | | select="com.yeshi.fanli.dao.mybatis.shop.BanLiShopGoodsSetsPayMapper.listByGoodsSetId" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">sgs_id,sgs_name,sgs_goods_id,sgs_original_price,sgs_zk_price,sgs_sales_count,sgs_stock,sgs_charge_fulu_num,sgs_create_time,sgs_update_time,sgs_weight,sgs_sub_name,sgs_state |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_shop_goods_set where sgs_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <select id="selectDetailByPrimaryKey" resultMap="BaseResultDetailMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_shop_goods_set where sgs_id = #{0} |
| | | </select> |
| | | <select id="listDetailByGoodsId" resultMap="BaseResultDetailMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_shop_goods_set where sgs_goods_id = #{0} |
| | | </select> |
| | | <select id="countByGoodsId" resultType="java.lang.Long" |
| | | parameterType="java.lang.Long">select count(*) from yeshi_ec_shop_goods_set where |
| | | sgs_goods_id = #{0} |
| | | </select> |
| | | <select id="listByGoodsId" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_shop_goods_set where sgs_goods_id = #{0} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_shop_goods_set where sgs_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoodsSets" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_shop_goods_set |
| | | (sgs_id,sgs_name,sgs_goods_id,sgs_original_price,sgs_zk_price,sgs_sales_count,sgs_stock,sgs_charge_fulu_num,sgs_create_time,sgs_update_time,sgs_weight,sgs_sub_name,sgs_state) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{goods.id,jdbcType=BIGINT},#{originalPrice,jdbcType=DECIMAL},#{zkPrice,jdbcType=DECIMAL},#{salesCount,jdbcType=BIGINT},#{stock,jdbcType=INTEGER},#{chargeFuLuNum,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{weight,jdbcType=INTEGER},#{subName,jdbcType=VARCHAR},#{state,jdbcType=INTEGER}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoodsSets" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_shop_goods_set |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">sgs_id,</if> |
| | | <if test="name != null">sgs_name,</if> |
| | | <if test="goods != null">sgs_goods_id,</if> |
| | | <if test="originalPrice != null">sgs_original_price,</if> |
| | | <if test="zkPrice != null">sgs_zk_price,</if> |
| | | <if test="salesCount != null">sgs_sales_count,</if> |
| | | <if test="stock != null">sgs_stock,</if> |
| | | <if test="chargeFuLuNum != null">sgs_charge_fulu_num,</if> |
| | | <if test="createTime != null">sgs_create_time,</if> |
| | | <if test="updateTime != null">sgs_update_time,</if> |
| | | <if test="weight != null">sgs_weight,</if> |
| | | <if test="subName != null">sgs_sub_name,</if> |
| | | <if test="state != null">sgs_state,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="name != null">#{name,jdbcType=VARCHAR},</if> |
| | | <if test="goods != null">#{goods.id,jdbcType=BIGINT},</if> |
| | | <if test="originalPrice != null">#{originalPrice,jdbcType=DECIMAL},</if> |
| | | <if test="zkPrice != null">#{zkPrice,jdbcType=DECIMAL},</if> |
| | | <if test="salesCount != null">#{salesCount,jdbcType=BIGINT},</if> |
| | | <if test="stock != null">#{stock,jdbcType=INTEGER},</if> |
| | | <if test="chargeFuLuNum != null">#{chargeFuLuNum,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="weight != null">#{weight,jdbcType=INTEGER},</if> |
| | | <if test="subName != null">#{subName,jdbcType=VARCHAR}</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoodsSets">update |
| | | yeshi_ec_shop_goods_set set sgs_name = |
| | | #{name,jdbcType=VARCHAR},sgs_goods_id = |
| | | #{goods.id,jdbcType=BIGINT},sgs_original_price = |
| | | #{originalPrice,jdbcType=DECIMAL},sgs_zk_price = |
| | | #{zkPrice,jdbcType=DECIMAL},sgs_sales_count = |
| | | #{salesCount,jdbcType=BIGINT},sgs_stock = |
| | | #{stock,jdbcType=INTEGER},sgs_charge_fulu_num = |
| | | #{chargeFuLuNum,jdbcType=VARCHAR},sgs_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},sgs_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} ,sgs_weight |
| | | =#{weight,jdbcType=INTEGER} ,sgs_sub_name =#{subName,jdbcType=VARCHAR} |
| | | ,sgs_state =#{state,jdbcType=INTEGER} where sgs_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoodsSets"> |
| | | update yeshi_ec_shop_goods_set |
| | | <set> |
| | | <if test="name != null">sgs_name=#{name,jdbcType=VARCHAR},</if> |
| | | <if test="goods != null">sgs_goods_id=#{goods.id,jdbcType=BIGINT},</if> |
| | | <if test="originalPrice != null">sgs_original_price=#{originalPrice,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="zkPrice != null">sgs_zk_price=#{zkPrice,jdbcType=DECIMAL},</if> |
| | | <if test="salesCount != null">sgs_sales_count=#{salesCount,jdbcType=BIGINT},</if> |
| | | <if test="stock != null">sgs_stock=#{stock,jdbcType=INTEGER},</if> |
| | | <if test="chargeFuLuNum != null">sgs_charge_fulu_num=#{chargeFuLuNum,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="createTime != null">sgs_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">sgs_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="weight !=null">sgs_weight =#{weight,jdbcType=INTEGER},</if> |
| | | <if test="subName !=null">sgs_sub_name =#{subName,jdbcType=VARCHAR},</if> |
| | | <if test="state !=null">sgs_state =#{state,jdbcType=INTEGER},</if> |
| | | </set> |
| | | where sgs_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
New file |
| | |
| | | <?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.yeshi.fanli.dao.mybatis.shop.BanLiShopGoodsSetsPayMapper"> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.entity.shop.BanLiShopGoodsSetsPay"> |
| | | <id column="sp_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="sp_discount" property="disCount" jdbcType="DECIMAL" /> |
| | | <result column="sp_price_hongbao" property="hongBaoPrice" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="sp_price_balance" property="balancePrice" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="sp_price_money" property="moneyPrice" jdbcType="DECIMAL" /> |
| | | <result column="sp_pay_type" property="payType" jdbcType="VARCHAR" /> |
| | | <result column="sp_tag" property="tag" jdbcType="VARCHAR" /> |
| | | <result column="sp_create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="sp_update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | <result column="sp_weight" property="weight" jdbcType="INTEGER" /> |
| | | <association property="goodsSet" column="sp_goods_set_id" |
| | | javaType="com.yeshi.fanli.entity.shop.BanLiShopGoodsSets"> |
| | | <id column="sp_goods_set_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">sp_id,sp_goods_set_id,sp_discount,sp_price_hongbao,sp_price_balance,sp_price_money,sp_pay_type,sp_tag,sp_create_time,sp_update_time,sp_weight |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_shop_goods_set_pay where sp_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <select id="listByGoodsSetId" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_shop_goods_set_pay where sp_goods_set_id = #{0} |
| | | </select> |
| | | |
| | | <select id="countByGoodsSetId" resultType="java.lang.Long" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | count(*) |
| | | from yeshi_ec_shop_goods_set_pay where sp_goods_set_id = #{0} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_shop_goods_set_pay where sp_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoodsSetsPay" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_shop_goods_set_pay |
| | | (sp_id,sp_goods_set_id,sp_discount,sp_price_hongbao,sp_price_balance,sp_price_money,sp_pay_type,sp_tag,sp_create_time,sp_update_time,sp_weight) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{goodsSet.id,jdbcType=BIGINT},#{disCount,jdbcType=DECIMAL},#{hongBaoPrice,jdbcType=DECIMAL},#{balancePrice,jdbcType=DECIMAL},#{moneyPrice,jdbcType=DECIMAL},#{payType,jdbcType=VARCHAR},#{tag,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{weight,jdbcType=INTEGER}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoodsSetsPay" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_shop_goods_set_pay |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">sp_id,</if> |
| | | <if test="goodsSet != null">sp_goods_set_id,</if> |
| | | <if test="disCount != null">sp_discount,</if> |
| | | <if test="hongBaoPrice != null">sp_price_hongbao,</if> |
| | | <if test="balancePrice != null">sp_price_balance,</if> |
| | | <if test="moneyPrice != null">sp_price_money,</if> |
| | | <if test="payType != null">sp_pay_type,</if> |
| | | <if test="tag != null">sp_tag,</if> |
| | | <if test="createTime != null">sp_create_time,</if> |
| | | <if test="updateTime != null">sp_update_time,</if> |
| | | <if test="weight != null">sp_weight,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="goodsSet != null">#{goodsSet.id,jdbcType=BIGINT},</if> |
| | | <if test="disCount != null">#{disCount,jdbcType=DECIMAL},</if> |
| | | <if test="hongBaoPrice != null">#{hongBaoPrice,jdbcType=DECIMAL},</if> |
| | | <if test="balancePrice != null">#{balancePrice,jdbcType=DECIMAL},</if> |
| | | <if test="moneyPrice != null">#{moneyPrice,jdbcType=DECIMAL},</if> |
| | | <if test="payType != null">#{payType,jdbcType=VARCHAR},</if> |
| | | <if test="tag != null">#{tag,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="weight != null">#{weight,jdbcType=INTEGER}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoodsSetsPay">update |
| | | yeshi_ec_shop_goods_set_pay set sp_goods_set_id = |
| | | #{goodsSet.id,jdbcType=BIGINT},sp_discount = |
| | | #{disCount,jdbcType=DECIMAL},sp_price_hongbao = |
| | | #{hongBaoPrice,jdbcType=DECIMAL},sp_price_balance = |
| | | #{balancePrice,jdbcType=DECIMAL},sp_price_money = |
| | | #{moneyPrice,jdbcType=DECIMAL},sp_pay_type = |
| | | #{payType,jdbcType=VARCHAR},sp_tag = |
| | | #{tag,jdbcType=VARCHAR},sp_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},sp_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} ,sp_weight |
| | | =#{weight,jdbcType=INTEGER} where sp_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.shop.BanLiShopGoodsSetsPay"> |
| | | update yeshi_ec_shop_goods_set_pay |
| | | <set> |
| | | <if test="goodsSet != null">sp_goods_set_id=#{goodsSet.id,jdbcType=BIGINT},</if> |
| | | <if test="disCount != null">sp_discount=#{disCount,jdbcType=DECIMAL},</if> |
| | | <if test="hongBaoPrice != null">sp_price_hongbao=#{hongBaoPrice,jdbcType=DECIMAL},</if> |
| | | <if test="balancePrice != null">sp_price_balance=#{balancePrice,jdbcType=DECIMAL},</if> |
| | | <if test="moneyPrice != null">sp_price_money=#{moneyPrice,jdbcType=DECIMAL},</if> |
| | | <if test="payType != null">sp_pay_type=#{payType,jdbcType=VARCHAR},</if> |
| | | <if test="tag != null">sp_tag=#{tag,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">sp_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">sp_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="weight !=null">sp_weight =#{weight,jdbcType=INTEGER},</if> |
| | | </set> |
| | | where sp_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
New file |
| | |
| | | <?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.yeshi.fanli.dao.mybatis.shop.BanLiShopOrderMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.shop.BanLiShopOrder"> |
| | | <id column="so_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="so_uid" property="uid" jdbcType="BIGINT" /> |
| | | <result column="so_order_no" property="orderNo" jdbcType="VARCHAR" /> |
| | | <result column="so_payment_hongbao" property="hongBaoPayment" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="so_payment_hongbao_state" property="hongBaoPaymentState" |
| | | jdbcType="INTEGER" /> |
| | | <result column="so_payment_money" property="balancePayment" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="so_payment_money_state" property="balancePaymentState" |
| | | jdbcType="INTEGER" /> |
| | | <result column="so_payment_balance" property="moneyPayment" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="so_payment_balance_state" property="moneyPaymentState" |
| | | jdbcType="INTEGER" /> |
| | | <result column="so_pay_time" property="payTime" jdbcType="TIMESTAMP" /> |
| | | <result column="so_reject_time" property="rejectTime" jdbcType="TIMESTAMP" /> |
| | | <result column="so_success_time" property="successTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="so_state" property="state" jdbcType="INTEGER" /> |
| | | <result column="so_state_desc" property="stateDesc" jdbcType="VARCHAR" /> |
| | | <result column="so_charge_account" property="chargeAccount" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="so_charge_account2" property="chargeAccount2" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="so_beizhu" property="beiZhu" jdbcType="VARCHAR" /> |
| | | <result column="so_create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="so_update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | <association property="goods" column="so_goods_id" |
| | | javaType="com.yeshi.fanli.entity.shop.BanLiShopGoods"> |
| | | <id column="so_goods_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | <association property="goodsSet" column="so_goods_set_id" |
| | | javaType="com.yeshi.fanli.entity.shop.BanLiShopGoodsSets"> |
| | | <id column="so_goods_set_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">so_id,so_uid,so_order_no,so_goods_id,so_goods_set_id,so_payment_hongbao,so_payment_hongbao_state,so_payment_money,so_payment_money_state,so_payment_balance,so_payment_balance_state,so_pay_time,so_reject_time,so_success_time,so_state,so_state_desc,so_charge_account,so_charge_account2,so_beizhu,so_create_time,so_update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_shop_order where so_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | <select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_shop_order where so_id = #{0} for update |
| | | </select> |
| | | |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_shop_order where so_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.shop.BanLiShopOrder" |
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_shop_order |
| | | (so_id,so_uid,so_order_no,so_goods_id,so_goods_set_id,so_payment_hongbao,so_payment_hongbao_state,so_payment_money,so_payment_money_state,so_payment_balance,so_payment_balance_state,so_pay_time,so_reject_time,so_success_time,so_state,so_state_desc,so_charge_account,so_charge_account2,so_beizhu,so_create_time,so_update_time) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{orderNo,jdbcType=VARCHAR},#{goods.id,jdbcType=BIGINT},#{goodsSet.id,jdbcType=BIGINT},#{hongBaoPayment,jdbcType=DECIMAL},#{hongBaoPaymentState,jdbcType=INTEGER},#{balancePayment,jdbcType=DECIMAL},#{balancePaymentState,jdbcType=INTEGER},#{moneyPayment,jdbcType=DECIMAL},#{moneyPaymentState,jdbcType=INTEGER},#{payTime,jdbcType=TIMESTAMP},#{rejectTime,jdbcType=TIMESTAMP},#{successTime,jdbcType=TIMESTAMP},#{state,jdbcType=INTEGER},#{stateDesc,jdbcType=VARCHAR},#{chargeAccount,jdbcType=VARCHAR},#{chargeAccount2,jdbcType=VARCHAR},#{beiZhu,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.shop.BanLiShopOrder" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_shop_order |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">so_id,</if> |
| | | <if test="uid != null">so_uid,</if> |
| | | <if test="orderNo != null">so_order_no,</if> |
| | | <if test="goods != null">so_goods_id,</if> |
| | | <if test="goodsSet != null">so_goods_set_id,</if> |
| | | <if test="hongBaoPayment != null">so_payment_hongbao,</if> |
| | | <if test="hongBaoPaymentState != null">so_payment_hongbao_state,</if> |
| | | <if test="balancePayment != null">so_payment_money,</if> |
| | | <if test="balancePaymentState != null">so_payment_money_state,</if> |
| | | <if test="moneyPayment != null">so_payment_balance,</if> |
| | | <if test="moneyPaymentState != null">so_payment_balance_state,</if> |
| | | <if test="payTime != null">so_pay_time,</if> |
| | | <if test="rejectTime != null">so_reject_time,</if> |
| | | <if test="successTime != null">so_success_time,</if> |
| | | <if test="state != null">so_state,</if> |
| | | <if test="stateDesc != null">so_state_desc,</if> |
| | | <if test="chargeAccount != null">so_charge_account,</if> |
| | | <if test="chargeAccount2 != null">so_charge_account2,</if> |
| | | <if test="beiZhu != null">so_beizhu,</if> |
| | | <if test="createTime != null">so_create_time,</if> |
| | | <if test="updateTime != null">so_update_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="uid != null">#{uid,jdbcType=BIGINT},</if> |
| | | <if test="orderNo != null">#{orderNo,jdbcType=VARCHAR},</if> |
| | | <if test="goods != null">#{goods.id,jdbcType=BIGINT},</if> |
| | | <if test="goodsSet != null">#{goodsSet.id,jdbcType=BIGINT},</if> |
| | | <if test="hongBaoPayment != null">#{hongBaoPayment,jdbcType=DECIMAL},</if> |
| | | <if test="hongBaoPaymentState != null">#{hongBaoPaymentState,jdbcType=INTEGER},</if> |
| | | <if test="balancePayment != null">#{balancePayment,jdbcType=DECIMAL},</if> |
| | | <if test="balancePaymentState != null">#{balancePaymentState,jdbcType=INTEGER},</if> |
| | | <if test="moneyPayment != null">#{moneyPayment,jdbcType=DECIMAL},</if> |
| | | <if test="moneyPaymentState != null">#{moneyPaymentState,jdbcType=INTEGER},</if> |
| | | <if test="payTime != null">#{payTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="rejectTime != null">#{rejectTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="successTime != null">#{successTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | <if test="stateDesc != null">#{stateDesc,jdbcType=VARCHAR},</if> |
| | | <if test="chargeAccount != null">#{chargeAccount,jdbcType=VARCHAR},</if> |
| | | <if test="chargeAccount2 != null">#{chargeAccount2,jdbcType=VARCHAR},</if> |
| | | <if test="beiZhu != null">#{beiZhu,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.shop.BanLiShopOrder">update |
| | | yeshi_ec_shop_order set so_uid = #{uid,jdbcType=BIGINT},so_order_no = |
| | | #{orderNo,jdbcType=VARCHAR},so_goods_id = |
| | | #{goods.id,jdbcType=BIGINT},so_goods_set_id = |
| | | #{goodsSet.id,jdbcType=BIGINT},so_payment_hongbao = |
| | | #{hongBaoPayment,jdbcType=DECIMAL},so_payment_hongbao_state = |
| | | #{hongBaoPaymentState,jdbcType=INTEGER},so_payment_money = |
| | | #{balancePayment,jdbcType=DECIMAL},so_payment_money_state = |
| | | #{balancePaymentState,jdbcType=INTEGER},so_payment_balance = |
| | | #{moneyPayment,jdbcType=DECIMAL},so_payment_balance_state = |
| | | #{moneyPaymentState,jdbcType=INTEGER},so_pay_time = |
| | | #{payTime,jdbcType=TIMESTAMP},so_reject_time = |
| | | #{rejectTime,jdbcType=TIMESTAMP},so_success_time = |
| | | #{successTime,jdbcType=TIMESTAMP},so_state = |
| | | #{state,jdbcType=INTEGER},so_state_desc = |
| | | #{stateDesc,jdbcType=VARCHAR},so_charge_account = |
| | | #{chargeAccount,jdbcType=VARCHAR},so_charge_account2 = |
| | | #{chargeAccount2,jdbcType=VARCHAR},so_beizhu = |
| | | #{beiZhu,jdbcType=VARCHAR},so_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},so_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} where so_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.shop.BanLiShopOrder"> |
| | | update yeshi_ec_shop_order |
| | | <set> |
| | | <if test="uid != null">so_uid=#{uid,jdbcType=BIGINT},</if> |
| | | <if test="orderNo != null">so_order_no=#{orderNo,jdbcType=VARCHAR},</if> |
| | | <if test="goods != null">so_goods_id=#{goods.id,jdbcType=BIGINT},</if> |
| | | <if test="goodsSet != null">so_goods_set_id=#{goodsSet.id,jdbcType=BIGINT},</if> |
| | | <if test="hongBaoPayment != null">so_payment_hongbao=#{hongBaoPayment,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="hongBaoPaymentState != null">so_payment_hongbao_state=#{hongBaoPaymentState,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="balancePayment != null">so_payment_money=#{balancePayment,jdbcType=DECIMAL},</if> |
| | | <if test="balancePaymentState != null">so_payment_money_state=#{balancePaymentState,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="moneyPayment != null">so_payment_balance=#{moneyPayment,jdbcType=DECIMAL},</if> |
| | | <if test="moneyPaymentState != null">so_payment_balance_state=#{moneyPaymentState,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="payTime != null">so_pay_time=#{payTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="rejectTime != null">so_reject_time=#{rejectTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="successTime != null">so_success_time=#{successTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="state != null">so_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="stateDesc != null">so_state_desc=#{stateDesc,jdbcType=VARCHAR},</if> |
| | | <if test="chargeAccount != null">so_charge_account=#{chargeAccount,jdbcType=VARCHAR},</if> |
| | | <if test="chargeAccount2 != null">so_charge_account2=#{chargeAccount2,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="beiZhu != null">so_beizhu=#{beiZhu,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">so_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">so_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where so_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | |
| | | import com.yeshi.fanli.dao.mybatis.order.HongBaoOrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanOrderMapper;
|
| | | import com.yeshi.fanli.dto.HongBao;
|
| | | import com.yeshi.fanli.dto.order.OrderMoneyRecievedMQMsgDTO;
|
| | | import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMoneyRecievedMQMsg;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | |
| | | }
|
| | |
|
| | | // 邀请赚到账事务消息
|
| | | OrderMoneyRecievedMQMsgDTO mqMsg = new OrderMoneyRecievedMQMsgDTO(OrderMoneyRecievedMQMsgDTO.TYPE_INVITE, uid,
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_INVITE, uid,
|
| | | sourceType, null, null, new Date());
|
| | | Message msg = new Message(MQTopicName.TOPIC_FANLI.name(), "actual", new Gson().toJson(mqMsg).getBytes());
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.orderFanLiActual.name(),
|
| | | new Gson().toJson(mqMsg).getBytes());
|
| | | String taskKey = getTaskKey(uid);
|
| | | msg.setKey(taskKey);
|
| | | // 添加事务消息
|
| | |
| | | }
|
| | |
|
| | | // 邀请赚到账事务消息
|
| | | OrderMoneyRecievedMQMsgDTO mqMsg = new OrderMoneyRecievedMQMsgDTO(OrderMoneyRecievedMQMsgDTO.TYPE_INVITE, uid,
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_INVITE, uid,
|
| | | sourceType, null, null, new Date());
|
| | | Message msg = new Message(MQTopicName.TOPIC_FANLI.name(), "actual", new Gson().toJson(mqMsg).getBytes());
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.orderFanLiActual.name(), new Gson().toJson(mqMsg).getBytes());
|
| | | String taskKey = getTaskKey(uid);
|
| | | msg.setKey(taskKey);
|
| | | // 添加事务消息
|
| | |
| | | }
|
| | |
|
| | | // 邀请赚到账事务消息
|
| | | OrderMoneyRecievedMQMsgDTO mqMsg = new OrderMoneyRecievedMQMsgDTO(OrderMoneyRecievedMQMsgDTO.TYPE_INVITE, uid,
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_INVITE, uid,
|
| | | sourceType, null, null, new Date());
|
| | | Message msg = new Message(MQTopicName.TOPIC_FANLI.name(), "actual", new Gson().toJson(mqMsg).getBytes());
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.orderFanLiActual.name(), new Gson().toJson(mqMsg).getBytes());
|
| | | String taskKey = getTaskKey(uid);
|
| | | msg.setKey(taskKey);
|
| | | // 添加事务消息
|
| | |
| | | hongBaoList.addAll(tempHongBaoList);
|
| | | }
|
| | |
|
| | | OrderMoneyRecievedMQMsgDTO mqMsg = new OrderMoneyRecievedMQMsgDTO(OrderMoneyRecievedMQMsgDTO.TYPE_SHARE, uid,
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_SHARE, uid,
|
| | | sourceType, null, null, new Date());
|
| | | Message msg = new Message(MQTopicName.TOPIC_FANLI.name(), "actual", new Gson().toJson(mqMsg).getBytes());
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(),OrderTopicTagEnum.orderFanLiActual.name(), new Gson().toJson(mqMsg).getBytes());
|
| | | String taskKey = getTaskKey(uid);
|
| | | msg.setKey(taskKey);
|
| | | // 添加事务消息
|
| | |
| | | hongBaoList.addAll(tempHongBaoList);
|
| | | }
|
| | |
|
| | | OrderMoneyRecievedMQMsgDTO mqMsg = new OrderMoneyRecievedMQMsgDTO(OrderMoneyRecievedMQMsgDTO.TYPE_SHARE, uid,
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_SHARE, uid,
|
| | | sourceType, null, null, new Date());
|
| | | Message msg = new Message(MQTopicName.TOPIC_FANLI.name(), "actual", new Gson().toJson(mqMsg).getBytes());
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.orderFanLiActual.name(), new Gson().toJson(mqMsg).getBytes());
|
| | | String taskKey = getTaskKey(uid);
|
| | | msg.setKey(taskKey);
|
| | | // 添加事务消息
|
| | |
| | | hongBaoList.addAll(tempHongBaoList);
|
| | | }
|
| | |
|
| | | OrderMoneyRecievedMQMsgDTO mqMsg = new OrderMoneyRecievedMQMsgDTO(OrderMoneyRecievedMQMsgDTO.TYPE_SHARE, uid,
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_SHARE, uid,
|
| | | sourceType, null, null, new Date());
|
| | | Message msg = new Message(MQTopicName.TOPIC_FANLI.name(), "actual", new Gson().toJson(mqMsg).getBytes());
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.orderFanLiActual.name(), new Gson().toJson(mqMsg).getBytes());
|
| | | String taskKey = getTaskKey(uid);
|
| | | msg.setKey(taskKey);
|
| | | // 添加事务消息
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.order.HongBaoOrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.OrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanOrderMapper;
|
| | | import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMoneyRecievedMQMsg;
|
| | | import com.yeshi.fanli.dto.order.CommonOrderAddResultDTO;
|
| | | import com.yeshi.fanli.dto.order.OrderMQMsgDTO;
|
| | | import com.yeshi.fanli.dto.order.OrderMoneyRecievedMQMsgDTO;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | |
| | | }
|
| | |
|
| | | // 自购到账事务消息
|
| | | OrderMoneyRecievedMQMsgDTO mqMsg = new OrderMoneyRecievedMQMsgDTO(OrderMoneyRecievedMQMsgDTO.TYPE_ZIGOU,
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_ZIGOU,
|
| | | mainUser.getId(), hongBaoOrder.getCommonOrder().getSourceType(),
|
| | | hongBaoOrder.getCommonOrder().getOrderNo(), null, new Date());
|
| | | mqMsg.setOrderFirst(first);
|
| | | Message msg = new Message(MQTopicName.TOPIC_FANLI.name(), "actual", new Gson().toJson(mqMsg).getBytes());
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.orderFanLiActual.name(),
|
| | | new Gson().toJson(mqMsg).getBytes());
|
| | | String key = mainUser.getId() + "-" + UUID.randomUUID().toString();
|
| | | msg.setKey(key);
|
| | | try {
|
| | |
| | | */
|
| | | private void addHongBaoWithMQ(List<CommonOrderAddResultDTO> commonOrderList, String orderId, Long uid,
|
| | | int sourceType, int hongBaoType) {
|
| | | // TODO 区分添加与修改
|
| | | final List<CommonOrder> coList = convertCommonOrder(commonOrderList);
|
| | | OrderMQMsgDTO mqMsg = new OrderMQMsgDTO(orderId, sourceType, uid);
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(),
|
| | | String.format(MQTagConstant.TAG_ORDER_STATISTIC_PREFIX + "%s-%s", sourceType, hongBaoType),
|
| | | OrderMQMsg mqMsg = new OrderMQMsg(orderId, sourceType, uid);
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.orderStatistic.name(),
|
| | | new Gson().toJson(mqMsg).getBytes());
|
| | | SendResult result = orderTransactionProducer.send(msg, new LocalTransactionExecuter() {
|
| | | @Override
|
| | |
| | |
|
| | | @Resource
|
| | | private RedPackBalanceMapper redPackBalanceMapper;
|
| | | |
| | |
|
| | | @Resource
|
| | | private RedPackDetailService redPackDetailService;
|
| | |
|
| | |
| | |
|
| | | return new BigDecimal(0);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public void addRedPack(Long uid, BigDecimal money) {
|
| | | if (uid == null || uid == 0 || money == null)
|
| | |
| | | redPackBalanceMapper.addRedPack(uid, money);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void addRedPack(Long uid, BigDecimal money, RedPackDetail detail) throws RedPackBalanceException {
|
| | | if (uid == null || uid == 0 || money == null || detail == null)
|
| | | if (uid == null || uid == 0 || money == null || detail == null)
|
| | | throw new RedPackBalanceException(1, "参数传递不完整");
|
| | | // 加入明细
|
| | | redPackDetailService.insertSelective(detail);
|
| | |
| | | redPackBalanceMapper.addRedPack(uid, money);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void subRedPack(Long uid, BigDecimal money, RedPackDetail detail) throws RedPackBalanceException {
|
| | | if (uid == null || uid == 0 || money == null || detail == null)
|
| | | if (uid == null || uid == 0 || money == null || detail == null)
|
| | | throw new RedPackBalanceException(1, "参数传递不完整");
|
| | | // 加入明细
|
| | | redPackDetailService.insertSelective(detail);
|
| | |
|
| | | RedPackBalance balance = redPackBalanceMapper.selectForUpdate(uid);
|
| | | if (balance.getMoney() == null)
|
| | | throw new RedPackBalanceException(2, "红包余额不足");
|
| | |
|
| | | if (balance.getMoney().compareTo(money) < 0)
|
| | | throw new RedPackBalanceException(2, "红包余额不足");
|
| | |
|
| | | // 减少红包
|
| | | redPackBalanceMapper.subRedPack(uid, money);
|
| | | }
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.redpack.RedPackDetailMapper;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackDetail;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackDetailService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.vo.redpack.RedPackDetailVO;
|
| | | import com.yeshi.fanli.vo.redpack.RedPackMonthVO;
|
| | |
| | | public void insertSelective(RedPackDetail record) {
|
| | | redPackDetailMapper.insertSelective(record);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public void updateByPrimaryKeySelective(RedPackDetail record) {
|
| | | redPackDetailMapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public RedPackDetail getByIdentifyCode(String identifyCode) {
|
| | | return redPackDetailMapper.getByIdentifyCode(identifyCode);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public BigDecimal countAddMoneyByDate(long uid, int dateType) {
|
| | | return redPackDetailMapper.countAddMoneyByDate(uid, dateType);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public BigDecimal countUseMoneyByDate(long uid, int dateType) {
|
| | | return redPackDetailMapper.countUseMoneyByDate(uid, dateType);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public List<RedPackDetailVO> listUserMoneyDetailForClient(Long uid, Long detailId, Date maxTime) {
|
| | | List<RedPackDetailVO> finalList = new ArrayList<>();
|
| | |
| | | keys = monthMap.keySet().iterator();
|
| | | while (keys.hasNext()) {
|
| | | Integer key = keys.next();
|
| | | |
| | |
|
| | | BigDecimal expend = new BigDecimal(voList.get(p).getExpend());
|
| | | BigDecimal income = new BigDecimal(voList.get(p).getIncome());
|
| | | |
| | |
|
| | | // 去除支出负号
|
| | | finalList.get(key).getMonth().setExpend(expend.setScale(2).toString().replace("-", ""));
|
| | | finalList.get(key).getMonth().setIncome(income.setScale(2).toString());
|
| | |
| | | return finalList;
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public long countUserMoneyDetailForClient(Long uid, Long detailId, Date maxTime) {
|
| | | long monthCount = 0L;
|
| | |
| | | if (maxTime == null) {
|
| | | detailCount = redPackDetailMapper.selectCountByUid(uid);
|
| | | // 用于表示当前所有
|
| | | monthCount = redPackDetailMapper.selectMonthCountByUid(uid, new Date(System.currentTimeMillis() + 1000 * 60 * 60L));
|
| | | monthCount = redPackDetailMapper.selectMonthCountByUid(uid,
|
| | | new Date(System.currentTimeMillis() + 1000 * 60 * 60L));
|
| | | } else {// 通过时间筛选了的,需要查询所有
|
| | | detailCount = redPackDetailMapper.selectCountByUidAndMaxCreateTime(uid, maxTime);
|
| | | monthCount = redPackDetailMapper.selectMonthCountByUid(uid, maxTime);
|
| | |
| | |
|
| | | return monthCount + detailCount;
|
| | | }
|
| | | |
| | | |
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public void changeDisplayByIdentifyCode(String code, boolean disPlay) {
|
| | | if (StringUtil.isNullOrEmpty(code))
|
| | | return;
|
| | | RedPackDetail oldDetail = getByIdentifyCode(code);
|
| | | if (oldDetail != null) {// 外显红包详情
|
| | | RedPackDetail update = new RedPackDetail();
|
| | | update.setId(oldDetail.getId());
|
| | | update.setDisplay(true);
|
| | | redPackDetailMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.shop;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.shop.BanLiShopGoodsClassMapper;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsClass;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsClassService;
|
| | |
|
| | | @Service
|
| | | public class BanLiShopGoodsClassServiceImpl implements BanLiShopGoodsClassService {
|
| | |
|
| | | @Resource
|
| | | private BanLiShopGoodsClassMapper banLiShopGoodsClassMapper;
|
| | |
|
| | | @Override
|
| | | public BanLiShopGoodsClass selectByPrimaryKey(Long id) {
|
| | | return banLiShopGoodsClassMapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.shop;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.shop.BanLiShopGoodsImgMapper;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoods;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsImg;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsImgService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | | public class BanLiShopGoodsImgServiceImpl implements BanLiShopGoodsImgService {
|
| | |
|
| | | @Resource
|
| | | private BanLiShopGoodsImgMapper banLiShopGoodsImgMapper;
|
| | |
|
| | | // 添加图片
|
| | | @Override
|
| | | public void addImg(String pictureUrl, Long goodsId) {
|
| | | if (StringUtil.isNullOrEmpty(pictureUrl) || goodsId == null) {
|
| | | return;
|
| | | }
|
| | | String imgMD5 = StringUtil.Md5(pictureUrl);
|
| | | BanLiShopGoodsImg img = new BanLiShopGoodsImg();
|
| | | img.setCreateTime(new Date());
|
| | | img.setGoods(new BanLiShopGoods(goodsId));
|
| | | img.setUrl(pictureUrl);
|
| | | img.setUrlMD5(imgMD5);
|
| | | banLiShopGoodsImgMapper.insertSelective(img);
|
| | | if (img.getWeight() == null) {
|
| | | BanLiShopGoodsImg update = new BanLiShopGoodsImg();
|
| | | update.setId(img.getId());
|
| | | update.setWeight((int) img.getId().longValue());
|
| | | banLiShopGoodsImgMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<BanLiShopGoodsImg> listByGoodsId(Long goodsId) {
|
| | | return banLiShopGoodsImgMapper.listByGoodsId(goodsId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BanLiShopGoodsImg selectByPrimaryKey(Long id) {
|
| | | return banLiShopGoodsImgMapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void updateSelectiveByPrimaryKey(BanLiShopGoodsImg img) {
|
| | | if (img == null || img.getId() == null)
|
| | | return;
|
| | | banLiShopGoodsImgMapper.updateByPrimaryKeySelective(img);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void delete(List<Long> idsList) {
|
| | | if (idsList != null)
|
| | | for (Long id : idsList)
|
| | | deleteByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void deleteByPrimaryKey(Long id) {
|
| | | banLiShopGoodsImgMapper.deleteByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.shop;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.shop.BanLiShopGoodsMapper;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoods;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsImg;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsSets;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopGoodsException;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopGoodsSetException;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopGoodsSetPayException;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsImgService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsSetService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | | public class BanLiShopGoodsServiceImpl implements BanLiShopGoodsService {
|
| | |
|
| | | @Resource
|
| | | private BanLiShopGoodsSetService banLiShopGoodsSetService;
|
| | |
|
| | | @Resource
|
| | | private BanLiShopGoodsImgService banLiShopGoodsImgService;
|
| | |
|
| | | @Resource
|
| | | private BanLiShopGoodsMapper banLiShopGoodsMapper;
|
| | |
|
| | | @Override
|
| | | public List<BanLiShopGoods> listGoods(String key, Integer state, int page, int pageSize) {
|
| | | return banLiShopGoodsMapper.listGoods(key, state, (page - 1) * pageSize, pageSize);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countGoods(String key, Integer state) {
|
| | | return banLiShopGoodsMapper.countGoods(key, state);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BanLiShopGoods getGoodsDetail(Long goodsId) {
|
| | | return banLiShopGoodsMapper.selectDetailByPrimaryKey(goodsId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BanLiShopGoods selectByPrimaryKey(Long id) {
|
| | | return banLiShopGoodsMapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void addGoods(BanLiShopGoods goods)
|
| | | throws BanLiShopGoodsException, BanLiShopGoodsSetException, BanLiShopGoodsSetPayException {
|
| | | if (goods.getId() == null) {// 新增
|
| | | if (goods.getGoodsClass() == null || goods.getGoodsClass().getId() == null) {
|
| | | throw new BanLiShopGoodsSetException(1, "请指定商品分类");
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(goods.getTitle()))
|
| | | throw new BanLiShopGoodsSetException(1, "缺少标题");
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(goods.getPicture()))
|
| | | throw new BanLiShopGoodsSetException(1, "缺少封面图");
|
| | |
|
| | | // 默认上线
|
| | | if (goods.getState() == null)
|
| | | goods.setState(BanLiShopGoods.STATE_ONLINE);
|
| | |
|
| | | if (goods.getSalesCount() == null)
|
| | | goods.setSalesCount(0L);
|
| | |
|
| | | if (goods.getCreateTime() == null)
|
| | | goods.setCreateTime(new Date());
|
| | |
|
| | | banLiShopGoodsMapper.insertSelective(goods);
|
| | | if (goods.getWeight() == null) {// 权重更新
|
| | | BanLiShopGoods update = new BanLiShopGoods();
|
| | | update.setId(goods.getId());
|
| | | update.setWeight((int) goods.getId().longValue());
|
| | | banLiShopGoodsMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | |
|
| | | if (goods.getSetsList() != null && goods.getSetsList().size() > 0) {
|
| | | for (BanLiShopGoodsSets set : goods.getSetsList())// 更新支付方式
|
| | | {
|
| | | set.setGoods(goods);
|
| | | banLiShopGoodsSetService.addSet(set);
|
| | | }
|
| | | }
|
| | |
|
| | | // TODO 更改图片
|
| | | if (goods.getImgList() != null)
|
| | | for (BanLiShopGoodsImg img : goods.getImgList()) {
|
| | | banLiShopGoodsImgService.addImg(img.getUrl(), goods.getId());
|
| | | }
|
| | |
|
| | | } else {// 修改
|
| | | updateSelectiveByPrimaryKey(goods);
|
| | | // 更新支付方式
|
| | | if (goods.getSetsList() != null && goods.getSetsList().size() > 0) {
|
| | | // 删除原有套餐
|
| | | List<BanLiShopGoodsSets> setList = banLiShopGoodsSetService.listByGoodsId(goods.getId());
|
| | | for (BanLiShopGoodsSets set : setList)
|
| | | banLiShopGoodsSetService.deleteByPrimaryKey(set.getId());
|
| | |
|
| | | // 添加新的套餐
|
| | | for (BanLiShopGoodsSets set : goods.getSetsList())// 更新支付方式
|
| | | banLiShopGoodsSetService.addSet(set);
|
| | | }
|
| | |
|
| | | // 更新图片
|
| | | if (goods.getImgList() != null && goods.getImgList().size() > 0) {
|
| | | // 删除原有图片
|
| | | List<BanLiShopGoodsImg> imgList = banLiShopGoodsImgService.listByGoodsId(goods.getId());
|
| | | for (BanLiShopGoodsImg img : imgList)
|
| | | banLiShopGoodsImgService.deleteByPrimaryKey(img.getId());
|
| | | // 添加新的图片
|
| | | for (BanLiShopGoodsImg img : goods.getImgList())// 更新支付方式
|
| | | banLiShopGoodsImgService.addImg(img.getUrl(), goods.getId());
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void updateSelectiveByPrimaryKey(BanLiShopGoods goods) {
|
| | | if (goods == null || goods.getId() == null)
|
| | | return;
|
| | | if (goods.getUpdateTime() == null)
|
| | | goods.setUpdateTime(new Date());
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void delete(List<Long> idsList) {
|
| | | if (idsList != null)
|
| | | for (Long id : idsList)
|
| | | deleteByPrimaryKey(id);
|
| | |
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void deleteByPrimaryKey(Long id) {
|
| | | banLiShopGoodsMapper.deleteByPrimaryKey(id);
|
| | | List<BanLiShopGoodsSets> setList = banLiShopGoodsSetService.listByGoodsId(id);
|
| | | if (setList != null)
|
| | | for (BanLiShopGoodsSets set : setList)
|
| | | banLiShopGoodsSetService.deleteByPrimaryKey(set.getId());
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.shop;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.shop.BanLiShopGoodsSetsPayMapper;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsSetsPay;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopGoodsSetPayException;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsSetPayService;
|
| | |
|
| | | @Service
|
| | | public class BanLiShopGoodsSetPayServiceImpl implements BanLiShopGoodsSetPayService {
|
| | |
|
| | | @Resource
|
| | | private BanLiShopGoodsSetsPayMapper banLiShopGoodsSetsPayMapper;
|
| | |
|
| | | @Override
|
| | | public List<BanLiShopGoodsSetsPay> listByGoodsSetId(Long goodsSetId) {
|
| | | return banLiShopGoodsSetsPayMapper.listByGoodsSetId(goodsSetId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int countByGoodsSetId(Long goodsSetId) {
|
| | | return (int) banLiShopGoodsSetsPayMapper.countByGoodsSetId(goodsSetId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BanLiShopGoodsSetsPay selectByPrimaryKey(Long id) {
|
| | | return banLiShopGoodsSetsPayMapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void addSetPay(BanLiShopGoodsSetsPay pay) throws BanLiShopGoodsSetPayException {
|
| | | if (pay.getId() == null)// 新增
|
| | | {
|
| | | // 判断参数是否齐全
|
| | | if (pay.getGoodsSet() == null || pay.getGoodsSet().getId() == null)
|
| | | throw new BanLiShopGoodsSetPayException(1, "套餐不存在");
|
| | |
|
| | | if (pay.getPayType() == null)
|
| | | throw new BanLiShopGoodsSetPayException(1, "请指定支付方式");
|
| | |
|
| | | if (pay.getPayType() == BanLiShopGoodsSetsPay.PAY_TYPE_HONGBAO) {
|
| | | if (pay.getHongBaoPrice() == null)
|
| | | throw new BanLiShopGoodsSetPayException(1, "请指定价格");
|
| | | } else if (pay.getPayType() == BanLiShopGoodsSetsPay.PAY_TYPE_BALANCE) {
|
| | | if (pay.getBalancePrice() == null)
|
| | | throw new BanLiShopGoodsSetPayException(1, "请指定价格");
|
| | | } else if (pay.getPayType() == BanLiShopGoodsSetsPay.PAY_TYPE_HONGBAO_MONEY) {
|
| | | if (pay.getHongBaoPrice() == null || pay.getMoneyPrice() == null)
|
| | | throw new BanLiShopGoodsSetPayException(1, "请指定价格");
|
| | | } else if (pay.getPayType() == BanLiShopGoodsSetsPay.PAY_TYPE_MONEY) {
|
| | | if (pay.getMoneyPrice() == null)
|
| | | throw new BanLiShopGoodsSetPayException(1, "请指定价格");
|
| | | }
|
| | | if (pay.getCreateTime() == null)
|
| | | pay.setCreateTime(new Date());
|
| | | banLiShopGoodsSetsPayMapper.insertSelective(pay);
|
| | |
|
| | | if (pay.getWeight() == null) {// 权重更新
|
| | | BanLiShopGoodsSetsPay update = new BanLiShopGoodsSetsPay();
|
| | | update.setId(pay.getId());
|
| | | update.setWeight((int) pay.getId().longValue());
|
| | | banLiShopGoodsSetsPayMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | } else {// 修改
|
| | | updateSelectiveByPrimaryKey(pay);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void updateSelectiveByPrimaryKey(BanLiShopGoodsSetsPay pay) {
|
| | | if (pay.getId() == null)
|
| | | return;
|
| | | if (pay.getUpdateTime() == null)
|
| | | pay.setUpdateTime(new Date());
|
| | |
|
| | | banLiShopGoodsSetsPayMapper.updateByPrimaryKeySelective(pay);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void delete(List<Long> idsList) {
|
| | | if (idsList != null)
|
| | | for (Long id : idsList)
|
| | | deleteByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void deleteByPrimaryKey(Long id) {
|
| | | banLiShopGoodsSetsPayMapper.deleteByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.shop;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.shop.BanLiShopGoodsSetsMapper;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsSets;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsSetsPay;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopGoodsSetException;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopGoodsSetPayException;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsSetPayService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsSetService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | | public class BanLiShopGoodsSetServiceImpl implements BanLiShopGoodsSetService {
|
| | |
|
| | | @Resource
|
| | | private BanLiShopGoodsSetPayService banLiShopGoodsSetPayService;
|
| | |
|
| | | @Resource
|
| | | private BanLiShopGoodsSetsMapper banLiShopGoodsSetsMapper;
|
| | |
|
| | | @Override
|
| | | public List<BanLiShopGoodsSets> listByGoodsId(Long goodsId) {
|
| | | return banLiShopGoodsSetsMapper.listByGoodsId(goodsId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int countByGoodsId(Long goodsId) {
|
| | | return (int) banLiShopGoodsSetsMapper.countByGoodsId(goodsId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BanLiShopGoodsSets selectByPrimaryKey(Long id) {
|
| | | return banLiShopGoodsSetsMapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void addSet(BanLiShopGoodsSets set) throws BanLiShopGoodsSetException, BanLiShopGoodsSetPayException {
|
| | | if (set.getId() == null)// 添加
|
| | | {
|
| | | if (set.getGoods() == null || set.getGoods().getId() == null) {
|
| | | throw new BanLiShopGoodsSetException(1, "请指定商品");
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(set.getName()))
|
| | | throw new BanLiShopGoodsSetException(1, "缺少套餐名字");
|
| | |
|
| | | if (set.getOriginalPrice() == null || set.getZkPrice() == null) {
|
| | | throw new BanLiShopGoodsSetException(1, "价格信息不完整");
|
| | | }
|
| | |
|
| | | if (set.getStock() == null) {
|
| | | throw new BanLiShopGoodsSetException(1, "缺少库存信息");
|
| | | }
|
| | |
|
| | | if (set.getSalesCount() == null)
|
| | | set.setSalesCount(0L);
|
| | |
|
| | | if (set.getCreateTime() == null)
|
| | | set.setCreateTime(new Date());
|
| | |
|
| | | banLiShopGoodsSetsMapper.insertSelective(set);
|
| | | if (set.getWeight() == null) {// 权重更新
|
| | | BanLiShopGoodsSets update = new BanLiShopGoodsSets();
|
| | | update.setId(set.getId());
|
| | | update.setWeight((int) set.getId().longValue());
|
| | | banLiShopGoodsSetsMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | |
|
| | | if (set.getPayList() != null && set.getPayList().size() > 0) {
|
| | | for (BanLiShopGoodsSetsPay pay : set.getPayList())// 添加支付方式
|
| | | {
|
| | | pay.setGoodsSet(set);
|
| | | banLiShopGoodsSetPayService.addSetPay(pay);
|
| | | }
|
| | | }
|
| | |
|
| | | } else {// 修改
|
| | | if (set.getUpdateTime() == null) {
|
| | | set.setUpdateTime(new Date());
|
| | | }
|
| | |
|
| | | banLiShopGoodsSetsMapper.updateByPrimaryKeySelective(set);
|
| | |
|
| | | // 更新支付方式
|
| | | if (set.getPayList() != null && set.getPayList().size() > 0) {
|
| | | for (BanLiShopGoodsSetsPay pay : set.getPayList())// 更新支付方式
|
| | | banLiShopGoodsSetPayService.addSetPay(pay);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void updateSelectiveByPrimaryKey(BanLiShopGoodsSets set) {
|
| | | if (set.getId() == null)
|
| | | return;
|
| | | if (set.getUpdateTime() == null)
|
| | | set.setUpdateTime(new Date());
|
| | | banLiShopGoodsSetsMapper.updateByPrimaryKeySelective(set);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void delete(List<Long> idsList) {
|
| | | if (idsList != null)
|
| | | for (Long id : idsList)
|
| | | deleteByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void deleteByPrimaryKey(Long id) {
|
| | | banLiShopGoodsSetsMapper.deleteByPrimaryKey(id);
|
| | | List<BanLiShopGoodsSetsPay> payList = banLiShopGoodsSetPayService.listByGoodsSetId(id);
|
| | | if (payList != null)
|
| | | for (BanLiShopGoodsSetsPay pay : payList) {// 删除支付方式
|
| | | banLiShopGoodsSetPayService.deleteByPrimaryKey(pay.getId());
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.shop;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import org.yeshi.utils.entity.wx.WXAPPInfo;
|
| | | import org.yeshi.utils.exception.WXOrderException;
|
| | | import org.yeshi.utils.wx.WXPayUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.redpack.RedPackDetail;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoods;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsClass;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsSets;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopOrder;
|
| | | import com.yeshi.fanli.exception.redpack.RedPackBalanceException;
|
| | | import com.yeshi.fanli.exception.redpack.RedPackDetailException;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopOrderException;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackBalanceService;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackDetailService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsClassService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsSetService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopOrderPayService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopOrderService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.factory.RedPackDetailFactory;
|
| | |
|
| | | @Service
|
| | | public class BanLiShopOrderPayServiceImpl implements BanLiShopOrderPayService {
|
| | | @Resource
|
| | | private BanLiShopGoodsSetService banLiShopGoodsSetService;
|
| | |
|
| | | @Resource
|
| | | private BanLiShopGoodsService banLiShopGoodsService;
|
| | |
|
| | | @Resource
|
| | | private BanLiShopGoodsClassService banLiShopGoodsClassService;
|
| | |
|
| | | @Resource
|
| | | private RedPackBalanceService redPackBalanceService;
|
| | |
|
| | | @Resource
|
| | | private BanLiShopOrderService banLiShopOrderService;
|
| | |
|
| | | @Resource
|
| | | private RedPackDetailService redPackDetailService;
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void payOrderByHongBao(Long orderId) throws BanLiShopOrderException, RedPackBalanceException {
|
| | | BanLiShopOrder order = banLiShopOrderService.selectByPrimaryKeyForUpdate(orderId);
|
| | | if (order == null) {
|
| | | throw new BanLiShopOrderException(1, "订单不存在");
|
| | | }
|
| | | if (order.getHongBaoPayment() == null)
|
| | | throw new BanLiShopOrderException(2, "不需要采用红包支付");
|
| | |
|
| | | if (order.getHongBaoPaymentState() != null && order.getHongBaoPaymentState() == BanLiShopOrder.PAY_STATE_PAID) {
|
| | | throw new BanLiShopOrderException(3, "重复支付");
|
| | | }
|
| | |
|
| | | BanLiShopGoods goods = banLiShopGoodsService.selectByPrimaryKey(order.getGoods().getId());
|
| | | BanLiShopGoodsClass goodsClass = banLiShopGoodsClassService.selectByPrimaryKey(goods.getGoodsClass().getId());
|
| | | BanLiShopGoodsSets set = banLiShopGoodsSetService.selectByPrimaryKey(order.getGoodsSet().getId());
|
| | | RedPackDetail detail = null;
|
| | | try {
|
| | | detail = RedPackDetailFactory.createUseByShopOrder(orderId, order.getUid(), goodsClass.getName(),
|
| | | set.getName(), order.getHongBaoPayment());
|
| | | } catch (RedPackDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | if (detail == null)
|
| | | throw new RedPackBalanceException(4, "红包详情失败");
|
| | | redPackBalanceService.subRedPack(order.getUid(), order.getHongBaoPayment(), detail);
|
| | |
|
| | | BanLiShopOrder update = new BanLiShopOrder();
|
| | | update.setId(order.getId());
|
| | | update.setHongBaoPaymentState(BanLiShopOrder.PAY_STATE_PAID);
|
| | | // 判断其他待支付项是否已经支付
|
| | | update.setUpdateTime(new Date());
|
| | | if (order.getState() == BanLiShopOrder.STATE_NO_PAY)
|
| | | if ((order.getBalancePaymentState() == null
|
| | | || order.getBalancePaymentState() == BanLiShopOrder.PAY_STATE_PAID)
|
| | | && (order.getMoneyPaymentState() == null
|
| | | || order.getMoneyPaymentState() == BanLiShopOrder.PAY_STATE_PAID))// 其他待支付项已经支付
|
| | | update.setState(BanLiShopOrder.STATE_PAID);
|
| | | banLiShopOrderService.udpateSelectiveByPrimaryKey(update);
|
| | | if (update.getState() != null && update.getState() == BanLiShopOrder.STATE_PAID) {
|
| | | paySuccess(order);
|
| | | }
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void payOrderByMoney(Long orderId, BigDecimal money) throws BanLiShopOrderException {
|
| | | BanLiShopOrder order = banLiShopOrderService.selectByPrimaryKeyForUpdate(orderId);
|
| | | if (order == null) {
|
| | | throw new BanLiShopOrderException(1, "订单不存在");
|
| | | }
|
| | | if (order.getMoneyPayment() == null)
|
| | | throw new BanLiShopOrderException(2, "不需要采用现金支付");
|
| | |
|
| | | if (order.getMoneyPaymentState() != null && order.getMoneyPaymentState() != BanLiShopOrder.PAY_STATE_NOPAY) {
|
| | | throw new BanLiShopOrderException(3, "重复支付");
|
| | | }
|
| | |
|
| | | if (order.getMoneyPayment().compareTo(money) > 0) {
|
| | | throw new BanLiShopOrderException(4, "支付金额不够");
|
| | | }
|
| | |
|
| | | // 支付成功
|
| | | BanLiShopOrder update = new BanLiShopOrder();
|
| | | update.setId(order.getId());
|
| | | update.setMoneyPaymentState(BanLiShopOrder.PAY_STATE_PAID);
|
| | | // 判断其他待支付项是否已经支付
|
| | | update.setUpdateTime(new Date());
|
| | | if (order.getState() == BanLiShopOrder.STATE_NO_PAY)
|
| | | if ((order.getBalancePaymentState() == null
|
| | | || order.getBalancePaymentState() == BanLiShopOrder.PAY_STATE_PAID)
|
| | | && (order.getHongBaoPaymentState() == null
|
| | | || order.getHongBaoPaymentState() == BanLiShopOrder.PAY_STATE_PAID))// 其他待支付项已经支付
|
| | | update.setState(BanLiShopOrder.STATE_PAID);
|
| | | banLiShopOrderService.udpateSelectiveByPrimaryKey(update);
|
| | | if (update.getState() != null && update.getState() == BanLiShopOrder.STATE_PAID) {
|
| | | paySuccess(order);
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 支付成功
|
| | | */
|
| | | private void paySuccess(BanLiShopOrder order) {
|
| | | // 将红包明细外显
|
| | | RedPackDetail detail = null;
|
| | | try {
|
| | | detail = RedPackDetailFactory.createUseByShopOrder(order.getId(), order.getUid(), "", "",
|
| | | order.getHongBaoPayment());
|
| | | } catch (RedPackDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | if (detail != null) {
|
| | | redPackDetailService.changeDisplayByIdentifyCode(detail.getIdentifyCode(), true);
|
| | | }
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void refund(Long orderId) throws BanLiShopOrderException {
|
| | | // 订单退款
|
| | | // 查询订单是否已经被拒绝
|
| | | BanLiShopOrder order = banLiShopOrderService.selectByPrimaryKeyForUpdate(orderId);
|
| | | if (order == null)
|
| | | throw new BanLiShopOrderException(1, "订单不存在");
|
| | | if (order.getState() != BanLiShopOrder.STATE_REJECT)
|
| | | throw new BanLiShopOrderException(2, "订单未被拒绝/订单已退款");
|
| | |
|
| | | BanLiShopOrder update = new BanLiShopOrder();
|
| | | update.setId(order.getId());
|
| | | if (order.getHongBaoPaymentState() != null && order.getHongBaoPaymentState() == BanLiShopOrder.PAY_STATE_PAID) {
|
| | | BanLiShopGoods goods = banLiShopGoodsService.selectByPrimaryKey(order.getGoods().getId());
|
| | | BanLiShopGoodsClass goodsClass = banLiShopGoodsClassService
|
| | | .selectByPrimaryKey(goods.getGoodsClass().getId());
|
| | | BanLiShopGoodsSets set = banLiShopGoodsSetService.selectByPrimaryKey(order.getGoodsSet().getId());
|
| | | // 红包退款
|
| | | RedPackDetail detail = null;
|
| | | try {
|
| | | detail = RedPackDetailFactory.createShopOrderDrawBack(orderId, order.getUid(), goodsClass.getName(),
|
| | | set.getName(), order.getHongBaoPayment());
|
| | | } catch (RedPackDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | if (detail == null)
|
| | | throw new BanLiShopOrderException(4, "红包详情失败");
|
| | | try {
|
| | | redPackBalanceService.addRedPack(order.getUid(), order.getHongBaoPayment(), detail);
|
| | | } catch (RedPackBalanceException e) {
|
| | | throw new BanLiShopOrderException(5, "红包退款失败");
|
| | | }
|
| | | update.setHongBaoPaymentState(BanLiShopOrder.PAY_STATE_REFUND);
|
| | | }
|
| | |
|
| | | // TODO 微信支付退款
|
| | | if (order.getMoneyPaymentState() != null && order.getMoneyPaymentState() == BanLiShopOrder.PAY_STATE_PAID) {
|
| | | try {
|
| | | boolean success = WXPayUtil.refund(order.getOrderNo(), order.getMoneyPayment(), order.getMoneyPayment(),
|
| | | null, new WXAPPInfo(), null, null);
|
| | | if (success) {
|
| | | update.setMoneyPaymentState(BanLiShopOrder.PAY_STATE_REFUND);
|
| | | } else
|
| | | throw new BanLiShopOrderException(6, "微信支付退款失败");
|
| | |
|
| | | } catch (WXOrderException e) {
|
| | | throw new BanLiShopOrderException(6, "微信支付退款失败");
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.shop;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.aliyun.openservices.ons.api.Message;
|
| | | import com.aliyun.openservices.ons.api.Producer;
|
| | | import com.aliyun.openservices.ons.api.SendResult;
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dao.mybatis.shop.BanLiShopOrderMapper;
|
| | | import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.order.body.BanLiShopOrderMQMsg;
|
| | | import com.yeshi.fanli.entity.mq.MQUnSendInfo;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackDetail;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoods;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsClass;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsSets;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopOrder;
|
| | | import com.yeshi.fanli.exception.mq.MQUnSendInfoException;
|
| | | import com.yeshi.fanli.exception.redpack.RedPackBalanceException;
|
| | | import com.yeshi.fanli.exception.redpack.RedPackDetailException;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopOrderException;
|
| | | import com.yeshi.fanli.service.inter.mq.MQUnSendInfoService;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackBalanceService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsClassService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopGoodsSetService;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopOrderService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.factory.RedPackDetailFactory;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | | import com.yeshi.fanli.util.shop.BanLiShopOrderUtil;
|
| | |
|
| | | @Service
|
| | | public class BanLiShopOrderServiceImpl implements BanLiShopOrderService {
|
| | |
|
| | | @Resource
|
| | | private BanLiShopOrderMapper banLiShopOrderMapper;
|
| | |
|
| | | @Resource
|
| | | private BanLiShopGoodsSetService banLiShopGoodsSetService;
|
| | |
|
| | | @Resource
|
| | | private BanLiShopGoodsService banLiShopGoodsService;
|
| | |
|
| | | @Resource
|
| | | private BanLiShopGoodsClassService banLiShopGoodsClassService;
|
| | |
|
| | | @Resource
|
| | | private RedPackBalanceService redPackBalanceService;
|
| | |
|
| | | @Resource(name = "producer")
|
| | | private Producer producer;
|
| | |
|
| | | @Resource
|
| | | private MQUnSendInfoService mqUnSendInfoService;
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void addOrder(BanLiShopOrder order) throws BanLiShopOrderException {
|
| | | // 查询必要的参数是否添加
|
| | | if (order.getGoodsSet() == null || order.getGoodsSet().getId() == null || order.getGoods() == null
|
| | | || order.getGoods().getId() == null)
|
| | | throw new BanLiShopOrderException(1, "未选择商品");
|
| | |
|
| | | if (order.getUid() == null)
|
| | | throw new BanLiShopOrderException(1, "缺少用户ID");
|
| | |
|
| | | if (order.getHongBaoPayment() == null || order.getBalancePayment() == null || order.getMoneyPayment() == null) {
|
| | | throw new BanLiShopOrderException(1, "未选择支付方式");
|
| | | }
|
| | |
|
| | | if (order.getHongBaoPayment() != null) {
|
| | | order.setHongBaoPaymentState(BanLiShopOrder.PAY_STATE_NOPAY);
|
| | | }
|
| | |
|
| | | if (order.getBalancePayment() != null) {
|
| | | order.setBalancePaymentState(BanLiShopOrder.PAY_STATE_NOPAY);
|
| | | }
|
| | |
|
| | | if (order.getMoneyPayment() != null) {
|
| | | order.setMoneyPaymentState(BanLiShopOrder.PAY_STATE_NOPAY);
|
| | | }
|
| | |
|
| | | order.setState(BanLiShopOrder.STATE_NO_PAY);
|
| | | // 判断商品套餐是否存在
|
| | | BanLiShopGoodsSets set = banLiShopGoodsSetService.selectByPrimaryKey(order.getGoodsSet().getId());
|
| | | if (set == null) {
|
| | | throw new BanLiShopOrderException(1, "商品套餐不存在");
|
| | | }
|
| | |
|
| | | BanLiShopGoods goods = banLiShopGoodsService.selectByPrimaryKey(order.getGoods().getId());
|
| | | if (goods == null) {
|
| | | throw new BanLiShopOrderException(1, "商品已下线");
|
| | | }
|
| | |
|
| | | if (goods.getCreateTime() == null)
|
| | | goods.setCreateTime(new Date());
|
| | |
|
| | | banLiShopOrderMapper.insertSelective(order);
|
| | |
|
| | | // 添加订单号
|
| | | String orderNo = BanLiShopOrderUtil.createOrderNo(order.getId());
|
| | | // 更新订单号
|
| | | BanLiShopOrder update = new BanLiShopOrder();
|
| | | update.setId(order.getId());
|
| | | update.setOrderNo(orderNo);
|
| | | banLiShopOrderMapper.updateByPrimaryKeySelective(update);
|
| | |
|
| | | // 订单添加成功 ,延时通知后续
|
| | | sendPlaceOrderMsg(order.getId(), order.getUid());
|
| | | }
|
| | |
|
| | | private void sendPlaceOrderMsg(Long orderId, Long uid) {
|
| | |
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.banLiShopOrderDelay.name(),
|
| | | new Gson().toJson(new BanLiShopOrderMQMsg(orderId, uid)).getBytes());
|
| | | msg.setKey(orderId + "");
|
| | | long delayTime = System.currentTimeMillis() + (Constant.IS_TEST ? 1000 * 30L : 1000 * 60 * 10);// 10分钟后通知
|
| | | msg.setStartDeliverTime(delayTime);
|
| | | SendResult sendResult = producer.send(msg);
|
| | | if (sendResult == null) {
|
| | | MQUnSendInfo info = new MQUnSendInfo();
|
| | | info.setBody(new String(msg.getBody()));
|
| | | if (msg.getStartDeliverTime() > 0)
|
| | | info.setDeliverTime(new Date(msg.getStartDeliverTime()));
|
| | | info.setKey(msg.getKey());
|
| | | info.setTag(msg.getTag());
|
| | | info.setTopic(msg.getTopic());
|
| | | try {
|
| | | mqUnSendInfoService.addMQUnSendInfo(info);
|
| | | } catch (MQUnSendInfoException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<BanLiShopOrder> listByUid(Long uid, int page, int pageSize) {
|
| | | return null;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countByUid(Long uid) {
|
| | | return 0;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BanLiShopOrder selectByPrimaryKey(Long id) {
|
| | | return null;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void udpateSelectiveByPrimaryKey(BanLiShopOrder order) {
|
| | |
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void payOrderByHongBao(Long orderId) throws BanLiShopOrderException, RedPackBalanceException {
|
| | | BanLiShopOrder order = banLiShopOrderMapper.selectByPrimaryKeyForUpdate(orderId);
|
| | | if (order == null) {
|
| | | throw new BanLiShopOrderException(1, "订单不存在");
|
| | | }
|
| | | if (order.getHongBaoPayment() == null)
|
| | | throw new BanLiShopOrderException(2, "不需要采用红包支付");
|
| | |
|
| | | if (order.getHongBaoPaymentState() != null && order.getHongBaoPaymentState() == BanLiShopOrder.PAY_STATE_PAID) {
|
| | | throw new BanLiShopOrderException(3, "重复支付");
|
| | | }
|
| | |
|
| | | BanLiShopGoods goods = banLiShopGoodsService.selectByPrimaryKey(order.getGoods().getId());
|
| | | BanLiShopGoodsClass goodsClass = banLiShopGoodsClassService.selectByPrimaryKey(goods.getGoodsClass().getId());
|
| | | BanLiShopGoodsSets set = banLiShopGoodsSetService.selectByPrimaryKey(order.getGoodsSet().getId());
|
| | | RedPackDetail detail = null;
|
| | | try {
|
| | | detail = RedPackDetailFactory.createUseByShopOrder(orderId, order.getUid(), goodsClass.getName(),
|
| | | set.getName(), order.getHongBaoPayment());
|
| | | } catch (RedPackDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | if (detail == null)
|
| | | throw new RedPackBalanceException(4, "红包详情失败");
|
| | | redPackBalanceService.subRedPack(order.getUid(), order.getHongBaoPayment(), detail);
|
| | |
|
| | | BanLiShopOrder update = new BanLiShopOrder();
|
| | | update.setHongBaoPaymentState(BanLiShopOrder.PAY_STATE_PAID);
|
| | | // 判断其他待支付项是否已经支付
|
| | | update.setUpdateTime(new Date());
|
| | | order.setHongBaoPaymentState(update.getHongBaoPaymentState());
|
| | | update.setState(getOrderPayState(order));
|
| | | banLiShopOrderMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | |
|
| | | private int getOrderPayState(BanLiShopOrder order) {
|
| | | int needPayCount = 0;
|
| | | int paidCount = 0;
|
| | | // 获取订单付款状态
|
| | | if (order.getHongBaoPayment() != null) {
|
| | | needPayCount++;
|
| | | if (order.getHongBaoPaymentState() != null
|
| | | && order.getHongBaoPaymentState() == BanLiShopOrder.PAY_STATE_PAID)
|
| | | paidCount++;
|
| | | }
|
| | |
|
| | | if (order.getBalancePayment() != null) {
|
| | | needPayCount++;
|
| | | if (order.getBalancePaymentState() != null
|
| | | && order.getBalancePaymentState() == BanLiShopOrder.PAY_STATE_PAID)
|
| | | paidCount++;
|
| | | }
|
| | |
|
| | | if (order.getMoneyPayment() != null) {
|
| | | needPayCount++;
|
| | | if (order.getMoneyPaymentState() != null && order.getMoneyPaymentState() == BanLiShopOrder.PAY_STATE_PAID)
|
| | | paidCount++;
|
| | | }
|
| | |
|
| | | if (needPayCount == paidCount)
|
| | | return BanLiShopOrder.STATE_PAID;
|
| | | else {
|
| | | if (paidCount == 0)
|
| | | return BanLiShopOrder.STATE_NO_PAY;
|
| | | else
|
| | | return BanLiShopOrder.STATE_PART_PAY;
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void payOrderByMoney(Long orderId, BigDecimal money) throws BanLiShopOrderException {
|
| | | BanLiShopOrder order = banLiShopOrderMapper.selectByPrimaryKeyForUpdate(orderId);
|
| | | if (order == null) {
|
| | | throw new BanLiShopOrderException(1, "订单不存在");
|
| | | }
|
| | | if (order.getMoneyPayment() == null)
|
| | | throw new BanLiShopOrderException(2, "不需要采用现金支付");
|
| | |
|
| | | if (order.getMoneyPaymentState() != null && order.getMoneyPaymentState() == BanLiShopOrder.PAY_STATE_PAID) {
|
| | | throw new BanLiShopOrderException(3, "重复支付");
|
| | | }
|
| | |
|
| | | if (order.getMoneyPayment().compareTo(money) > 0) {
|
| | | throw new BanLiShopOrderException(4, "支付金额不够");
|
| | | }
|
| | |
|
| | | // 支付成功
|
| | | BanLiShopOrder update = new BanLiShopOrder();
|
| | | update.setMoneyPaymentState(BanLiShopOrder.PAY_STATE_PAID);
|
| | | // 判断其他待支付项是否已经支付
|
| | | update.setUpdateTime(new Date());
|
| | | order.setMoneyPaymentState(update.getMoneyPaymentState());
|
| | | update.setState(getOrderPayState(order));
|
| | | banLiShopOrderMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BanLiShopOrder selectByPrimaryKeyForUpdate(Long id) {
|
| | | return banLiShopOrderMapper.selectByPrimaryKeyForUpdate(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void invalidOrderByOrderId(Long id, String desc) {
|
| | | // 判断订单是否存在
|
| | | BanLiShopOrder order = banLiShopOrderMapper.selectByPrimaryKeyForUpdate(id);
|
| | | if (order == null)
|
| | | return;
|
| | |
|
| | | // 判断是否处于未付款
|
| | | if (order.getState() == BanLiShopOrder.STATE_NO_PAY) {
|
| | | BanLiShopOrder update = new BanLiShopOrder();
|
| | | update.setId(id);
|
| | | update.setStateDesc(desc);
|
| | | update.setState(BanLiShopOrder.STATE_INVALID);
|
| | | update.setUpdateTime(new Date());
|
| | | banLiShopOrderMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void rejectOrder(Long id, String msg) throws BanLiShopOrderException {
|
| | | // 判断订单是否处于付款状态
|
| | | BanLiShopOrder order = banLiShopOrderMapper.selectByPrimaryKeyForUpdate(id);
|
| | | if (order == null)
|
| | | throw new BanLiShopOrderException(1, "订单不存在");
|
| | |
|
| | | if (order.getState() != BanLiShopOrder.STATE_PAID)
|
| | | throw new BanLiShopOrderException(1, "订单未处于待审核状态");
|
| | |
|
| | | // TODO 订单退款
|
| | | BanLiShopOrder update = new BanLiShopOrder();
|
| | | update.setState(BanLiShopOrder.STATE_REJECT);
|
| | | update.setStateDesc(msg);
|
| | | update.setUpdateTime(new Date());
|
| | | banLiShopOrderMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.aliyun.openservices.ons.api.transaction.TransactionStatus;
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserSystemCouponMapper;
|
| | | import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserSystemCouponUseMQMsg;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherCouponActivateDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO;
|
| | | import com.yeshi.fanli.dto.user.coupon.UserSystemCouponUseMQMsgDTO;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail.MsgTypeOtherTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | |
| | |
|
| | | @Resource(name = "orderTransactionProducer")
|
| | | private TransactionProducer orderTransactionProducer;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserSystemCouponActivateService userSystemCouponActivateService;
|
| | | |
| | |
|
| | | @Override
|
| | | public int insertSelective(UserSystemCoupon record) {
|
| | |
| | | // 提成金额
|
| | | BigDecimal money = MoneyBigDecimalUtil.mul(hongBao, percent);
|
| | |
|
| | | UserSystemCouponUseMQMsgDTO mqMsg = new UserSystemCouponUseMQMsgDTO(userSystemCoupon.getId(),
|
| | | order.getOrderId(), sourceType);
|
| | | UserSystemCouponUseMQMsg mqMsg = new UserSystemCouponUseMQMsg(userSystemCoupon.getId(), order.getOrderId(),
|
| | | sourceType, systemCoupon.getType().name());
|
| | | // 事务消息
|
| | | Message msg = new Message(MQTopicName.TOPIC_SYSTEM_COUPON_USE.name(), systemCoupon.getType().name(),
|
| | | Message msg = new Message(MQTopicName.TOPIC_USER.name(), UserTopicTagEnum.useSystemCoupon.name(),
|
| | | new Gson().toJson(mqMsg).getBytes());
|
| | | try {
|
| | | SendResult result = orderTransactionProducer.send(msg, new LocalTransactionExecuter() {
|
| | |
| | | if (VersionUtil.greaterThan_2_0_2(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | int activateCount = userSystemCouponActivateService.getActivateCount(userCouponVO.getId());
|
| | | String activateNum = configService.get("free_coupon_activate_num");
|
| | | userCouponVO.setCouponEffect("(" + activateCount + "/"+ Integer.parseInt(activateNum) +")待激活");
|
| | | userCouponVO.setCouponEffect(
|
| | | "(" + activateCount + "/" + Integer.parseInt(activateNum) + ")待激活");
|
| | | }
|
| | | } else if (CouponTypeEnum.welfareFreeCoupon == type) {
|
| | | jumpBtn = new HashMap<String, Object>();
|
| | |
| | |
|
| | | return userCouponVO;
|
| | | }
|
| | |
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | |
| | | return userSystemCouponMapper.getFreeCouponByType(uid, type);
|
| | | }
|
| | |
|
| | | |
| | | @RequestSerializableByKeyService(key = "#uid")
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void triggerFreeCouponActivate(Long uid) {
|
| | | UserSystemCoupon coupon = userSystemCouponMapper.getNeedActivateCouponByType(uid, CouponTypeEnum.freeCoupon.name());
|
| | | UserSystemCoupon coupon = userSystemCouponMapper.getNeedActivateCouponByType(uid,
|
| | | CouponTypeEnum.freeCoupon.name());
|
| | | if (coupon == null)
|
| | | return;
|
| | |
|
| | | Long id = coupon.getId();
|
| | | UserSystemCouponActivate couponActivate = userSystemCouponActivateService.selectForUpdate(id);
|
| | | |
| | |
|
| | | // 激活数量
|
| | | boolean result = false;
|
| | | int limitNum = Integer.parseInt(configService.get("free_coupon_activate_num"));
|
| | | |
| | |
|
| | | Integer state = couponActivate.getState();
|
| | | int count = couponActivate.getCount();
|
| | | count++;
|
| | | if(count >= limitNum) {
|
| | | if (count >= limitNum) {
|
| | | result = true;
|
| | | state = UserSystemCouponActivate.STATE_END;
|
| | | }
|
| | | |
| | |
|
| | | UserSystemCouponActivate updateActivate = new UserSystemCouponActivate();
|
| | | updateActivate.setId(id);
|
| | | updateActivate.setState(state);
|
| | | updateActivate.setCount(count);
|
| | | updateActivate.setUpdateTime(new Date());
|
| | | userSystemCouponActivateService.updateByPrimaryKeySelective(updateActivate);
|
| | | |
| | |
|
| | | // 激活奖励券
|
| | | if (result) {
|
| | | activateFreeCoupon(coupon, limitNum);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 激活券
|
| | | * |
| | | * @param coupon
|
| | | * @param activateNum
|
| | | */
|
| | |
| | | try {
|
| | | Date nowDate = new Date();
|
| | | SystemCoupon systemCoupon = coupon.getSystemCoupon();
|
| | | |
| | |
|
| | | Integer expiryDay = systemCoupon.getExpiryDay();
|
| | | String endDay = DateUtil.plusDay(expiryDay - 1, nowDate);
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
| | |
| | | userCoupon.setStartTime(nowDate);
|
| | | userCoupon.setUpdateTime(new Date());
|
| | | userSystemCouponMapper.updateByPrimaryKeySelective(userCoupon);
|
| | | |
| | |
|
| | | // 消息
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | UserSystemCouponGiveRecord giveRecord = userSystemCouponGiveRecordService.getByReceiveId(coupon.getId());
|
| | | UserSystemCouponGiveRecord giveRecord = userSystemCouponGiveRecordService
|
| | | .getByReceiveId(coupon.getId());
|
| | | if (giveRecord == null)
|
| | | return;
|
| | |
|
| | |
| | | * @return
|
| | | */
|
| | | public RedPackDetail getByIdentifyCode(String identifyCode);
|
| | | |
| | | |
| | | /**
|
| | | * 设置是否显示该条数据
|
| | | * @param code
|
| | | * @param disPlay
|
| | | */
|
| | | public void changeDisplayByIdentifyCode(String code,boolean disPlay);
|
| | |
|
| | |
|
| | |
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.shop;
|
| | |
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsClass;
|
| | |
|
| | | /**
|
| | | * 板栗商城商品分类服务
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface BanLiShopGoodsClassService {
|
| | |
|
| | | public BanLiShopGoodsClass selectByPrimaryKey(Long id);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.shop;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsImg;
|
| | |
|
| | | /**
|
| | | * 板栗商城图片服务
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface BanLiShopGoodsImgService {
|
| | |
|
| | | /**
|
| | | * 添加图片
|
| | | * |
| | | * @param pictureUrl
|
| | | */
|
| | | public void addImg(String pictureUrl, Long goodsId);
|
| | |
|
| | | /**
|
| | | * 根据商品ID查询图片
|
| | | * |
| | | * @param goodsId
|
| | | * @return
|
| | | */
|
| | | public List<BanLiShopGoodsImg> listByGoodsId(Long goodsId);
|
| | |
|
| | | /**
|
| | | * 根据主键检索
|
| | | * |
| | | * @param id
|
| | | * @return
|
| | | */
|
| | | public BanLiShopGoodsImg selectByPrimaryKey(Long id);
|
| | |
|
| | | /**
|
| | | * 按主键更新
|
| | | * |
| | | * @param goods
|
| | | */
|
| | | public void updateSelectiveByPrimaryKey(BanLiShopGoodsImg img);
|
| | |
|
| | | /**
|
| | | * 批量删除
|
| | | * |
| | | * @param idsList
|
| | | */
|
| | | public void delete(List<Long> idsList);
|
| | |
|
| | | /**
|
| | | * 按主键删除
|
| | | * |
| | | * @param id
|
| | | */
|
| | | public void deleteByPrimaryKey(Long id);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.shop;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoods;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopGoodsException;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopGoodsSetException;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopGoodsSetPayException;
|
| | |
|
| | | /**
|
| | | * 板栗商城商品服务
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface BanLiShopGoodsService {
|
| | | /**
|
| | | * 商品列表
|
| | | * |
| | | * @param key
|
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return
|
| | | */
|
| | | public List<BanLiShopGoods> listGoods(String key, Integer state, int page, int pageSize);
|
| | |
|
| | | /**
|
| | | * 查询商品数量
|
| | | * |
| | | * @param key
|
| | | * @param state
|
| | | * @return
|
| | | */
|
| | | public long countGoods(String key, Integer state);
|
| | |
|
| | | /**
|
| | | * 获取商品详情
|
| | | * |
| | | * @param goodsId
|
| | | * @return
|
| | | */
|
| | | public BanLiShopGoods getGoodsDetail(Long goodsId);
|
| | |
|
| | | /**
|
| | | * 主键检索
|
| | | * |
| | | * @param id
|
| | | * @return
|
| | | */
|
| | | public BanLiShopGoods selectByPrimaryKey(Long id);
|
| | |
|
| | | /**
|
| | | * 添加商品
|
| | | * |
| | | * @param goods
|
| | | * @throws BanLiShopGoodsException
|
| | | */
|
| | | public void addGoods(BanLiShopGoods goods)
|
| | | throws BanLiShopGoodsException, BanLiShopGoodsSetException, BanLiShopGoodsSetPayException;
|
| | |
|
| | | /**
|
| | | * 按主键更新
|
| | | * |
| | | * @param goods
|
| | | */
|
| | | public void updateSelectiveByPrimaryKey(BanLiShopGoods goods);
|
| | |
|
| | | /**
|
| | | * 批量删除
|
| | | * |
| | | * @param idsList
|
| | | */
|
| | | public void delete(List<Long> idsList);
|
| | |
|
| | | /**
|
| | | * 按主键删除
|
| | | * |
| | | * @param id
|
| | | */
|
| | | public void deleteByPrimaryKey(Long id);
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.shop;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsSetsPay;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopGoodsSetPayException;
|
| | |
|
| | | /**
|
| | | * 板栗商城商品套餐支付方式配置服务
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface BanLiShopGoodsSetPayService {
|
| | |
|
| | | /**
|
| | | * 查询商品下的所有套餐
|
| | | * |
| | | * @param goodsId
|
| | | * @return
|
| | | */
|
| | | public List<BanLiShopGoodsSetsPay> listByGoodsSetId(Long goodsSetId);
|
| | |
|
| | | /**
|
| | | * 计算商品下的套餐数量
|
| | | * |
| | | * @param goodsId
|
| | | * @return
|
| | | */
|
| | | public int countByGoodsSetId(Long goodsSetId);
|
| | |
|
| | | /**
|
| | | * 主键查询
|
| | | * |
| | | * @param id
|
| | | * @return
|
| | | */
|
| | | public BanLiShopGoodsSetsPay selectByPrimaryKey(Long id);
|
| | |
|
| | | /**
|
| | | * 添加套餐
|
| | | * |
| | | * @param set
|
| | | */
|
| | | public void addSetPay(BanLiShopGoodsSetsPay pay) throws BanLiShopGoodsSetPayException;
|
| | |
|
| | | /**
|
| | | * 按主键更新
|
| | | * |
| | | * @param set
|
| | | */
|
| | | public void updateSelectiveByPrimaryKey(BanLiShopGoodsSetsPay pay);
|
| | |
|
| | | /**
|
| | | * 批量删除
|
| | | * |
| | | * @param idsList
|
| | | */
|
| | | public void delete(List<Long> idsList);
|
| | |
|
| | | /**
|
| | | * 按主键删除
|
| | | * |
| | | * @param id
|
| | | */
|
| | | public void deleteByPrimaryKey(Long id);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.shop;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopGoodsSets;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopGoodsSetException;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopGoodsSetPayException;
|
| | |
|
| | | /**
|
| | | * 板栗商城商品套餐服务
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface BanLiShopGoodsSetService {
|
| | |
|
| | | /**
|
| | | * 查询商品下的所有套餐
|
| | | * |
| | | * @param goodsId
|
| | | * @return
|
| | | */
|
| | | public List<BanLiShopGoodsSets> listByGoodsId(Long goodsId);
|
| | |
|
| | | /**
|
| | | * 计算商品下的套餐数量
|
| | | * |
| | | * @param goodsId
|
| | | * @return
|
| | | */
|
| | | public int countByGoodsId(Long goodsId);
|
| | |
|
| | | /**
|
| | | * 主键查询
|
| | | * |
| | | * @param id
|
| | | * @return
|
| | | */
|
| | | public BanLiShopGoodsSets selectByPrimaryKey(Long id);
|
| | |
|
| | | /**
|
| | | * 添加套餐
|
| | | * |
| | | * @param set
|
| | | */
|
| | | public void addSet(BanLiShopGoodsSets set) throws BanLiShopGoodsSetException, BanLiShopGoodsSetPayException;
|
| | |
|
| | | /**
|
| | | * 按主键更新
|
| | | * |
| | | * @param set
|
| | | */
|
| | | public void updateSelectiveByPrimaryKey(BanLiShopGoodsSets set);
|
| | |
|
| | | /**
|
| | | * 批量删除
|
| | | * |
| | | * @param idsList
|
| | | */
|
| | | public void delete(List<Long> idsList);
|
| | |
|
| | | /**
|
| | | * 按主键删除
|
| | | * |
| | | * @param id
|
| | | */
|
| | | public void deleteByPrimaryKey(Long id);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.shop;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | import com.yeshi.fanli.exception.redpack.RedPackBalanceException;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopOrderException;
|
| | |
|
| | | /**
|
| | | * 板栗商城订单服务
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface BanLiShopOrderPayService {
|
| | |
|
| | | /**
|
| | | * 订单支付(用红包)
|
| | | * |
| | | * @param orderId
|
| | | * @throws BanLiShopOrderException
|
| | | * @throws RedPackBalanceException
|
| | | */
|
| | | public void payOrderByHongBao(Long orderId) throws BanLiShopOrderException, RedPackBalanceException;
|
| | |
|
| | | /**
|
| | | * 订单支付(用现金)
|
| | | * |
| | | * @param orderId
|
| | | * @throws BanLiShopOrderException
|
| | | */
|
| | | public void payOrderByMoney(Long orderId, BigDecimal money) throws BanLiShopOrderException;
|
| | |
|
| | | /**
|
| | | * 订单退款
|
| | | * |
| | | * @param orderId
|
| | | * @throws BanLiShopOrderException
|
| | | */
|
| | | public void refund(Long orderId) throws BanLiShopOrderException;
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.shop;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopOrder;
|
| | | import com.yeshi.fanli.exception.redpack.RedPackBalanceException;
|
| | | import com.yeshi.fanli.exception.shop.BanLiShopOrderException;
|
| | |
|
| | | /**
|
| | | * 板栗商城订单服务
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface BanLiShopOrderService {
|
| | |
|
| | | /**
|
| | | * 添加订单
|
| | | * |
| | | * @param order
|
| | | * @throws BanLiShopOrderException
|
| | | */
|
| | | public void addOrder(BanLiShopOrder order) throws BanLiShopOrderException;
|
| | |
|
| | | /**
|
| | | * 使订单失效
|
| | | * |
| | | * @param id
|
| | | */
|
| | | public void invalidOrderByOrderId(Long id,String desc);
|
| | |
|
| | | /**
|
| | | * 拒绝订单
|
| | | * |
| | | * @param id
|
| | | * @param msg
|
| | | * @throws BanLiShopOrderException
|
| | | */
|
| | | public void rejectOrder(Long id, String msg) throws BanLiShopOrderException;
|
| | |
|
| | | /**
|
| | | * 订单支付(用红包)
|
| | | * |
| | | * @param orderId
|
| | | * @throws BanLiShopOrderException
|
| | | * @throws RedPackBalanceException
|
| | | */
|
| | | public void payOrderByHongBao(Long orderId) throws BanLiShopOrderException, RedPackBalanceException;
|
| | |
|
| | | /**
|
| | | * 订单支付(用现金)
|
| | | * |
| | | * @param orderId
|
| | | * @throws BanLiShopOrderException
|
| | | */
|
| | | public void payOrderByMoney(Long orderId, BigDecimal money) throws BanLiShopOrderException;
|
| | |
|
| | | public BanLiShopOrder selectByPrimaryKeyForUpdate(Long id);
|
| | |
|
| | | /**
|
| | | * 根据用户ID检索
|
| | | * |
| | | * @param uid
|
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return
|
| | | */
|
| | | public List<BanLiShopOrder> listByUid(Long uid, int page, int pageSize);
|
| | |
|
| | | /**
|
| | | * 根据用户ID计算
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public long countByUid(Long uid);
|
| | |
|
| | | /**
|
| | | * 根据主键检索
|
| | | * |
| | | * @param id
|
| | | * @return
|
| | | */
|
| | | public BanLiShopOrder selectByPrimaryKey(Long id);
|
| | |
|
| | | /**
|
| | | * 根据主键更新
|
| | | * |
| | | * @param order
|
| | | */
|
| | | public void udpateSelectiveByPrimaryKey(BanLiShopOrder order);
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import com.yeshi.fanli.dto.dataoke.DingDongQiangDTO;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
|
| | |
|
| | | /**
|
| | |
| | | public class RedPackDetailFactory {
|
| | |
|
| | | /**
|
| | | * 红包提现
|
| | | * 红包提现
|
| | | *
|
| | | * @param extract
|
| | | * @return
|
| | |
| | | public static RedPackDetail createExchange(RedPackExchange exchange) throws RedPackDetailException {
|
| | | if (exchange == null)
|
| | | throw new RedPackDetailException(1, "提现记录不能为空");
|
| | | |
| | |
|
| | | RedPackDetail detail = new RedPackDetail();
|
| | | detail.setDisplay(false);
|
| | | detail.setDescInfo( "等待人工审核");
|
| | |
| | | return detail;
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 红包提现通过
|
| | | * 红包提现通过
|
| | | *
|
| | | * @param extract
|
| | | * @return
|
| | |
| | | public static RedPackDetail updateExchangePass(Long id, RedPackExchange exchange) throws RedPackDetailException {
|
| | | if (id == null)
|
| | | throw new RedPackDetailException(1, "明细ID不能为空");
|
| | | |
| | |
|
| | | if (exchange == null)
|
| | | throw new RedPackDetailException(1, "提现记录不能为空");
|
| | | |
| | |
|
| | | RedPackDetail detail = new RedPackDetail();
|
| | | detail.setId(id);
|
| | | detail.setDisplay(true);
|
| | |
| | | detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.redExchangePass.name() + ":" + exchange.getId()));
|
| | | return detail;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 红包提现拒绝
|
| | | * 红包提现拒绝
|
| | | *
|
| | | * @param extract
|
| | | * @return
|
| | |
| | | public static RedPackDetail createExchangeReject(RedPackExchange exchange) throws RedPackDetailException {
|
| | | if (exchange == null)
|
| | | throw new RedPackDetailException(1, "提现记录不能为空");
|
| | | |
| | |
|
| | | // 红包明细- 退回红包
|
| | | RedPackDetail detail = new RedPackDetail();
|
| | | detail.setDisplay(false);
|
| | |
| | | detail.setCreateTime(new Date());
|
| | | return detail;
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 赠送好友明细
|
| | | * |
| | | * @param giveRecord
|
| | | * @return
|
| | | * @throws RedPackDetailException
|
| | |
| | | detail.setCreateTime(new Date());
|
| | | return detail;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 赠送成功
|
| | | * |
| | | * @param id
|
| | | * @param giveRecord
|
| | | * @return
|
| | | * @throws RedPackDetailException
|
| | | */
|
| | | public static RedPackDetail createGiveOthersSucceed(Long id, RedPackGiveRecord giveRecord) throws RedPackDetailException {
|
| | | public static RedPackDetail createGiveOthersSucceed(Long id, RedPackGiveRecord giveRecord)
|
| | | throws RedPackDetailException {
|
| | | if (giveRecord == null)
|
| | | throw new RedPackDetailException(1, "赠送记录不能为空");
|
| | | RedPackDetail detail = new RedPackDetail();
|
| | |
| | | detail.setDisplay(true);
|
| | | detail.setType(RedPackDetailTypeEnum.giveOthersSucceed);
|
| | | detail.setTitle(RedPackDetailTypeEnum.giveOthersSucceed.getDesc());
|
| | | detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.giveOthersSucceed.name() + ":" + giveRecord.getId()));
|
| | | detail.setIdentifyCode(
|
| | | StringUtil.Md5(RedPackDetailTypeEnum.giveOthersSucceed.name() + ":" + giveRecord.getId()));
|
| | | detail.setCreateTime(new Date());
|
| | | return detail;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 赠送失败
|
| | | * |
| | | * @param giveRecord
|
| | | * @return
|
| | | * @throws RedPackDetailException
|
| | |
| | | detail.setCreateTime(new Date());
|
| | | return detail;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 赠送失败
|
| | | * |
| | | * @param giveRecord
|
| | | * @return
|
| | | * @throws RedPackDetailException
|
| | |
| | | detail.setMoney(giveRecord.getAmount());
|
| | | detail.setType(RedPackDetailTypeEnum.giveOthersReceive);
|
| | | detail.setTitle(RedPackDetailTypeEnum.giveOthersReceive.getDesc());
|
| | | detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.giveOthersReceive.name() + ":" + giveRecord.getId()));
|
| | | detail.setIdentifyCode(
|
| | | StringUtil.Md5(RedPackDetailTypeEnum.giveOthersReceive.name() + ":" + giveRecord.getId()));
|
| | | detail.setCreateTime(new Date());
|
| | | return detail;
|
| | | }
|
| | |
|
| | | /**
|
| | | * |
| | | * @param giveRecord
|
| | | * @return
|
| | | * @throws RedPackDetailException
|
| | | */
|
| | | public static RedPackDetail createUseByShopOrder(Long orderId, Long uid, String title, String setName,
|
| | | BigDecimal money) throws RedPackDetailException {
|
| | | if (orderId == null)
|
| | | throw new RedPackDetailException(1, "订单ID不能为空");
|
| | | if (uid == null)
|
| | | throw new RedPackDetailException(1, "用户ID不能为空");
|
| | | RedPackDetail detail = new RedPackDetail();
|
| | | detail.setDisplay(false);
|
| | | detail.setUid(uid);
|
| | | detail.setMoney(money);
|
| | | detail.setType(RedPackDetailTypeEnum.useByShopOrder);
|
| | | detail.setTitle(title);
|
| | | detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.useByShopOrder.name() + "-" + orderId));
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setDescInfo(setName);
|
| | | return detail;
|
| | | }
|
| | |
|
| | |
| | | return detail;
|
| | | }
|
| | |
|
| | | |
| | | public static RedPackDetail createShopOrderDrawBack(Long orderId, Long uid, String title, String setName,
|
| | | BigDecimal money) throws RedPackDetailException {
|
| | | if (orderId == null)
|
| | | throw new RedPackDetailException(1, "订单ID不能为空");
|
| | | if (uid == null)
|
| | | throw new RedPackDetailException(1, "用户ID不能为空");
|
| | | RedPackDetail detail = new RedPackDetail();
|
| | | detail.setDisplay(false);
|
| | | detail.setUid(uid);
|
| | | detail.setMoney(money);
|
| | | detail.setType(RedPackDetailTypeEnum.shopOrderDrawBack);
|
| | | detail.setTitle(title);
|
| | | detail.setIdentifyCode(StringUtil.Md5(RedPackDetailTypeEnum.shopOrderDrawBack.name() + "-" + orderId));
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setDescInfo(setName);
|
| | | return detail;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.util.mybatishandler.shop;
|
| | |
|
| | | import java.sql.CallableStatement;
|
| | | import java.sql.PreparedStatement;
|
| | | import java.sql.ResultSet;
|
| | | import java.sql.SQLException;
|
| | |
|
| | | import org.apache.ibatis.type.BaseTypeHandler;
|
| | | import org.apache.ibatis.type.JdbcType;
|
| | |
|
| | | import com.yeshi.fanli.entity.shop.ChargeTypeEnum;
|
| | |
|
| | | public class ChargeTypeEnumHandler extends BaseTypeHandler<ChargeTypeEnum> {
|
| | |
|
| | | @Override
|
| | | public ChargeTypeEnum getNullableResult(ResultSet arg0, String arg1) throws SQLException {
|
| | | String key = arg0.getString(arg1);
|
| | | if (arg0.wasNull()) {
|
| | | return null;
|
| | | } else {
|
| | | return ChargeTypeEnum.valueOf(key);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public ChargeTypeEnum getNullableResult(ResultSet arg0, int arg1) throws SQLException {
|
| | | String key = arg0.getString(arg1);
|
| | | if (arg0.wasNull()) {
|
| | | return null;
|
| | | } else {
|
| | | // 根据数据库中的key值,定位SexEnum子类
|
| | | return ChargeTypeEnum.valueOf(key);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public ChargeTypeEnum getNullableResult(CallableStatement arg0, int arg1) throws SQLException {
|
| | | String key = arg0.getString(arg1);
|
| | | if (arg0.wasNull()) {
|
| | | return null;
|
| | | } else {
|
| | | // 根据数据库中的key值,定位SexEnum子类
|
| | | return ChargeTypeEnum.valueOf(key);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void setNonNullParameter(PreparedStatement arg0, int arg1, ChargeTypeEnum arg2, JdbcType arg3)
|
| | | throws SQLException {
|
| | | arg0.setString(arg1, arg2.name());
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.util.rocketmq;
|
| | |
|
| | | public enum MQTopicName {
|
| | | TOPIC_ORDER("订单"), TOPIC_FANLI("返利到账"), TOPIC_SYSTEM_COUPON_USE("券使用");
|
| | | TOPIC_ORDER("订单"), TOPIC_USER("用户");
|
| | | private final String desc;
|
| | |
|
| | | private MQTopicName(String desc) {
|
| | |
| | | import com.aliyun.openservices.ons.api.Message;
|
| | | import com.aliyun.openservices.ons.api.MessageListener;
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.order.OrderMoneyRecievedMQMsgDTO;
|
| | | import com.yeshi.fanli.dto.mq.BaseMQMsgBody;
|
| | | import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMoneyRecievedMQMsg;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | @Component
|
| | | public class SystemCouponMessageListener implements MessageListener {
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserSystemCouponService userSystemCouponService;
|
| | | |
| | |
|
| | | @Override
|
| | | public Action consume(Message message, ConsumeContext context) {
|
| | | LogHelper.mqInfo("consumer-SystemCouponMessageListener", message.getTopic(), message.getTag(),
|
| | | new String(message.getBody()));
|
| | | if (MQTopicName.TOPIC_FANLI.name().equalsIgnoreCase(message.getTopic())) {
|
| | | OrderMoneyRecievedMQMsgDTO orderMoneyRecievedMQMsgDTO = new Gson().fromJson(new String(message.getBody()),
|
| | | OrderMoneyRecievedMQMsgDTO.class);
|
| | | if (orderMoneyRecievedMQMsgDTO != null) {
|
| | | if (orderMoneyRecievedMQMsgDTO.getOrderFirst() != null
|
| | | && orderMoneyRecievedMQMsgDTO.getOrderFirst() == true) {
|
| | | // 首次到账返利
|
| | | // TODO 业务代码添加
|
| | | |
| | | // 激活免单券
|
| | | userSystemCouponService.triggerFreeCouponActivate(orderMoneyRecievedMQMsgDTO.getUid());
|
| | | |
| | | // 业务代码执行成功后返回
|
| | | return Action.CommitMessage;
|
| | | String tag = message.getTag();
|
| | | BaseMQMsgBody baseBody = new Gson().fromJson(new String(message.getBody()), BaseMQMsgBody.class);
|
| | | if (baseBody.isTest() != Constant.IS_TEST)
|
| | | return Action.ReconsumeLater;
|
| | |
|
| | | if (MQTopicName.TOPIC_ORDER.name().equalsIgnoreCase(message.getTopic())) {
|
| | | if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderFanLiActual.name()))// 实时到账
|
| | | {
|
| | | OrderMoneyRecievedMQMsg orderMoneyRecievedMQMsgDTO = new Gson().fromJson(new String(message.getBody()),
|
| | | OrderMoneyRecievedMQMsg.class);
|
| | | if (orderMoneyRecievedMQMsgDTO != null) {
|
| | | if (orderMoneyRecievedMQMsgDTO.getOrderFirst() != null
|
| | | && orderMoneyRecievedMQMsgDTO.getOrderFirst() == true) {
|
| | | // 首次到账返利
|
| | | // TODO 业务代码添加
|
| | |
|
| | | // 激活免单券
|
| | | userSystemCouponService.triggerFreeCouponActivate(orderMoneyRecievedMQMsgDTO.getUid());
|
| | |
|
| | | // 业务代码执行成功后返回
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.util.rocketmq.consumer.order;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.aliyun.openservices.ons.api.Action;
|
| | | import com.aliyun.openservices.ons.api.ConsumeContext;
|
| | | import com.aliyun.openservices.ons.api.Message;
|
| | | import com.aliyun.openservices.ons.api.MessageListener;
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.mq.BaseMQMsgBody;
|
| | | import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.order.body.BanLiShopOrderMQMsg;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.shop.BanLiShopOrderService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | /**
|
| | | * 邀请订单补贴消息消费
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Component
|
| | | public class BanLiShopOrderMessageListener implements MessageListener {
|
| | |
|
| | | @Resource
|
| | | private BanLiShopOrderService banLiShopOrderService;
|
| | |
|
| | | public BanLiShopOrderMessageListener() {
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Action consume(Message message, ConsumeContext context) {
|
| | | BaseMQMsgBody baseBody = new Gson().fromJson(new String(message.getBody()), BaseMQMsgBody.class);
|
| | | if (baseBody.isTest() != Constant.IS_TEST)
|
| | | return Action.ReconsumeLater;
|
| | | LogHelper.mqInfo("consumer:BanLiShopOrderMessageListener", message.getTopic(), message.getTag(),
|
| | | new String(message.getBody()));
|
| | | String tag = message.getTag();
|
| | |
|
| | | if (MQTopicName.TOPIC_ORDER.name().equalsIgnoreCase(message.getTopic())) {
|
| | | if (OrderTopicTagEnum.banLiShopOrderDelay.name().equalsIgnoreCase(tag)) {
|
| | | BanLiShopOrderMQMsg banLiShopOrderMQMsg = new Gson().fromJson(new String(message.getBody()),
|
| | | BanLiShopOrderMQMsg.class);
|
| | | if (banLiShopOrderMQMsg != null)
|
| | | // 使订单失效
|
| | | banLiShopOrderService.invalidOrderByOrderId(banLiShopOrderMQMsg.getOrderId(), "订单失效-长期未付款");
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.aliyun.openservices.ons.api.Producer;
|
| | | import com.aliyun.openservices.ons.api.SendResult;
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.order.OrderMQMsgDTO;
|
| | | import com.yeshi.fanli.dto.order.OrderMoneyRecievedMQMsgDTO;
|
| | | import com.yeshi.fanli.dto.user.coupon.UserSystemCouponUseMQMsgDTO;
|
| | | import com.yeshi.fanli.dto.mq.BaseMQMsgBody;
|
| | | import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMoneyRecievedMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserSystemCouponUseMQMsg;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord;
|
| | | import com.yeshi.fanli.entity.mq.MQUnSendInfo;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon;
|
| | |
| | | @Override
|
| | | public Action consume(Message message, ConsumeContext context) {
|
| | |
|
| | | // if (!Constant.IS_TASK) {// 非任务服务器不能消费消息
|
| | | // return Action.ReconsumeLater;
|
| | | // }
|
| | | BaseMQMsgBody baseBody = new Gson().fromJson(new String(message.getBody()), BaseMQMsgBody.class);
|
| | | if (baseBody.isTest() != Constant.IS_TEST)
|
| | | return Action.ReconsumeLater;
|
| | | LogHelper.mqInfo("consumer:InviteOrderSubsidyMessageListener", message.getTopic(), message.getTag(),
|
| | | new String(message.getBody()));
|
| | | String tag = message.getTag();
|
| | |
|
| | | if (MQTopicName.TOPIC_ORDER.name().equalsIgnoreCase(message.getTopic())) {
|
| | | // 查询上级红包
|
| | | OrderMQMsgDTO dto = new Gson().fromJson(new String(message.getBody()), OrderMQMsgDTO.class);
|
| | | if (dto != null) {
|
| | | try {
|
| | | inviteOrderSubsidyService.addOrUpdateByOrder(dto.getOrderId(), dto.getType());
|
| | | } catch (InviteOrderSubsidyException e) {
|
| | | return Action.ReconsumeLater;
|
| | | }
|
| | | }
|
| | | } else if (MQTopicName.TOPIC_FANLI.name().equalsIgnoreCase(message.getTopic())) {
|
| | | if (message.getTag().equalsIgnoreCase("actual")) {
|
| | | OrderMoneyRecievedMQMsgDTO dto = new Gson().fromJson(new String(message.getBody()),
|
| | | OrderMoneyRecievedMQMsgDTO.class);
|
| | | if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderStatistic.name())
|
| | | || tag.equalsIgnoreCase(OrderTopicTagEnum.orderUpdate.name())) {
|
| | | // 查询上级红包
|
| | | OrderMQMsg dto = new Gson().fromJson(new String(message.getBody()), OrderMQMsg.class);
|
| | | if (dto != null) {
|
| | | if (dto.getType() == OrderMoneyRecievedMQMsgDTO.TYPE_ZIGOU) {// 自购到账
|
| | | try {
|
| | | inviteOrderSubsidyService.addOrUpdateByOrder(dto.getOrderId(), dto.getType());
|
| | | } catch (InviteOrderSubsidyException e) {
|
| | | return Action.ReconsumeLater;
|
| | | }
|
| | | }
|
| | | } else if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderFanLiActual.name())) {
|
| | | OrderMoneyRecievedMQMsg dto = new Gson().fromJson(new String(message.getBody()),
|
| | | OrderMoneyRecievedMQMsg.class);
|
| | | if (dto != null) {
|
| | | if (dto.getType() == OrderMoneyRecievedMQMsg.TYPE_ZIGOU) {// 自购到账
|
| | | // 判断订单号是否在补贴中
|
| | | long count = inviteOrderSubsidyService.countByOrderIdAndSourceType(dto.getOrderId(),
|
| | | dto.getSourceType());
|
| | | if (count > 0) {// 延时消息发送
|
| | | sendOrderSubsidyUpdateLater(dto, 5);
|
| | | }
|
| | | } else if (dto.getType() == OrderMoneyRecievedMQMsgDTO.TYPE_INVITE) {// 邀请到账
|
| | | } else if (dto.getType() == OrderMoneyRecievedMQMsg.TYPE_INVITE) {// 邀请到账
|
| | | // 补贴到账
|
| | | try {
|
| | | orderMoneySettleService.inviteSubsidySettle(dto.getUid(), message.getKey());
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | } else if (message.getTag().equalsIgnoreCase("delay")) {
|
| | | OrderMoneyRecievedMQMsgDTO dto = new Gson().fromJson(new String(message.getBody()),
|
| | | OrderMoneyRecievedMQMsgDTO.class);
|
| | | } else if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderFanLiDelay.name())) {
|
| | | OrderMoneyRecievedMQMsg dto = new Gson().fromJson(new String(message.getBody()),
|
| | | OrderMoneyRecievedMQMsg.class);
|
| | | if (dto != null) {
|
| | | if (dto.getType() == OrderMoneyRecievedMQMsgDTO.TYPE_ZIGOU) {// 延时时间已到
|
| | | if (dto.getType() == OrderMoneyRecievedMQMsg.TYPE_ZIGOU) {// 延时时间已到
|
| | | // 判断订单号是否在补贴中
|
| | | long count = inviteOrderSubsidyService.countByOrderIdAndSourceType(dto.getOrderId(),
|
| | | dto.getSourceType());
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | } else if (MQTopicName.TOPIC_SYSTEM_COUPON_USE.name().equalsIgnoreCase(message.getTopic())) {// 奖励券使用成功
|
| | | UserSystemCouponUseMQMsgDTO dto = new Gson().fromJson(new String(message.getBody()),
|
| | | UserSystemCouponUseMQMsgDTO.class);
|
| | | if (dto != null) {
|
| | | long count = inviteOrderSubsidyService.countByOrderIdAndSourceType(dto.getOrderId(),
|
| | | dto.getSourceType());
|
| | | if (count > 0) {
|
| | | // 使相关订单失效
|
| | | inviteOrderSubsidyService.invalidByOrderIdAndSourceType(dto.getOrderId(), dto.getSourceType());
|
| | | } else if (tag.equalsIgnoreCase(UserTopicTagEnum.useSystemCoupon.name())) {
|
| | | UserSystemCouponUseMQMsg dto = new Gson().fromJson(new String(message.getBody()),
|
| | | UserSystemCouponUseMQMsg.class);
|
| | | if (dto != null && dto.getCouponType()
|
| | | .equalsIgnoreCase(SystemCoupon.CouponTypeEnum.rebatePercentCoupon.name())) {// 返利奖励券的使用
|
| | | long count = inviteOrderSubsidyService.countByOrderIdAndSourceType(dto.getOrderId(),
|
| | | dto.getSourceType());
|
| | | if (count > 0) {
|
| | | // 使相关订单失效
|
| | | inviteOrderSubsidyService.invalidByOrderIdAndSourceType(dto.getOrderId(), dto.getSourceType());
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | return Action.CommitMessage;
|
| | | }
|
| | | }
|
| | | return Action.CommitMessage;
|
| | |
| | | *
|
| | | * @param day
|
| | | */
|
| | | private boolean sendOrderSubsidyUpdateLater(OrderMoneyRecievedMQMsgDTO dto, int day) {
|
| | | private boolean sendOrderSubsidyUpdateLater(OrderMoneyRecievedMQMsg dto, int day) {
|
| | |
|
| | | Message msg = new Message(MQTopicName.TOPIC_FANLI.name(), "delay", new Gson().toJson(dto).getBytes());
|
| | | Message msg = new Message(MQTopicName.TOPIC_ORDER.name(), OrderTopicTagEnum.orderFanLiDelay.name(),
|
| | | new Gson().toJson(dto).getBytes());
|
| | | msg.setKey(dto.getSourceType() + "_" + dto.getOrderId());
|
| | | long delayTime = System.currentTimeMillis() + (Constant.IS_TEST ? 1000 * 30L : 1000 * 60 * 60 * 24L * day);
|
| | | msg.setStartDeliverTime(delayTime);
|
| | |
| | | import com.aliyun.openservices.ons.api.transaction.LocalTransactionChecker;
|
| | | import com.aliyun.openservices.ons.api.transaction.TransactionStatus;
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.order.OrderMoneyRecievedMQMsgDTO;
|
| | | import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMoneyRecievedMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | |
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.InviteOrderSubsidyService;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTagConstant;
|
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName;
|
| | |
|
| | | @Component
|
| | |
| | | @Override
|
| | | public TransactionStatus check(Message msg) {
|
| | |
|
| | | String tag = msg.getTag();
|
| | | if (msg.getTopic().equalsIgnoreCase(MQTopicName.TOPIC_ORDER.name())) {
|
| | | if (msg.getTag().startsWith(MQTagConstant.TAG_ORDER_STATISTIC_PREFIX)) {// 订单加入红包标识
|
| | |
|
| | | if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderStatistic.name())) {
|
| | | // TODO 加入成功标识
|
| | | return TransactionStatus.CommitTransaction;
|
| | | }
|
| | | } else if (msg.getTopic().equalsIgnoreCase(MQTopicName.TOPIC_FANLI.name())) {
|
| | | if (msg.getTag().equalsIgnoreCase("actual")) {// 查询key值是否在
|
| | | } else if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderFanLiActual.name())) {
|
| | | if (hongBaoV2SettleTempService.countByKey(msg.getKey()) > 0)
|
| | | return TransactionStatus.CommitTransaction;
|
| | | else
|
| | | return TransactionStatus.RollbackTransaction;
|
| | | } else if (msg.getTag().equalsIgnoreCase("delay")) {
|
| | | OrderMoneyRecievedMQMsgDTO dto = new Gson().fromJson(new String(msg.getBody()),
|
| | | OrderMoneyRecievedMQMsgDTO.class);
|
| | | } else if (tag.equalsIgnoreCase(OrderTopicTagEnum.orderFanLiDelay.name())) {
|
| | | OrderMoneyRecievedMQMsg dto = new Gson().fromJson(new String(msg.getBody()),
|
| | | OrderMoneyRecievedMQMsg.class);
|
| | | if (dto != null) {
|
| | | if (dto.getType() == OrderMoneyRecievedMQMsgDTO.TYPE_ZIGOU) {
|
| | | if (dto.getType() == OrderMoneyRecievedMQMsg.TYPE_ZIGOU) {
|
| | | // TODO 尚未处理一个订单部分到账的状况
|
| | | // 返利是否到账
|
| | | List<CommonOrder> orderList = commonOrderService.listBySourceTypeAndOrderId(dto.getSourceType(),
|
| | |
| | | return TransactionStatus.RollbackTransaction;
|
| | | }
|
| | | }
|
| | |
|
| | | // 其他未知条件暂时处理为回滚
|
| | | return TransactionStatus.RollbackTransaction;
|
| | | }
|
| | | } else if (msg.getTopic().equalsIgnoreCase(MQTopicName.TOPIC_SYSTEM_COUPON_USE.name())) {
|
| | | return mqLocalUserCouponUsedTransactionChecker.check(msg);
|
| | |
|
| | | } else if (msg.getTopic().equalsIgnoreCase(MQTopicName.TOPIC_USER.name())) {
|
| | | if (tag.equalsIgnoreCase(UserTopicTagEnum.useSystemCoupon.name()))// 系统券使用
|
| | | return mqLocalUserCouponUsedTransactionChecker.check(msg);
|
| | | }
|
| | |
|
| | | return TransactionStatus.Unknow;
|
| | |
| | | import com.aliyun.openservices.ons.api.Message;
|
| | | import com.aliyun.openservices.ons.api.transaction.TransactionStatus;
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.user.coupon.UserSystemCouponUseMQMsgDTO;
|
| | | import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
|
| | | import com.yeshi.fanli.dto.mq.user.body.UserSystemCouponUseMQMsg;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService;
|
| | |
| | | }
|
| | |
|
| | | public TransactionStatus check(Message msg) {
|
| | | if (msg.getTopic().equalsIgnoreCase(MQTopicName.TOPIC_SYSTEM_COUPON_USE.name())) {
|
| | | if (msg.getTag().equalsIgnoreCase(SystemCoupon.CouponTypeEnum.rebatePercentCoupon.name())) {// 返利奖励券
|
| | | if (msg.getTopic().equalsIgnoreCase(MQTopicName.TOPIC_USER.name())) {
|
| | | if (msg.getTag().equalsIgnoreCase(UserTopicTagEnum.useSystemCoupon.name())) {// 返利奖励券
|
| | | // 查询是否使用成功
|
| | | UserSystemCouponUseMQMsgDTO dto = new Gson().fromJson(new String(msg.getBody()),
|
| | | UserSystemCouponUseMQMsgDTO.class);
|
| | | UserSystemCouponRecord record = userSystemCouponRecordService
|
| | | .getNearByUserCouponId(dto.getUserSystemCouponId());
|
| | | if (record != null) {
|
| | | if (record.getOrderNo().equalsIgnoreCase(dto.getOrderId())
|
| | | && dto.getSourceType().intValue() == record.getGoodSource()) {
|
| | | return TransactionStatus.CommitTransaction;
|
| | | UserSystemCouponUseMQMsg dto = new Gson().fromJson(new String(msg.getBody()),
|
| | | UserSystemCouponUseMQMsg.class);
|
| | |
|
| | | if (SystemCoupon.CouponTypeEnum.rebatePercentCoupon.name().equalsIgnoreCase(dto.getCouponType())) {
|
| | | UserSystemCouponRecord record = userSystemCouponRecordService
|
| | | .getNearByUserCouponId(dto.getUserSystemCouponId());
|
| | | if (record != null) {
|
| | | if (record.getOrderNo().equalsIgnoreCase(dto.getOrderId())
|
| | | && dto.getSourceType().intValue() == record.getGoodSource()) {
|
| | | return TransactionStatus.CommitTransaction;
|
| | | }
|
| | | }
|
| | | return TransactionStatus.RollbackTransaction;
|
| | | }
|
| | | return TransactionStatus.RollbackTransaction;
|
| | | }
|
| | | }
|
| | | return TransactionStatus.Unknow;
|
New file |
| | |
| | | package com.yeshi.fanli.util.shop;
|
| | |
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | public class BanLiShopOrderUtil {
|
| | |
|
| | | /**
|
| | | * 制造订单号
|
| | | * |
| | | * @param orderId
|
| | | * @return
|
| | | */
|
| | | public static String createOrderNo(Long orderId) {
|
| | | String orderNo = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyyMMdd");
|
| | | String orderIdStr = orderId + "";
|
| | | int length = 8 - orderIdStr.length();
|
| | | for (int i = 0; i < length; i++) {
|
| | | orderIdStr = "0" + orderIdStr;
|
| | | }
|
| | | orderNo += orderIdStr;
|
| | | return orderNo;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 根据商城订单号获取微信支付的商户订单号
|
| | | * |
| | | * @param orderNo
|
| | | * @return
|
| | | */
|
| | | public static String getWXPayOrderNo(String orderNo) {
|
| | |
|
| | | return "banlishop-" + orderNo;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 根据微信支付商户订单号获取商城订单
|
| | | * |
| | | * @param wxPayOrderNo
|
| | | * @return
|
| | | */
|
| | | public static String getOrderNoFromWXPayOrderNo(String wxPayOrderNo) {
|
| | | if (wxPayOrderNo == null)
|
| | | return null;
|
| | | wxPayOrderNo = wxPayOrderNo.trim();
|
| | | if (wxPayOrderNo.startsWith("banlishop-"))
|
| | | return wxPayOrderNo.replace("banlishop-", "").trim();
|
| | | else
|
| | | return null;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | <beans xmlns="http://www.springframework.org/schema/beans"
|
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
| | | xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
| | | <bean id="inviteOrderSubsidyMsgListener" class="com.yeshi.fanli.util.rocketmq.consumer.order.InviteOrderSubsidyMessageListener"></bean> <!--Listener 配置 -->
|
| | | <bean id="inviteOrderSubsidyMsgListener"
|
| | | class="com.yeshi.fanli.util.rocketmq.consumer.order.InviteOrderSubsidyMessageListener"></bean> <!--Listener 配置 -->
|
| | | <!-- Group ID 订阅同一个 Topic,可以创建多个 ConsumerBean -->
|
| | | <bean id="orderTransactionConsumer" class="com.aliyun.openservices.ons.api.bean.ConsumerBean"
|
| | | init-method="start" destroy-method="shutdown">
|
| | |
| | | </property>
|
| | | <property name="subscriptionTable">
|
| | | <map>
|
| | | <!-- 订单补贴订阅 -->
|
| | | <!-- 订单补贴订阅 -->
|
| | | <entry value-ref="inviteOrderSubsidyMsgListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_ORDER" />
|
| | | <property name="expression" value="*" /><!--expression 即 |
| | | Tag,可以设置成具体的 Tag,如 taga||tagb||tagc,也可设置成 *。 * 仅代表订阅所有 Tag,不支持通配 -->
|
| | | <property name="expression"
|
| | | value="orderStatistic||orderUpdate||orderFanLiActual||orderFanLiDelay" /><!--expression |
| | | 即 Tag,可以设置成具体的 Tag,如 taga||tagb||tagc,也可设置成 *。 * 仅代表订阅所有 Tag,不支持通配 -->
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | | |
| | |
|
| | |
|
| | | <entry value-ref="inviteOrderSubsidyMsgListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_FANLI" />
|
| | | <property name="expression" value="*" /><!--expression 即 |
| | | Tag,可以设置成具体的 Tag,如 taga||tagb||tagc,也可设置成 *。 * 仅代表订阅所有 Tag,不支持通配 -->
|
| | | <property name="topic" value="TOPIC_USER" />
|
| | | <property name="expression" value="useSystemCoupon" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | | |
| | | |
| | | <entry value-ref="inviteOrderSubsidyMsgListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_SYSTEM_COUPON_USE" />
|
| | | <property name="expression" value="rebatePercentCoupon" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | | |
| | |
|
| | | </map>
|
| | | </property>
|
| | | </bean>
|
| | |
|
| | | <!-- 板栗商城订单消息订阅 -->
|
| | | <bean id="banLiShopOrderMessageListener"
|
| | | class="com.yeshi.fanli.util.rocketmq.consumer.order.BanLiShopOrderMessageListener"></bean> <!--Listener 配置 -->
|
| | | <!-- Group ID 订阅同一个 Topic,可以创建多个 ConsumerBean -->
|
| | | <bean id="orderTransactionConsumer" class="com.aliyun.openservices.ons.api.bean.ConsumerBean"
|
| | | init-method="start" destroy-method="shutdown">
|
| | | <property name="properties"> <!--消费者配置信息 -->
|
| | | <props>
|
| | | <prop key="AccessKey">LTAI4FwmTxVCuzTaoZtDiV8z</prop>
|
| | | <prop key="SecretKey">ixWg90QbYFKP6ae5xpAo2P1qwIyll5</prop>
|
| | | <prop key="GROUP_ID">GID_BANLI_SHOP_ORDER</prop>
|
| | | <prop key="NAMESRV_ADDR">http://MQ_INST_1205444665315884_BbaMbxF4.mq-internet-access.mq-internet.aliyuncs.com:80
|
| | | </prop>
|
| | | <!--将消费者线程数固定为 50 个 <prop key="ConsumeThreadNums">50</prop> -->
|
| | | </props>
|
| | | </property>
|
| | | <property name="subscriptionTable">
|
| | | <map>
|
| | | <!-- 订阅下单延时消息 -->
|
| | | <entry value-ref="inviteOrderSubsidyMsgListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_ORDER" />
|
| | | <property name="expression" value="banLiShopOrderDelay" /><!--expression |
| | | 即 Tag,可以设置成具体的 Tag,如 taga||tagb||tagc,也可设置成 *。 * 仅代表订阅所有 Tag,不支持通配 -->
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | | </map>
|
| | | </property>
|
| | | </bean>
|
| | |
|
| | |
|
| | | </beans> |
| | |
| | | <entry value-ref="systemCouponMessageListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_FANLI" />
|
| | | <property name="expression" value="actual" />
|
| | | <property name="topic" value="TOPIC_ORDER" />
|
| | | <property name="expression" value="orderFanLiActual" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
| | | xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
| | | <!-- 事务消息生产 -->
|
| | | <bean id="localTransactionChecker" class="com.yeshi.fanli.util.rocketmq.order.MQLocalTransactionChecker"></bean>
|
| | | <bean id="localTransactionChecker"
|
| | | class="com.yeshi.fanli.util.rocketmq.order.MQLocalTransactionChecker"></bean>
|
| | | <bean id="orderTransactionProducer"
|
| | | class="com.aliyun.openservices.ons.api.bean.TransactionProducerBean"
|
| | | init-method="start" destroy-method="shutdown">
|
| | |
| | | </property>
|
| | | <property name="localTransactionChecker" ref="localTransactionChecker"></property>
|
| | | </bean>
|
| | | |
| | | |
| | | |
| | |
|
| | | </beans> |
| | |
| | | </array>
|
| | | </property>
|
| | | </bean>
|
| | | |
| | | <!-- |
| | | <import resource="classpath:/rocket/consumer.xml"/>
|
| | | <import resource="classpath:/rocket/system-coupon-consumer.xml"/>
|
| | | <import resource="classpath:/rocket/producer.xml"/>
|
| | | <import resource="classpath:/rocket/transactionProducer.xml"/>
|
| | | -->
|
| | |
|
| | |
|
| | | <!-- <import resource="classpath:/rocket/consumer.xml"/> <import resource="classpath:/rocket/system-coupon-consumer.xml"/> -->
|
| | | <import resource="classpath:/rocket/producer.xml" />
|
| | | <import resource="classpath:/rocket/transactionProducer.xml" />
|
| | |
|
| | |
|
| | | <!--异步定义推荐方式 <task:executor id="executor" pool-size="15" /> <task:scheduler
|
| | | id="scheduler" pool-size="30" /> <task:annotation-driven executor="executor"
|
| | |
| | | connect-timeout="${mongo.connectTimeout}" max-wait-time="${mongo.maxWaitTime}"
|
| | | auto-connect-retry="${mongo.autoConnectRetry}" socket-keep-alive="${mongo.socketKeepAlive}"
|
| | | socket-timeout="${mongo.socketTimeout}" slave-ok="${mongo.slaveOk}"
|
| | | write-number="1" write-timeout="0" write-fsync="true" />
|
| | | write-number="1" write-timeout="0" write-fsync="true" />
|
| | | </mongo:mongo>
|
| | |
|
| | |
|
| | |
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_ORDER" />
|
| | | <property name="expression" value="*" /><!--expression 即 |
| | | Tag,可以设置成具体的 Tag,如 taga||tagb||tagc,也可设置成 *。 * 仅代表订阅所有 Tag,不支持通配 -->
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | | |
| | | <entry value-ref="inviteOrderSubsidyMsgListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_FANLI" />
|
| | | <property name="expression" value="*" /><!--expression 即 |
| | | <property name="expression" value="orderStatistic||orderUpdate||orderFanLiActual||orderFanLiDelay" /><!--expression 即 |
| | | Tag,可以设置成具体的 Tag,如 taga||tagb||tagc,也可设置成 *。 * 仅代表订阅所有 Tag,不支持通配 -->
|
| | | </bean>
|
| | | </key>
|
| | |
| | | <entry value-ref="inviteOrderSubsidyMsgListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_SYSTEM_COUPON_USE" />
|
| | | <property name="expression" value="rebatePercentCoupon" />
|
| | | <property name="topic" value="TOPIC_USER" />
|
| | | <property name="expression" value="useSystemCoupon" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | |
| | | <entry value-ref="systemCouponMessageListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_FANLI" />
|
| | | <property name="expression" value="actual" />
|
| | | <property name="topic" value="TOPIC_ORDER" />
|
| | | <property name="expression" value="orderFanLiActual" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
| | | xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
| | | <!-- 事务消息生产 -->
|
| | | <bean id="localTransactionChecker" class="com.yeshi.fanli.util.rocketmq.order.MQLocalTransactionChecker"></bean>
|
| | | <bean id="localTransactionChecker"
|
| | | class="com.yeshi.fanli.util.rocketmq.order.MQLocalTransactionChecker"></bean>
|
| | | <bean id="orderTransactionProducer"
|
| | | class="com.aliyun.openservices.ons.api.bean.TransactionProducerBean"
|
| | | init-method="start" destroy-method="shutdown">
|
| | |
| | | </property>
|
| | | <property name="localTransactionChecker" ref="localTransactionChecker"></property>
|
| | | </bean>
|
| | | |
| | | |
| | | |
| | |
|
| | | </beans> |
| | |
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_ORDER" />
|
| | | <property name="expression" value="*" /><!--expression 即 |
| | | Tag,可以设置成具体的 Tag,如 taga||tagb||tagc,也可设置成 *。 * 仅代表订阅所有 Tag,不支持通配 -->
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | | |
| | | <entry value-ref="inviteOrderSubsidyMsgListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_FANLI" />
|
| | | <property name="expression" value="*" /><!--expression 即 |
| | | <property name="expression" value="orderStatistic||orderUpdate||orderFanLiActual||orderFanLiDelay" /><!--expression 即 |
| | | Tag,可以设置成具体的 Tag,如 taga||tagb||tagc,也可设置成 *。 * 仅代表订阅所有 Tag,不支持通配 -->
|
| | | </bean>
|
| | | </key>
|
| | |
| | | <entry value-ref="inviteOrderSubsidyMsgListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_SYSTEM_COUPON_USE" />
|
| | | <property name="expression" value="rebatePercentCoupon" />
|
| | | <property name="topic" value="TOPIC_USER" />
|
| | | <property name="expression" value="useSystemCoupon" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | |
| | | <entry value-ref="systemCouponMessageListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_FANLI" />
|
| | | <property name="expression" value="actual" />
|
| | | <property name="topic" value="TOPIC_ORDER" />
|
| | | <property name="expression" value="orderFanLiActual" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
| | | xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
| | | <!-- 事务消息生产 -->
|
| | | <bean id="localTransactionChecker" class="com.yeshi.fanli.util.rocketmq.order.MQLocalTransactionChecker"></bean>
|
| | | <bean id="localTransactionChecker"
|
| | | class="com.yeshi.fanli.util.rocketmq.order.MQLocalTransactionChecker"></bean>
|
| | | <bean id="orderTransactionProducer"
|
| | | class="com.aliyun.openservices.ons.api.bean.TransactionProducerBean"
|
| | | init-method="start" destroy-method="shutdown">
|
| | |
| | | </property>
|
| | | <property name="localTransactionChecker" ref="localTransactionChecker"></property>
|
| | | </bean>
|
| | | |
| | | |
| | | |
| | |
|
| | | </beans> |
| | |
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_ORDER" />
|
| | | <property name="expression" value="*" /><!--expression 即 |
| | | Tag,可以设置成具体的 Tag,如 taga||tagb||tagc,也可设置成 *。 * 仅代表订阅所有 Tag,不支持通配 -->
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | | |
| | | <entry value-ref="inviteOrderSubsidyMsgListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_FANLI" />
|
| | | <property name="expression" value="*" /><!--expression 即 |
| | | <property name="expression" value="orderStatistic||orderUpdate||orderFanLiActual||orderFanLiDelay" /><!--expression 即 |
| | | Tag,可以设置成具体的 Tag,如 taga||tagb||tagc,也可设置成 *。 * 仅代表订阅所有 Tag,不支持通配 -->
|
| | | </bean>
|
| | | </key>
|
| | |
| | | <entry value-ref="inviteOrderSubsidyMsgListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_SYSTEM_COUPON_USE" />
|
| | | <property name="expression" value="rebatePercentCoupon" />
|
| | | <property name="topic" value="TOPIC_USER" />
|
| | | <property name="expression" value="useSystemCoupon" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | |
| | | <entry value-ref="systemCouponMessageListener">
|
| | | <key>
|
| | | <bean class="com.aliyun.openservices.ons.api.bean.Subscription">
|
| | | <property name="topic" value="TOPIC_FANLI" />
|
| | | <property name="expression" value="actual" />
|
| | | <property name="topic" value="TOPIC_ORDER" />
|
| | | <property name="expression" value="orderFanLiActual" />
|
| | | </bean>
|
| | | </key>
|
| | | </entry>
|
| | |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
| | | xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
| | | <!-- 事务消息生产 -->
|
| | | <bean id="localTransactionChecker" class="com.yeshi.fanli.util.rocketmq.order.MQLocalTransactionChecker"></bean>
|
| | | <bean id="localTransactionChecker"
|
| | | class="com.yeshi.fanli.util.rocketmq.order.MQLocalTransactionChecker"></bean>
|
| | | <bean id="orderTransactionProducer"
|
| | | class="com.aliyun.openservices.ons.api.bean.TransactionProducerBean"
|
| | | init-method="start" destroy-method="shutdown">
|
| | |
| | | </property>
|
| | | <property name="localTransactionChecker" ref="localTransactionChecker"></property>
|
| | | </bean>
|
| | | |
| | | |
| | | |
| | |
|
| | | </beans> |
New file |
| | |
| | | package org.yeshi.utils.exception;
|
| | |
|
| | | public class WXOrderException extends Exception {
|
| | | private static final long serialVersionUID = 1L;
|
| | | private int code;
|
| | | private String msg;
|
| | |
|
| | | public int getCode() {
|
| | | return code;
|
| | | }
|
| | |
|
| | | public String getMsg() {
|
| | | return msg;
|
| | | }
|
| | |
|
| | | public WXOrderException(int code, String msg) {
|
| | | this.code = code;
|
| | | this.msg = msg;
|
| | | }
|
| | |
|
| | | public WXOrderException() {
|
| | | }
|
| | |
|
| | | @Override
|
| | | public String getMessage() {
|
| | | return this.msg;
|
| | | }
|
| | | }
|
| | |
| | | import org.yeshi.utils.entity.wx.RedPackParams;
|
| | | import org.yeshi.utils.entity.wx.WXAPPInfo;
|
| | | import org.yeshi.utils.entity.wx.WXPlaceOrderParams;
|
| | | import org.yeshi.utils.exception.WXOrderException;
|
| | | import org.yeshi.utils.exception.WXPlaceOrderParamsException;
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | public class WXPayUtil {
|
| | |
|
| | | /**
|
| | | * 付款到零钱
|
| | | * |
| | | * @param appId
|
| | | * @param openId
|
| | | * @param mchId
|
| | | * @param key
|
| | | * @param pwd
|
| | | * @param cert
|
| | | * @param orderNo
|
| | | * @param money
|
| | | * @param desc
|
| | | * @param ip
|
| | | * @return
|
| | | */
|
| | | public static String payToOpenId(String appId, String openId, String mchId, String key, String pwd,
|
| | | InputStream cert, String orderNo, BigDecimal money, String desc, String ip) {
|
| | | Map<String, String> map = new HashMap<>();
|
| | |
| | | if (StringUtil.isNullOrEmpty(params.getTradeType()))
|
| | | throw new WXPlaceOrderParamsException(8, "请传入tradeType");
|
| | |
|
| | | // if (StringUtil.isNullOrEmpty(params.getOpenId()))
|
| | | // throw new WXPlaceOrderParamsException(9, "请传入openId");
|
| | | // if (StringUtil.isNullOrEmpty(params.getOpenId()))
|
| | | // throw new WXPlaceOrderParamsException(9, "请传入openId");
|
| | |
|
| | | Map<String, String> map = new HashMap<String, String>();
|
| | | map.put("appid", params.getInfo().getAppId());
|
| | |
| | |
|
| | | return resultMap;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 订单退款
|
| | | * |
| | | * @param orderNo-订单号
|
| | | * @param orderMoney-订单总资金
|
| | | * @param refundMoney-退款金额
|
| | | * @param reason-退款原因
|
| | | * @param appInfo
|
| | | * @param pwd-证书密码
|
| | | * @param cert-证书
|
| | | */
|
| | | public static boolean refund(String orderNo, BigDecimal orderMoney, BigDecimal refundMoney, String reason,
|
| | | WXAPPInfo appInfo, String pwd, InputStream cert) throws WXOrderException {
|
| | | Map<String, String> map = new HashMap<String, String>();
|
| | | map.put("appid", appInfo.getAppId());
|
| | | map.put("mch_id", appInfo.getMchId());
|
| | | map.put("nonce_str", StringUtil.getRandomCode(32));
|
| | | map.put("out_trade_no", orderNo);
|
| | | map.put("out_refund_no", orderNo);// 商户退款单号
|
| | | map.put("total_fee", orderMoney.multiply(new BigDecimal(100)).intValue() + "");// 订单金额
|
| | | map.put("refund_fee", orderMoney.multiply(new BigDecimal(100)).intValue() + "");// 退款金额
|
| | | if (!StringUtil.isNullOrEmpty(reason))
|
| | | map.put("refund_desc", reason);
|
| | | map.put("sign", WXUtil.getSignMD5(map, appInfo.getMchKey()));
|
| | | try {
|
| | | String result = HttpUtil.httpsPost("https://api.mch.weixin.qq.com/secapi/pay/refund",
|
| | | WXUtil.loadWXMessage(map), pwd, cert);
|
| | | System.out.println("订单退款结果:" + result);
|
| | | Map<String, String> resultMap = WXUtil.parseXML(result);
|
| | | if ("SUCCESS".equalsIgnoreCase(resultMap.get("return_code"))
|
| | | && "SUCCESS".equalsIgnoreCase(resultMap.get("result_code")))
|
| | | return true;
|
| | | throw new WXOrderException(100, "微信支付接口出错:" + result);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 查询订单号是否支付成功
|
| | | * |
| | | * @param orderNo
|
| | | * @param app
|
| | | * @return
|
| | | * @throws WXOrderException
|
| | | */
|
| | | public static boolean isPaySuccess(String orderNo, WXAPPInfo app) throws WXOrderException {
|
| | | Map<String, String> map = new HashMap<String, String>();
|
| | | map.put("appid", app.getAppId());
|
| | | map.put("mch_id", app.getMchId());
|
| | | map.put("nonce_str", StringUtil.getRandomCode(32));
|
| | | map.put("out_trade_no", orderNo);
|
| | | map.put("sign", WXUtil.getSignMD5(map, app.getMchKey()));
|
| | | String result = HttpUtil.post("https://api.mch.weixin.qq.com/pay/orderquery", WXUtil.loadWXMessage(map));
|
| | | System.out.println("订单查询结果:" + result);
|
| | | Map<String, String> resultMap = WXUtil.parseXML(result);
|
| | | if ("SUCCESS".equalsIgnoreCase(resultMap.get("return_code"))
|
| | | && "SUCCESS".equalsIgnoreCase(resultMap.get("result_code"))) {
|
| | | if ("SUCCESS".equalsIgnoreCase(resultMap.get("trade_state")))// 支付成功
|
| | | return true;
|
| | | else
|
| | | return false;
|
| | | } else {
|
| | | throw new WXOrderException(100, "微信支付接口出错:" + result);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|