| | |
| | | List<MsgInviteDetail> detailList3 = msgInviteDetailService.listMsgInviteDetail(uid, page);
|
| | | count = msgInviteDetailService.countMsgInviteDetail(uid);
|
| | | if (detailList3 != null)
|
| | | for (MsgInviteDetail detail : detailList3)
|
| | | list.add(UserMsgVOFactory.create(detail));
|
| | | for (MsgInviteDetail detail : detailList3) {
|
| | | UserMsgVO vo = UserMsgVOFactory.create(detail);
|
| | | if (vo != null)
|
| | | list.add(vo);
|
| | | else
|
| | | count--;
|
| | | }
|
| | | break;
|
| | | }
|
| | |
|
| | |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | List<ShareGoodsActivityOrder> listByOrderIdAndUid(@Param("uid") Long uid, @Param("orderId") Long orderId); |
| | | List<ShareGoodsActivityOrder> listByOrderIdAndUid(@Param("uid") Long uid, @Param("orderId") String orderId); |
| | | |
| | | |
| | | /** |
| | |
| | | private Long id;
|
| | | @Column(name = "sgao_uid")
|
| | | private UserInfo user;
|
| | | @Column(name = "sgao_order_id")
|
| | | private Order order;// 订单
|
| | | @Column(name = "sgao_order_no")
|
| | | private String orderNo;// 订单号
|
| | | @Column(name = "sgao_order_source_type")
|
| | | private Integer orderSourceType;// 订单号
|
| | | @Column(name = "sgao_share_rate")
|
| | | private BigDecimal shareRate;// 分享比例
|
| | | @Column(name = "sgao_create_time")
|
| | |
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public String getOrderNo() {
|
| | | return orderNo;
|
| | | }
|
| | |
|
| | | public void setOrderNo(String orderNo) {
|
| | | this.orderNo = orderNo;
|
| | | }
|
| | |
|
| | | public Integer getOrderSourceType() {
|
| | | return orderSourceType;
|
| | | }
|
| | |
|
| | | public void setOrderSourceType(Integer orderSourceType) {
|
| | | this.orderSourceType = orderSourceType;
|
| | | }
|
| | |
|
| | | public UserInfo getUser() {
|
| | | return user;
|
| | | }
|
| | |
|
| | | public void setUser(UserInfo user) {
|
| | | this.user = user;
|
| | | }
|
| | |
|
| | | public Order getOrder() {
|
| | | return order;
|
| | | }
|
| | |
|
| | | public void setOrder(Order order) {
|
| | | this.order = order;
|
| | | }
|
| | |
|
| | | public BigDecimal getShareRate() {
|
| | |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="sgao_update_time" property="updateTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="sgao_order_no" property="orderNo" jdbcType="VARCHAR" /> |
| | | |
| | | <result column="sgao_order_source_type" property="orderSourceType" |
| | | jdbcType="INTEGER" /> |
| | | |
| | | <association property="user" column="sgao_uid" |
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | | <id property="id" column="sgao_uid" jdbcType="BIGINT" /> |
| | | </association> |
| | | <association property="order" column="sgao_order_id" |
| | | javaType="com.yeshi.fanli.entity.bus.user.Order"> |
| | | <id property="id" column="sgao_order_id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | </resultMap> |
| | | <sql id="Base_Column_List">sgao_id,sgao_uid,sgao_order_id,sgao_share_rate,sgao_create_time,sgao_update_time |
| | | <sql id="Base_Column_List">sgao_id,sgao_uid,sgao_order_no,sgao_share_rate,sgao_create_time,sgao_update_time,sgao_order_source_type |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_share_goods_activity_order where sgao_uid =#{uid} and |
| | | sgao_order_id=#{orderId} |
| | | sgao_order_no=#{orderId} |
| | | </select> |
| | | |
| | | |
| | |
| | | parameterType="com.yeshi.fanli.entity.order.ShareGoodsActivityOrder" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_share_goods_activity_order |
| | | (sgao_id,sgao_uid,sgao_order_id,sgao_share_rate,sgao_create_time,sgao_update_time) |
| | | (sgao_id,sgao_uid,sgao_order_no,sgao_share_rate,sgao_create_time,sgao_update_time,sgao_order_source_type) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{user.id,jdbcType=BIGINT},#{order.id,jdbcType=BIGINT},#{shareRate,jdbcType=DECIMAL},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | (#{id,jdbcType=BIGINT},#{user.id,jdbcType=BIGINT},#{orderNo,jdbcType=VARCHAR},#{shareRate,jdbcType=DECIMAL},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{orderSourceType,jdbcType=INTEGER}) |
| | | </insert> |
| | | <insert id="insertSelective" |
| | | parameterType="com.yeshi.fanli.entity.order.ShareGoodsActivityOrder" |
| | |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">sgao_id,</if> |
| | | <if test="user != null">sgao_uid,</if> |
| | | <if test="order != null">sgao_order_id,</if> |
| | | <if test="orderNo !=null">sgao_order_no,</if> |
| | | <if test="shareRate != null">sgao_share_rate,</if> |
| | | <if test="createTime != null">sgao_create_time,</if> |
| | | <if test="updateTime != null">sgao_update_time,</if> |
| | | <if test="orderSourceType != null">sgao_order_source_type,</if> |
| | | |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="user != null">#{user.id,jdbcType=BIGINT},</if> |
| | | <if test="order != null">#{order.id,jdbcType=BIGINT},</if> |
| | | <if test="orderNo !=null">#{orderNo,jdbcType=VARCHAR},</if> |
| | | <if test="shareRate != null">#{shareRate,jdbcType=DECIMAL},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="orderSourceType != null">#{orderSourceType,jdbcType=INTEGER}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" |
| | | parameterType="com.yeshi.fanli.entity.order.ShareGoodsActivityOrder">update yeshi_ec_share_goods_activity_order set sgao_uid |
| | | = #{user.id,jdbcType=BIGINT},sgao_order_id = |
| | | #{order.id,jdbcType=BIGINT},sgao_share_rate = |
| | | = #{user.id,jdbcType=BIGINT},sgao_order_no = |
| | | #{orderNo,jdbcType=VARCHAR},sgao_share_rate = |
| | | #{shareRate,jdbcType=DECIMAL},sgao_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},sgao_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} where sgao_id = |
| | | #{updateTime,jdbcType=TIMESTAMP},sgao_order_source_type |
| | | #{orderSourceType,jdbcType=INTEGER} |
| | | where sgao_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" |
| | |
| | | update yeshi_ec_share_goods_activity_order |
| | | <set> |
| | | <if test="user != null">sgao_uid=#{user.id,jdbcType=BIGINT},</if> |
| | | <if test="order != null">sgao_order_id=#{order.id,jdbcType=BIGINT},</if> |
| | | <if test="orderNo !=null">sgao_order_no=#{orderNo,jdbcType=VARCHAR},</if> |
| | | <if test="shareRate != null">sgao_share_rate=#{shareRate,jdbcType=DECIMAL},</if> |
| | | <if test="createTime != null">sgao_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">sgao_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="orderSourceType != null">sgao_order_source_type=#{orderSourceType,jdbcType=INTEGER},</if> |
| | | </set> |
| | | where sgao_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | |
| | |
|
| | | } else if (type == HongBaoV2.TYPE_SHARE_GOODS) {
|
| | | BigDecimal fanliRate = hongBaoManageService.getShareRate(commonOrder.getCreateTime().getTime());
|
| | | Order order = orderMapper.selectOrderByOrderId(commonOrder.getOrderNo());
|
| | | if (order != null) {
|
| | | List<ShareGoodsActivityOrder> list = shareGoodsActivityOrderService
|
| | | .listByOrderIdAndUid(commonOrder.getUserInfo().getId(), order.getId());
|
| | | if (list != null && list.size() > 0) {
|
| | | fanliRate = list.get(0).getShareRate();
|
| | | }
|
| | | List<ShareGoodsActivityOrder> list = shareGoodsActivityOrderService
|
| | | .listByOrderIdAndUid(commonOrder.getUserInfo().getId(), commonOrder.getOrderNo());
|
| | | if (list != null && list.size() > 0) {
|
| | | fanliRate = list.get(0).getShareRate();
|
| | | }
|
| | |
|
| | | HongBaoV2 hongBao = new HongBaoV2(hongBaoOrder.getHongBaoV2().getId());
|
| | |
| | | if (taoBaoOrderList != null && taoBaoOrderList.size() > 0
|
| | | && !StringUtil.isNullOrEmpty(taoBaoOrderList.get(0).getRelationId())) {
|
| | | if (shareGoodsActivityOrderService.listByUid(commonOrder.getUserInfo().getId()).size() < 1) {
|
| | | Order order = orderMapper.selectOrderByOrderId(commonOrder.getOrderNo());
|
| | | if (order != null) {
|
| | | shareRate = new BigDecimal(hongBaoManageService.get("share_activity_proportion"));
|
| | | shareRate = new BigDecimal(hongBaoManageService.get("share_activity_proportion"));
|
| | | try {
|
| | | shareGoodsActivityOrderService.addShareGoodsActivityOrder(
|
| | | commonOrder.getUserInfo().getId(), shareRate, commonOrder.getOrderNo());
|
| | | } catch (ShareGoodsActivityOrderException e) {
|
| | | try {
|
| | | shareGoodsActivityOrderService.addShareGoodsActivityOrder(
|
| | | commonOrder.getUserInfo().getId(), shareRate, order);
|
| | | } catch (ShareGoodsActivityOrderException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.order.ShareGoodsActivityOrderMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.order.ShareGoodsActivityOrder;
|
| | | import com.yeshi.fanli.exception.order.ShareGoodsActivityOrderException;
|
| | | import com.yeshi.fanli.service.inter.order.ShareGoodsActivityOrderService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | | public class ShareGoodsActivityOrderServiceImpl implements ShareGoodsActivityOrderService {
|
| | |
| | | private ShareGoodsActivityOrderMapper shareGoodsActivityOrderMapper;
|
| | |
|
| | | @Override
|
| | | public void addShareGoodsActivityOrder(Long uid, BigDecimal rate, Order order)
|
| | | public void addShareGoodsActivityOrder(Long uid, BigDecimal rate, String taoBaoOrderNo)
|
| | | throws ShareGoodsActivityOrderException {
|
| | | if (uid == null || rate == null || order == null || order.getId() == null)
|
| | | if (uid == null || rate == null || StringUtil.isNullOrEmpty(taoBaoOrderNo))
|
| | | throw new ShareGoodsActivityOrderException(1, "数据不完整");
|
| | |
|
| | | List<ShareGoodsActivityOrder> list = listByOrderIdAndUid(uid, order.getId());
|
| | | List<ShareGoodsActivityOrder> list = listByOrderIdAndUid(uid, taoBaoOrderNo);
|
| | | if (list != null && list.size() > 0)
|
| | | throw new ShareGoodsActivityOrderException(2, "订单号已存在");
|
| | |
|
| | | ShareGoodsActivityOrder shareOrder = new ShareGoodsActivityOrder();
|
| | | shareOrder.setCreateTime(new Date());
|
| | | shareOrder.setOrder(order);
|
| | | shareOrder.setOrderNo(taoBaoOrderNo);
|
| | | shareOrder.setOrderSourceType(Constant.SOURCE_TYPE_TAOBAO);
|
| | | shareOrder.setShareRate(rate);
|
| | | shareOrder.setUser(new UserInfo(uid));
|
| | | shareGoodsActivityOrderMapper.insertSelective(shareOrder);
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ShareGoodsActivityOrder> listByOrderIdAndUid(Long uid, Long orderId) {
|
| | | return shareGoodsActivityOrderMapper.listByOrderIdAndUid(uid, orderId);
|
| | | public List<ShareGoodsActivityOrder> listByOrderIdAndUid(Long uid, String taoBaoOrderNo) {
|
| | | return shareGoodsActivityOrderMapper.listByOrderIdAndUid(uid, taoBaoOrderNo);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | * @param order
|
| | | * @throws ShareGoodsActivityOrderException
|
| | | */
|
| | | public void addShareGoodsActivityOrder(Long uid, BigDecimal rate, Order order)
|
| | | public void addShareGoodsActivityOrder(Long uid, BigDecimal rate, String taoBaoOrderNo)
|
| | | throws ShareGoodsActivityOrderException;
|
| | |
|
| | | /**
|
| | |
| | | * @param orderId
|
| | | * @return
|
| | | */
|
| | | public List<ShareGoodsActivityOrder> listByOrderIdAndUid(Long uid, Long orderId);
|
| | | public List<ShareGoodsActivityOrder> listByOrderIdAndUid(Long uid, String taoBaoOrderNo);
|
| | |
|
| | | /**
|
| | | * 根据用户ID查询订单
|
| | |
| | | import java.util.Calendar;
|
| | | import java.util.List;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail;
|
| | |
| | | import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail.MsgTypeOrderTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.BindingAccount;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
| | | * @return
|
| | | */
|
| | | public static UserMsgVO create(MsgInviteDetail msg) {
|
| | | if (msg.getInviteUser() == null || msg.getInviteUser().getWorker() == null)
|
| | | return null;
|
| | | List<CommonMsgItemVO> items = new ArrayList<>();
|
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | |
|
| | | LogHelper.test("邀请消息:" + new Gson().toJson(msg));
|
| | | contentList.add(new ClientTextStyleVO(msg.getInviteUser().getWorker().getNickName() + "", COLOR_CONTENT,
|
| | | msg.getInviteUser().getWorker().getPortrait()));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("被邀请人", COLOR_TITLE), contentList));
|