yujian
2019-09-09 4ea48ee6d71a4877aa2644ecf3c4758e26a91149
Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div
4个文件已删除
22个文件已修改
2个文件已添加
1871 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/TestController.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/RecommendController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMoneyController.java 101 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/BrandControllerV2.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/ExtractMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/order/CommonOrderMapper.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dto/order/CommonOrderAddResultDTO.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/UserInfoExtra.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/job/TaoLiJinJob.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/ExtractMapper.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/msg/MsgOrderDetailMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml 197 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserInfoExtraMapper.xml 459 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskRecordServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/jd/JDOrderProcessServiceImpl.java 152 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java 218 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/pdd/PDDOrderProcessServiceImpl.java 146 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/ExtractServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/jd/JDOrderProcessService.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/order/CommonOrderService.java 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/order/OrderProcessService.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/pdd/PDDOrderProcessService.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/ExtractService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java 147 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/cmq/PlaceOrderCMQManager.java 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/goods/GoodsDetailVOFactory.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/money/UserMoneyStatisticVO.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/TestController.java
@@ -8,7 +8,9 @@
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import javax.annotation.Resource;
@@ -67,6 +69,7 @@
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
@Controller
@@ -104,16 +107,12 @@
    @Resource
    private InviteMaterialService inviteMaterialService;
    @Resource
    private DynamicInfoDao dynamicInfoDao;
    @Resource
    private JedisPool jedisPool;
    @RequestMapping(value = "testimg")
    public void testImg(HttpServletRequest request, PrintWriter out) {
@@ -478,9 +477,7 @@
            e.printStackTrace();
        }
    }
    /**
     * 插入邀请素材
     * 
@@ -490,42 +487,55 @@
    public void queryExistsAuctionId(PrintWriter out) {
        try {
            List<DynamicInfo> list = dynamicInfoDao.queryExistsAuctionId();
            for (DynamicInfo dynamicInfo: list) {
            for (DynamicInfo dynamicInfo : list) {
                List<GoodsPicture> imgs = dynamicInfo.getImgs();
                if (imgs == null || imgs.size() == 0) {
                    continue;
                }
                boolean update = false;
                for (GoodsPicture goodsPicture: imgs) {
                for (GoodsPicture goodsPicture : imgs) {
                    TaoBaoGoodsBriefExtra goods = goodsPicture.getGoods();
                    if (goods == null) {
                        continue;
                    }
                    if (goods.getAuctionId() == null) {
                        update = true;
                        goods.setAuctionId(goods.getId());
                    }
                }
                if (update) {
                    dynamicInfo.setImgs(imgs);
                    dynamicInfoDao.updateGoodInfo(dynamicInfo);
                }
            }
            JsonUtil.printMode(out, null, JsonUtil.loadTrueResult("操作成功"));
//            JsonUtil.printMode(out, null, JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(list)));
            // JsonUtil.printMode(out, null,
            // JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(list)));
        } catch (Exception e) {
            JsonUtil.printMode(out, null, JsonUtil.loadFalseResult("操作失败"));
            e.printStackTrace();
        }
    }
    @RequestMapping(value = "getWaitingThreadsCount")
    public void getWaitingThreadsCount(PrintWriter out) {
        out.print(Constant.waitingThreadSet.size());
    }
    @RequestMapping(value = "getBinFaRedisKey")
    public void getPinFaRedisKey(PrintWriter out) {
        JSONArray array = new JSONArray();
        Jedis jedis = jedisPool.getResource();
        try {
            Set<String> sets = jedis.keys("rs-*");
            for (Iterator<String> its = sets.iterator(); its.hasNext();)
                array.add(its.next());
        } finally {
            jedisPool.returnResource(jedis);
        }
        out.println(array.toString());
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/RecommendController.java
@@ -2555,11 +2555,11 @@
     * @param out
     */
    @RequestMapping(value = "getSpecialActivities")
    public void getSpecialActivities(AcceptData acceptData, Long uid, PrintWriter out) {
    public void getSpecialActivities(AcceptData acceptData, Long uid, PrintWriter out, String callback) {
        int platformCode = Constant.getPlatformCode(acceptData.getPlatform());
        List<Special> listSpecial = specialService.listByVersion(0, Integer.MAX_VALUE, "special_activities",
                platformCode, Integer.parseInt(acceptData.getVersion()));
        List<Special> list = new ArrayList<Special>();
        if (listSpecial != null) {
            list.addAll(listSpecial);
@@ -2594,6 +2594,9 @@
        JSONObject root = new JSONObject();
        root.put("special", JsonUtil.getApiCommonGson().toJson(list));
        out.print(JsonUtil.loadTrueResult(root));
        if (StringUtil.isNullOrEmpty(callback))
            out.print(JsonUtil.loadTrueResult(root));
        else
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(root));
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMoneyController.java
@@ -13,7 +13,6 @@
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.yeshi.utils.BigDecimalUtil;
import org.yeshi.utils.JsonUtil;
import com.google.gson.Gson;
@@ -26,11 +25,16 @@
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
import com.yeshi.fanli.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum;
import com.yeshi.fanli.exception.user.UserInfoExtraException;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
import com.yeshi.fanli.service.inter.user.ExtractService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.service.inter.user.UserMoneyDetailService;
import com.yeshi.fanli.util.MoneyBigDecimalUtil;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.vo.money.UserMoneyDetailHistoryVO;
@@ -56,6 +60,15 @@
    @Resource
    private HongBaoV2Service hongBaoV2Service;
    @Resource
    private ExtractService extractService;
    @Resource
    private UserInfoExtraService userInfoExtraService;
    @Resource
    private ConfigService configService;
    /**
     * 新版资金详情(1.4.9)
@@ -152,8 +165,9 @@
            out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
            return;
        }
        UserInfo user = userInfoService.getUserById(uid);
        BigDecimal balance = userInfoService.getUserById(uid).getMyHongBao();
        BigDecimal balance = user.getMyHongBao();
        UserMoneyStatisticVO vo = new UserMoneyStatisticVO();
        vo.setBalanceMoney(balance);
@@ -273,7 +287,7 @@
        // 全部未到账
        minDate = new Date(0);
        maxDate=new Date(timeStamp);
        maxDate = new Date(timeStamp);
        vo.setTotalUnRecievedMoney(hongBaoV2Service.getUnRecievedMoneyWithCreateTime(uid, minDate, maxDate));
        GsonBuilder builder = new GsonBuilder();
        builder.registerTypeAdapter(BigDecimal.class, new JsonSerializer<BigDecimal>() {
@@ -289,7 +303,86 @@
            }
        });
        // 获取提现中的信息
        BigDecimal extractingMoney = extractService.sumVerifyingMoney(uid);
        if (extractingMoney.compareTo(new BigDecimal(0)) > 0)
            vo.setExtractingMoneyInfo("提现中:¥" + extractingMoney.setScale(2));
        // 获取是否绑定了微信
        if (!StringUtil.isNullOrEmpty(user.getWxUnionId())) {
            vo.setBindingWX(true);
        } else
            vo.setBindingWX(false);
        UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(uid);
        if (extra != null && extra.getAutoExtract() != null && extra.getAutoExtract() == true)
            vo.setAutoExtract(true);
        else
            vo.setAutoExtract(false);
        vo.setAutoExtractHelpUrl(configService.get("auto_extract_help_url"));
        out.print(JsonUtil.loadTrueResult(builder.create().toJson(vo)));
    }
    /**
     * 自动提现
     *
     * @param acceptData
     * @param type
     * @param out
     */
    @RequestMapping("autoExtract")
    public void autoExtract(AcceptData acceptData, Long uid, Integer type, PrintWriter out) {
        if (type == null) {
            out.print(JsonUtil.loadFalseResult("请上传type"));
            return;
        }
        if (uid == null) {
            out.print(JsonUtil.loadFalseResult("用戶未登录"));
            return;
        }
        UserInfoExtra userExtra = userInfoExtraService.getUserInfoExtra(uid);
        UserInfo user = userInfoService.selectByPKey(uid);
        if (user == null) {
            out.print(JsonUtil.loadFalseResult("用戶不存在"));
            return;
        }
        if (type == 1)// 开启
        {
            if (userExtra.getAutoExtract() == null || userExtra.getAutoExtract() == false) {
                if (StringUtil.isNullOrEmpty(user.getWxUnionId()))// 尚未綁定微信
                {
                    out.print(JsonUtil.loadFalseResult("未綁定微信"));
                    return;
                }
                // 设置自动提现
                UserInfoExtra update = new UserInfoExtra();
                update.setId(userExtra.getId());
                update.setAutoExtract(true);
                try {
                    userInfoExtraService.saveUserInfoExtra(update);
                } catch (UserInfoExtraException e) {
                    e.printStackTrace();
                }
                out.print(JsonUtil.loadTrueResult(""));
                return;
            } else {
                out.print(JsonUtil.loadTrueResult(""));
                return;
            }
        } else {// 关闭
            UserInfoExtra update = new UserInfoExtra();
            update.setId(userExtra.getId());
            update.setAutoExtract(false);
            try {
                userInfoExtraService.saveUserInfoExtra(update);
            } catch (UserInfoExtraException e) {
                e.printStackTrace();
            }
            out.print(JsonUtil.loadTrueResult(""));
            return;
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/BrandControllerV2.java
@@ -42,7 +42,6 @@
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
import com.yeshi.fanli.vo.brand.BrandInfoVO;
import com.yeshi.fanli.vo.goods.GoodsDetailVO;
import com.yeshi.fanli.vo.goods.ShopInfoVO;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/ExtractMapper.java
@@ -116,4 +116,12 @@
     * @return
     */
    BigDecimal sumToadyApplyByUid(@Param("uid") Long uid, @Param("day") String day);
    /**
     * 根据用户ID与状态统计资金
     * @param uid
     * @param stateList
     * @return
     */
    BigDecimal sumMoneyByUidAndState(@Param("uid") Long uid,@Param("stateList")List<Integer> stateList);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/order/CommonOrderMapper.java
@@ -256,17 +256,16 @@
     * @return
     */
    List<CommonOrder> listBySourceTypeAndTradeId(@Param("sourceType") int sourceType, @Param("tradeId") String tradeId);
    /**
     * 根据来源和交易ID获取订单列表
     *
     * @param sourceType
     * @param tradeIdList
     * @return
     */
    List<CommonOrder> listBySourceTypeAndTradeIdList(@Param("sourceType") int sourceType, @Param("tradeIdList") List<String> tradeIdList);
    List<CommonOrder> listBySourceTypeAndTradeIdList(@Param("sourceType") int sourceType,
            @Param("tradeIdList") List<String> tradeIdList);
    /**
     * 
@@ -281,13 +280,24 @@
    List<CommonOrder> listBySourceTypeAndStateAndThirdCrateTime(@Param("sourceType") int sourceType,
            @Param("state") Integer state, @Param("minTime") Long minTime, @Param("maxTime") Long maxTime,
            @Param("start") long start, @Param("count") int count);
    /**
     * 根据订单号查询
     *
     * @param orderNO
     * @return
     */
    List<CommonOrder> getByOrderNo(@Param("uid") Long uid, @Param("orderNo") String orderNo);
    /**
     * 根据用户ID查询
     * @param uid
     * @param stateList
     * @param start
     * @param count
     * @return
     */
    List<CommonOrder> listByUid(@Param("uid")Long uid,@Param("stateList") List<Integer> stateList,@Param("start") long start,@Param("count") int count);
}
fanli/src/main/java/com/yeshi/fanli/dto/order/CommonOrderAddResultDTO.java
New file
@@ -0,0 +1,38 @@
package com.yeshi.fanli.dto.order;
import com.yeshi.fanli.entity.order.CommonOrder;
public class CommonOrderAddResultDTO {
    public final static int TYPE_ADD = 1;
    public final static int TYPE_UPDATE = 2;
    public final static int TYPE_NOUPDATE = 3;
    private CommonOrder commonOrder;
    private int type;
    public CommonOrderAddResultDTO() {
    }
    public CommonOrderAddResultDTO(CommonOrder commonOrder, int type) {
        this.commonOrder = commonOrder;
        this.type = type;
    }
    public CommonOrder getCommonOrder() {
        return commonOrder;
    }
    public void setCommonOrder(CommonOrder commonOrder) {
        this.commonOrder = commonOrder;
    }
    public int getType() {
        return type;
    }
    public void setType(int type) {
        this.type = type;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/UserInfoExtra.java
@@ -73,6 +73,11 @@
    @Column(name = "uie_gold_coin")
    private Integer goldCoin;
    
    //是否微信自動提現
    @Column(name = "uie_auto_extract")
    private Boolean autoExtract;
    // 创建时间
    @Column(name = "uie_create_time")
    private Date createTime;
@@ -209,4 +214,14 @@
    public void setGoldCoin(Integer goldCoin) {
        this.goldCoin = goldCoin;
    }
    public Boolean getAutoExtract() {
        return autoExtract;
    }
    public void setAutoExtract(Boolean autoExtract) {
        this.autoExtract = autoExtract;
    }
}
fanli/src/main/java/com/yeshi/fanli/job/TaoLiJinJob.java
@@ -18,7 +18,6 @@
import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.log.TLJLogHelper;
import com.yeshi.fanli.service.inter.taobao.ShareHotGoodsService;
import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
fanli/src/main/java/com/yeshi/fanli/mapping/ExtractMapper.xml
@@ -416,4 +416,16 @@
        AND  FROM_UNIXTIME(t.extractTime/1000,'%Y-%m-%d') = #{day}
    </select>
    
    <select id="sumMoneyByUidAndState" resultType="java.math.BigDecimal">
        SELECT IFNULL(SUM(t.`money`),0) FROM yeshi_ec_extract t
        WHERE t.`uid` = #{uid}
        <if test="stateList!=null">
        <foreach collection="stateList" item="state" open="and (" close=")" separator=" or ">
        `state`=#{state}
        </foreach>
        </if>
    </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/msg/MsgOrderDetailMapper.xml
@@ -37,7 +37,7 @@
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_msg_order where mo_uid = #{uid,jdbcType=BIGINT} and
        mo_order_id=#{orderId}
        mo_order_id=#{orderId}  order by mo_id desc limit 1
    </select>
    <select id="listByOrderId" resultMap="BaseResultMap"
        parameterType="java.lang.String">
fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml
@@ -99,7 +99,7 @@
        <result column="hb_id" property="hongbaoId" jdbcType="BIGINT" />
        <result column="co_trade_id" property="tradeId" jdbcType="VARCHAR" />
        <association property="userInfo" column="co_uid"
            resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap" />
@@ -107,8 +107,8 @@
            resultMap="com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper.BaseResultMap" />
    </resultMap>
    <resultMap id="ThreeResultMap" type="com.yeshi.fanli.vo.order.CommonOrderVO">
        <id column="co_id" property="id" jdbcType="BIGINT" />
        <result column="co_order_no" property="orderNo" jdbcType="VARCHAR" />
@@ -145,14 +145,14 @@
        <result column="userPortrait" property="userPortrait" jdbcType="VARCHAR" />
        <result column="hb_id" property="hongbaoId" jdbcType="BIGINT" />
        <result column="co_trade_id" property="tradeId" jdbcType="VARCHAR" />
         <association property="userInfo" column="co_uid"
           select="com.yeshi.fanli.dao.mybatis.UserInfoMapper.selectByPKey"/>
         <association property="commonOrderGoods" column="co_order_goods_id"
           select="com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper.selectByPrimaryKey"/>
        <association property="userInfo" column="co_uid"
            select="com.yeshi.fanli.dao.mybatis.UserInfoMapper.selectByPKey" />
        <association property="commonOrderGoods" column="co_order_goods_id"
            select="com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper.selectByPrimaryKey" />
    </resultMap>
    <sql id="Base_Column_List">co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_state_whole_order,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,co_order_by,co_create_time,co_update_time,co_trade_id
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
@@ -183,48 +183,54 @@
    <select id="selectBySourceTypeAndTradeId" resultMap="BaseResultMap">SELECT *
        FROM
        yeshi_ec_common_order co WHERE co.co_source_type=#{sourceType} and
        co_trade_id=#{tradeId}  limit 1
        co_trade_id=#{tradeId} limit 1
    </select>
    <select id="listBySourceTypeAndTradeId" resultMap="BaseResultMap">SELECT *
        FROM
        yeshi_ec_common_order co WHERE co.co_source_type=#{sourceType} and
        co_trade_id=#{tradeId}
    </select>
    <select id="listBySourceTypeAndTradeIdList" resultMap="BaseResultMap">SELECT *
    <select id="listBySourceTypeAndTradeIdList" resultMap="BaseResultMap">
        SELECT *
        FROM
        yeshi_ec_common_order co WHERE co.co_source_type=#{sourceType}
        yeshi_ec_common_order co WHERE
        co.co_source_type=#{sourceType}
        <if test="tradeIdList!=null">
            <foreach collection="tradeIdList" item="tradeId" open=" and (" close=")" separator=" or ">
            <foreach collection="tradeIdList" item="tradeId" open=" and ("
                close=")" separator=" or ">
                co.co_trade_id=#{tradeId}
            </foreach>
        </if>
    </select>
    <select id="listBySourceTypeAndStateAndThirdCrateTime" resultMap="BaseResultMap">SELECT *
    <select id="listBySourceTypeAndStateAndThirdCrateTime"
        resultMap="BaseResultMap">
        SELECT *
        FROM
        yeshi_ec_common_order co WHERE co.co_source_type=#{sourceType}
        yeshi_ec_common_order co WHERE
        co.co_source_type=#{sourceType}
        <if test="state!=null">
            and co_state=#{state}
        </if>
        <if test="minTime!=null">
            and UNIX_TIMESTAMP(co_third_create_time)*1000>=#{minTime}
        </if>
        <if test="maxTime!=null">
            and    #{maxTime}>    UNIX_TIMESTAMP(co_third_create_time)*1000
            and #{maxTime}> UNIX_TIMESTAMP(co_third_create_time)*1000
        </if>
        order by co_id desc
        limit #{start},#{count}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_common_order where co_id = #{id,jdbcType=BIGINT}
@@ -413,7 +419,7 @@
        MAX(co_settle_time) AS co_settle_time, co_order_by, co_create_time,
        co_update_time
    </sql>
    <select id="listUserOrder" resultMap="ResultMap">
        <!-- 查询用户订单 -->
        SELECT COALESCE(SUM(hb.`hb_money`),0)AS totalMoney, hb.hb_state AS
@@ -437,11 +443,11 @@
        <if test="orderNo != null and orderNo !='' ">AND co.co_order_no = #{orderNo}</if>
        <!-- 订单来源 -->
        <if test="source != null">AND co.co_source_type = #{source}</if>
        GROUP BY co.`co_order_no`, co.`co_source_type` ORDER BY
        co.co_third_create_time DESC LIMIT ${start},${count}
    </select>
    <select id="countUserOrder" resultType="java.lang.Long">
        <!-- 统计用户订单数量 -->
        SELECT IFNULL(COUNT(ho_id),0) FROM (SELECT ho.ho_id FROM
@@ -462,7 +468,7 @@
        <if test="orderNo != null and orderNo !='' ">AND co.co_order_no = #{orderNo}</if>
        <!-- 订单来源 -->
        <if test="source != null">AND co.co_source_type = #{source}</if>
        GROUP BY co.`co_order_no`, co.`co_source_type` )A
    </select>
    <select id="listOrderGoodsInfo" resultMap="ResultMap"
@@ -480,8 +486,8 @@
        </foreach>
        GROUP BY tc.`co_order_no`,tc.`co_order_goods_id`
    </select>
    <select id="countHistoryOrder" resultType="java.util.HashMap">
        <!-- 统计历史订单数量 -->
        SELECT SUM(A.self)AS totalSelf,SUM(A.shared)AS
@@ -515,11 +521,11 @@
        </if>
        <!-- 订单来源 -->
        <if test="source != null">AND co.co_source_type = #{source}</if>
        GROUP BY co.`co_order_no`, co.`co_source_type`)YX
        GROUP BY co.`co_order_no`, co.`co_source_type`)YX
        UNION ALL
        <!-- 分享订单 -->
        SELECT 0 AS self,IFNULL(COUNT(ho_id),0) AS shared,0 AS invite FROM
        (SELECT ho.`ho_id` FROM yeshi_ec_hongbao_order ho LEFT JOIN ( SELECT *
@@ -527,7 +533,7 @@
        = 20 ) hb ON hb.hb_id=ho.`ho_hongbao_id`
        <!-- 分享订单 -->
        LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id`
        WHERE hb.hb_id IS NOT NULL  and hb.hb_state!=4
        WHERE hb.hb_id IS NOT NULL and hb.hb_state!=4
        <if test="day != null and day == 1">
            <!-- 今天 -->
            AND TO_DAYS(co.`co_third_create_time`) = TO_DAYS(NOW())
@@ -548,11 +554,11 @@
        </if>
        <!-- 订单来源 -->
        <if test="source != null">AND co.co_source_type = #{source}</if>
        GROUP BY co.`co_order_no`, co.`co_source_type`)WQ
        GROUP BY co.`co_order_no`, co.`co_source_type`)WQ
        UNION ALL
        <!-- 邀请订单 -->
        SELECT 0 AS self,0 AS shared,IFNULL(COUNT(ho_id),0) AS invite FROM
        (SELECT ho.`ho_id` FROM yeshi_ec_hongbao_order ho LEFT JOIN ( SELECT *
@@ -560,7 +566,8 @@
        (v2.`hb_type` = 5 OR v2.`hb_type` = 6 OR v2.`hb_type` = 7 OR
        v2.`hb_type` = 21 OR v2.`hb_type` = 22 ) ) hbp ON
        hbp.hb_pid=ho.`ho_hongbao_id` LEFT JOIN yeshi_ec_common_order co ON
        co.`co_id`=ho.`ho_order_id` WHERE hbp.hb_id IS NOT NULL  and hbp.hb_state!=4
        co.`co_id`=ho.`ho_order_id` WHERE hbp.hb_id IS NOT NULL and
        hbp.hb_state!=4
        <if test="day != null and day == 1">
            <!-- 今天 -->
            AND TO_DAYS(co.`co_third_create_time`) = TO_DAYS(NOW())
@@ -581,11 +588,11 @@
        </if>
        <!-- 订单来源 -->
        <if test="source != null">AND co.co_source_type = #{source}</if>
        GROUP BY co.`co_order_no`, co.`co_source_type`)SX )A
    </select>
    <select id="countByUidAndOrderState" resultType="java.util.HashMap">
        SELECT SUM(A.valid)AS totalValid, SUM(A.proces)AS
        totalProces,SUM(A.Invalid)AS totalInvite FROM (
@@ -598,13 +605,13 @@
        LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id`
        WHERE hb.hb_id IS NOT NULL <![CDATA[AND co.`co_state` <> 3]]>
        AND (co.`co_state_whole_order` =1 OR co.`co_state_whole_order` = 2)
            <include refid="SELECT_PARAM_ORDER_CREATE_TIME" />
            <!-- 订单来源 -->
            <if test="source != null">AND co.co_source_type = #{source}</if>
        GROUP BY co.`co_order_no`, co.`co_source_type`)YX
        <include refid="SELECT_PARAM_ORDER_CREATE_TIME" />
        <!-- 订单来源 -->
        <if test="source != null">AND co.co_source_type = #{source}</if>
        GROUP BY co.`co_order_no`, co.`co_source_type`)YX
        UNION ALL
        <!-- 维权订单 -->
        SELECT 0 AS valid,IFNULL(COUNT(ho_id),0) AS proces,0 AS Invalid FROM
        (SELECT ho.`ho_id` FROM yeshi_ec_hongbao_order ho LEFT JOIN ( SELECT *
@@ -614,12 +621,12 @@
        LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id`
        WHERE hb.hb_id IS NOT NULL AND co.`co_state` = 3
        <include refid="SELECT_PARAM_ORDER_CREATE_TIME" />
            <!-- 订单来源 -->
            <if test="source != null">AND co.co_source_type = #{source}</if>
        GROUP BY co.`co_order_no`, co.`co_source_type`)WQ
        <!-- 订单来源 -->
        <if test="source != null">AND co.co_source_type = #{source}</if>
        GROUP BY co.`co_order_no`, co.`co_source_type`)WQ
        UNION ALL
        <!-- 失效订单 -->
        SELECT 0 AS valid,0 AS proces,IFNULL(COUNT(ho_id),0) AS Invalid FROM
        (SELECT ho.`ho_id` FROM yeshi_ec_hongbao_order ho LEFT JOIN ( SELECT *
@@ -629,8 +636,8 @@
        LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id`
        WHERE hb.hb_id IS NOT NULL AND co.`co_state_whole_order` = 3
        <include refid="SELECT_PARAM_ORDER_CREATE_TIME" />
            <!-- 订单来源 -->
            <if test="source != null">AND co.co_source_type = #{source}</if>
        <!-- 订单来源 -->
        <if test="source != null">AND co.co_source_type = #{source}</if>
        GROUP BY co.`co_order_no`, co.`co_source_type`)SX )A
    </select>
    <select id="countBonusOrderNumber" resultType="java.lang.Long">
@@ -679,7 +686,7 @@
        IS NOT NULL
        <include refid="SELECT_PARAM_ORDER_CREATE_TIME" />
        <if test="day != null and day == 4">AND co.`co_state` = 2</if> <!-- 上月 :统计已收货 -->
        <if test="source != null">AND co.co_source_type = #{source}</if>
        <if test="source != null">AND co.co_source_type = #{source}</if>
        GROUP BY co.`co_order_no`, co.`co_source_type` )A
    </select>
    <sql id="SELECT_HONGBAO_STATE">
@@ -750,14 +757,15 @@
        userPortrait FROM (SELECT hb.hb_id,hb.hb_uid,hb.`hb_money` AS
        totalMoney, hb.hb_state AS hongBaoState, hb.`hb_type` AS hongBaoType,
        hb.`hb_get_time` AS accountTime, hb.`hb_pre_get_time` AS
        preAccountTime, co.*  FROM yeshi_ec_hongbao_order ho LEFT JOIN
        (SELECT * FROM yeshi_ec_hongbao_v2 v2 WHERE 1=1
        preAccountTime, co.* FROM yeshi_ec_hongbao_order ho LEFT JOIN
        (SELECT *
        FROM yeshi_ec_hongbao_v2 v2 WHERE 1=1
        <include refid="SELECT_PARAM_HONGBAO_TYPE" />
        <!-- 红包类型 -->
        <include refid="SELECT_HONGBAO_STATE" />
        <!-- 红包状态 -->
        )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id`
        LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id`
        LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id`
        WHERE hb.hb_id IS NOT NULL
        <include refid="SELECT_PARAM_ORDER_STATE" />
        <!-- 订单状态 -->
@@ -774,21 +782,23 @@
        ORDER BY co.co_third_create_time DESC LIMIT ${start},${count} ) A LEFT
        JOIN yeshi_ec_user u ON u.id = A.hb_uid
    </select>
    <select id="listQueryWithNoChild" resultMap="ThreeResultMap">
        SELECT A.*,u.id AS userId,u.`nick_name` AS userName,u.`portrait` AS
        userPortrait FROM (SELECT hb.hb_id,hb.hb_uid,hb.`hb_money` AS
        totalMoney, hb.hb_state AS hongBaoState, hb.`hb_type` AS hongBaoType,
        hb.`hb_get_time` AS accountTime, hb.`hb_pre_get_time` AS
        preAccountTime, co.*  FROM yeshi_ec_hongbao_order ho LEFT JOIN
        (SELECT * FROM yeshi_ec_hongbao_v2 v2 WHERE 1=1
        preAccountTime, co.* FROM yeshi_ec_hongbao_order ho LEFT JOIN
        (SELECT *
        FROM yeshi_ec_hongbao_v2 v2 WHERE 1=1
        <include refid="SELECT_PARAM_HONGBAO_TYPE" />
        <!-- 红包类型 -->
        <include refid="SELECT_HONGBAO_STATE" />
        <!-- 红包状态 -->
        )hb ON hb.hb_id=ho.`ho_hongbao_id`
        LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id`
        LEFT JOIN yeshi_ec_common_order co
        ON co.`co_id`=ho.`ho_order_id`
        WHERE hb.hb_id IS NOT NULL
        <include refid="SELECT_PARAM_ORDER_STATE" />
        <!-- 订单状态 -->
@@ -805,8 +815,8 @@
        ORDER BY co.co_third_create_time DESC LIMIT ${start},${count} ) A LEFT
        JOIN yeshi_ec_user u ON u.id = A.hb_uid
    </select>
    <select id="countQuery" resultType="java.lang.Long">
        SELECT count(ho.ho_id) FROM yeshi_ec_hongbao_order ho LEFT JOIN
        (SELECT * FROM yeshi_ec_hongbao_v2 v2 WHERE 1=1
@@ -815,8 +825,8 @@
        <include refid="SELECT_HONGBAO_STATE" />
        <!-- 红包状态 -->
        )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id`
        LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id`
         WHERE hb.hb_id IS NOT NULL
        LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id`
        WHERE hb.hb_id IS NOT NULL
        <include refid="SELECT_PARAM_ORDER_STATE" />
        <!-- 订单状态 -->
        <if test="startTime != null and startTime != '' ">AND <![CDATA[co.co_third_create_time >= #{startTime}]]>
@@ -830,8 +840,8 @@
        <!-- 订单来源 -->
        <if test="source != null">AND co.co_source_type = #{source}</if>
    </select>
    <select id="countQueryWithNoChild" resultType="java.lang.Long">
        SELECT count(ho.ho_id) FROM yeshi_ec_hongbao_order ho LEFT JOIN
        (SELECT * FROM yeshi_ec_hongbao_v2 v2 WHERE 1=1
@@ -840,8 +850,9 @@
        <include refid="SELECT_HONGBAO_STATE" />
        <!-- 红包状态 -->
        )hb ON hb.hb_id=ho.`ho_hongbao_id`
        LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id`
         WHERE hb.hb_id IS NOT NULL
        LEFT JOIN yeshi_ec_common_order co
        ON co.`co_id`=ho.`ho_order_id`
        WHERE hb.hb_id IS NOT NULL
        <include refid="SELECT_PARAM_ORDER_STATE" />
        <!-- 订单状态 -->
        <if test="startTime != null and startTime != '' ">AND <![CDATA[co.co_third_create_time >= #{startTime}]]>
@@ -855,10 +866,10 @@
        <!-- 订单来源 -->
        <if test="source != null">AND co.co_source_type = #{source}</if>
    </select>
    <select id="getCouponHongbaoByOrderNo" resultMap="ResultMap">
        SELECT COALESCE(SUM(IF(hb.hb_type=1,hb.`hb_money`,0)),0)AS totalMoney,
        COALESCE(SUM(IF(hb.hb_type=10,hb.`hb_money`,0)),0)AS couponMoney,
@@ -884,16 +895,34 @@
        FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= #{uid} AND <![CDATA[v2.`hb_type`<> 10 ]]>
        )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id`
        LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id`
        WHERE hb.hb_id IS NOT NULL AND co.co_order_no = #{orderNo} AND  co.`co_source_type` = #{sourceType}
        WHERE hb.hb_id IS NOT NULL AND co.co_order_no = #{orderNo} AND
        co.`co_source_type` = #{sourceType}
        <if test="orderState != null">
            AND co.co_state = #{orderState}
            <!-- 已收货 -->
        </if>
        GROUP BY co.`co_order_no`, co.`co_source_type`
    </select>
    <select id="getByOrderNo" resultMap="BaseResultMap">
        SELECT * FROM yeshi_ec_common_order co
        SELECT * FROM
        yeshi_ec_common_order co
        WHERE co_uid = #{uid} AND co_order_no=#{orderNo}
    </select>
    <select id="listByUid" resultMap="BaseResultMap">
        SELECT * FROM yeshi_ec_common_order co
        WHERE co_uid = #{uid}
        <if test="stateList!=null">
            <foreach collection="stateList" separator=" or " open="and ("
                item="state" close=")">
                co_state=#{state}
            </foreach>
        </if>
        limit #{start},#{count}
    </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserInfoExtraMapper.xml
@@ -2,191 +2,282 @@
<!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.user.UserInfoExtraMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.UserInfoExtra">
    <id column="uie_id" property="id" jdbcType="BIGINT"/>
    <result column="uie_rank_source" property="rankSource" jdbcType="INTEGER"/>
    <result column="uie_rank_order_num" property="rankOrderNum" jdbcType="INTEGER"/>
    <result column="uie_rank_update_time" property="rankUpdateTime" jdbcType="TIMESTAMP"/>
    <result column="uie_invite_code" property="inviteCode" jdbcType="VARCHAR"/>
    <result column="uie_lottery_newbies" property="lotteryNewbies" jdbcType="INTEGER"/>
    <result column="uie_coupon_news" property="couponNews" jdbcType="INTEGER"/>
    <result column="uie_synch_navbar" property="synchNavbar" jdbcType="VARCHAR"/>
    <result column="uie_first_login_time" property="firstLoginTime" jdbcType="TIMESTAMP"/>
    <result column="uie_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="uie_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    <result column="uie_sex" property="sex" jdbcType="INTEGER"/>
    <result column="uie_weixin" property="weiXin" jdbcType="VARCHAR"/>
    <result column="uie_gold_coin" property="goldCoin" jdbcType="INTEGER"/>
    <association property="userInfo" column="uie_uid" javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
        <id column="uie_uid" property="id" jdbcType="BIGINT" />
    </association>
      <association property="userRank" column="uie_rank_id" javaType="com.yeshi.fanli.entity.bus.user.UserRank">
        <id column="uie_rank_id" property="id" jdbcType="BIGINT" />
    </association>
  </resultMap>
   <resultMap id="VOResultMap" type="com.yeshi.fanli.vo.user.UserInfoExtraVO">
    <id column="uie_id" property="id" jdbcType="BIGINT"/>
    <result column="uie_rank_source" property="rankSource" jdbcType="INTEGER"/>
    <result column="uie_rank_order_num" property="rankOrderNum" jdbcType="INTEGER"/>
    <result column="uie_rank_update_time" property="rankUpdateTime" jdbcType="TIMESTAMP"/>
    <result column="uie_invite_code" property="inviteCode" jdbcType="VARCHAR"/>
    <result column="uie_lottery_newbies" property="lotteryNewbies" jdbcType="INTEGER"/>
    <result column="uie_coupon_news" property="couponNews" jdbcType="INTEGER"/>
    <result column="uie_synch_navbar" property="synchNavbar" jdbcType="VARCHAR"/>
    <result column="uie_first_login_time" property="firstLoginTime" jdbcType="TIMESTAMP"/>
    <result column="uie_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="uie_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    <result column="uie_sex" property="sex" jdbcType="INTEGER"/>
    <result column="uie_weixin" property="weiXin" jdbcType="VARCHAR"/>
    <result column="uie_gold_coin" property="goldCoin" jdbcType="INTEGER"/>
    <association property="userInfo" column="uie_uid"
        resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap"/>
      <association property="userRank" column="uie_rank_id"
          resultMap="com.yeshi.fanli.dao.mybatis.user.UserRankMapper.BaseResultMap"/>
  </resultMap>
  <resultMap id="AllResultMap" type="com.yeshi.fanli.entity.bus.user.UserInfoExtra">
  <id column="uie_id" property="id" jdbcType="BIGINT"/>
    <result column="uie_rank_source" property="rankSource" jdbcType="INTEGER"/>
    <result column="uie_rank_order_num" property="rankOrderNum" jdbcType="INTEGER"/>
    <result column="uie_rank_update_time" property="rankUpdateTime" jdbcType="TIMESTAMP"/>
    <result column="uie_invite_code" property="inviteCode" jdbcType="VARCHAR"/>
    <result column="uie_lottery_newbies" property="lotteryNewbies" jdbcType="INTEGER"/>
    <result column="uie_coupon_news" property="couponNews" jdbcType="INTEGER"/>
    <result column="uie_synch_navbar" property="synchNavbar" jdbcType="VARCHAR"/>
    <result column="uie_first_login_time" property="firstLoginTime" jdbcType="TIMESTAMP"/>
    <result column="uie_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="uie_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    <result column="uie_sex" property="sex" jdbcType="INTEGER"/>
    <result column="uie_weixin" property="weiXin" jdbcType="VARCHAR"/>
    <result column="uie_gold_coin" property="goldCoin" jdbcType="INTEGER"/>
    <association property="userInfo" column="uie_uid" javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
        <id column="uie_uid" property="id" jdbcType="BIGINT" />
    </association>
    <association property="userRank" column="uie_rank_id"
         resultMap="com.yeshi.fanli.dao.mybatis.user.UserRankMapper.BaseResultMap"/>
  </resultMap>
  <sql id="Base_Column_List">uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_invite_code,uie_lottery_newbies,uie_coupon_news,uie_synch_navbar,uie_first_login_time,uie_sex,uie_weixin,uie_gold_coin,uie_create_time,uie_update_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_user_info_extra where uie_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_info_extra where uie_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_info_extra (uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_invite_code,uie_lottery_newbies,uie_coupon_news,uie_synch_navbar,uie_first_login_time,uie_sex,uie_weixin,uie_gold_coin,uie_create_time,uie_update_time) values (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{userRank.id,jdbcType=BIGINT},#{rankSource,jdbcType=INTEGER},#{rankOrderNum,jdbcType=INTEGER},#{rankUpdateTime,jdbcType=TIMESTAMP},#{inviteCode,jdbcType=VARCHAR},#{lotteryNewbies,jdbcType=INTEGER},#{couponNews,jdbcType=INTEGER},#{synchNavbar,jdbcType=VARCHAR},#{firstLoginTime,jdbcType=TIMESTAMP},#{sex,jdbcType=INTEGER},#{weiXin,jdbcType=VARCHAR},#{goldCoin,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_info_extra
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">uie_id,</if>
      <if test="userInfo != null">uie_uid,</if>
      <if test="userRank != null">uie_rank_id,</if>
      <if test="rankSource != null">uie_rank_source,</if>
      <if test="rankOrderNum != null">uie_rank_order_num,</if>
      <if test="rankUpdateTime != null">uie_rank_update_time,</if>
      <if test="inviteCode != null">uie_invite_code,</if>
      <if test="lotteryNewbies != null">uie_lottery_newbies,</if>
      <if test="couponNews != null">uie_coupon_news,</if>
      <if test="synchNavbar != null">uie_synch_navbar,</if>
      <if test="firstLoginTime != null">uie_first_login_time,</if>
      <if test="sex != null">uie_sex,</if>
      <if test="weiXin != null">uie_weixin,</if>
      <if test="goldCoin != null">uie_gold_coin,</if>
      <if test="createTime != null">uie_create_time,</if>
      <if test="updateTime != null">uie_update_time,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="userInfo != null">#{userInfo.id,jdbcType=BIGINT},</if>
      <if test="userRank != null">#{userRank.id,jdbcType=BIGINT},</if>
      <if test="rankSource != null">#{rankSource,jdbcType=INTEGER},</if>
      <if test="rankOrderNum != null">#{rankOrderNum,jdbcType=INTEGER},</if>
      <if test="rankUpdateTime != null">#{rankUpdateTime,jdbcType=TIMESTAMP},</if>
      <if test="inviteCode != null">#{inviteCode,jdbcType=VARCHAR},</if>
      <if test="lotteryNewbies != null">#{lotteryNewbies,jdbcType=INTEGER},</if>
      <if test="couponNews != null">#{couponNews,jdbcType=INTEGER},</if>
      <if test="synchNavbar != null">#{synchNavbar,jdbcType=VARCHAR},</if>
      <if test="firstLoginTime != null">#{firstLoginTime,jdbcType=TIMESTAMP},</if>
      <if test="sex != null">#{sex,jdbcType=INTEGER},</if>
      <if test="weiXin != null">#{weiXin,jdbcType=VARCHAR},</if>
      <if test="goldCoin != null">#{goldCoin,jdbcType=INTEGER},</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.bus.user.UserInfoExtra">update yeshi_ec_user_info_extra set uie_uid = #{userInfo.id,jdbcType=BIGINT},uie_rank_id = #{userRank.id,jdbcType=BIGINT},uie_rank_source = #{rankSource,jdbcType=INTEGER},uie_rank_order_num = #{rankOrderNum,jdbcType=INTEGER},uie_rank_update_time = #{rankUpdateTime,jdbcType=TIMESTAMP},uie_invite_code = #{inviteCode,jdbcType=VARCHAR},uie_lottery_newbies = #{lotteryNewbies,jdbcType=INTEGER},uie_coupon_news = #{couponNews,jdbcType=INTEGER},uie_synch_navbar = #{synchNavbar,jdbcType=VARCHAR},uie_first_login_time = #{firstLoginTime,jdbcType=TIMESTAMP},uie_sex = #{sex,jdbcType=INTEGER},uie_weixin = #{weiXin,jdbcType=VARCHAR},uie_gold_coin = #{goldCoin,jdbcType=INTEGER},uie_create_time = #{createTime,jdbcType=TIMESTAMP},uie_update_time = #{updateTime,jdbcType=TIMESTAMP} where uie_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra">update yeshi_ec_user_info_extra
    <set>
      <if test="userInfo != null">uie_uid=#{userInfo.id,jdbcType=BIGINT},</if>
      <if test="userRank != null">uie_rank_id=#{userRank.id,jdbcType=BIGINT},</if>
      <if test="rankSource != null">uie_rank_source=#{rankSource,jdbcType=INTEGER},</if>
      <if test="rankOrderNum != null">uie_rank_order_num=#{rankOrderNum,jdbcType=INTEGER},</if>
      <if test="rankUpdateTime != null">uie_rank_update_time=#{rankUpdateTime,jdbcType=TIMESTAMP},</if>
      <if test="inviteCode != null">uie_invite_code=#{inviteCode,jdbcType=VARCHAR},</if>
      <if test="lotteryNewbies != null">uie_lottery_newbies=#{lotteryNewbies,jdbcType=INTEGER},</if>
      <if test="couponNews != null">uie_coupon_news=#{couponNews,jdbcType=INTEGER},</if>
      <if test="synchNavbar != null">uie_synch_navbar=#{synchNavbar,jdbcType=VARCHAR},</if>
      <if test="firstLoginTime != null">uie_first_login_time=#{firstLoginTime,jdbcType=TIMESTAMP},</if>
      <if test="sex != null">uie_sex=#{sex,jdbcType=INTEGER},</if>
      <if test="weiXin != null">uie_weixin=#{weiXin,jdbcType=VARCHAR},</if>
      <if test="goldCoin != null">uie_gold_coin=#{goldCoin,jdbcType=INTEGER},</if>
      <if test="createTime != null">uie_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">uie_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where uie_id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateInfoExtraByUid" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra">
      update yeshi_ec_user_info_extra
    <set>
      <if test="userRank != null">uie_rank_id=#{userRank.id,jdbcType=BIGINT},</if>
      <if test="rankSource != null">uie_rank_source=#{rankSource,jdbcType=INTEGER},</if>
      <if test="rankOrderNum != null">uie_rank_order_num=#{rankOrderNum,jdbcType=INTEGER},</if>
      <if test="rankUpdateTime != null">uie_rank_update_time=#{rankUpdateTime,jdbcType=TIMESTAMP},</if>
      <if test="inviteCode != null">uie_invite_code=#{inviteCode,jdbcType=VARCHAR},</if>
      <if test="lotteryNewbies != null">uie_lottery_newbies=#{lotteryNewbies,jdbcType=INTEGER},</if>
      <if test="couponNews != null">uie_coupon_news=#{couponNews,jdbcType=INTEGER},</if>
      <if test="synchNavbar != null">uie_synch_navbar=#{synchNavbar,jdbcType=VARCHAR},</if>
      <if test="firstLoginTime != null">uie_first_login_time=#{firstLoginTime,jdbcType=TIMESTAMP},</if>
      <if test="sex != null">uie_sex=#{sex,jdbcType=INTEGER},</if>
      <if test="weiXin != null">uie_weixin=#{weiXin,jdbcType=VARCHAR},</if>
      <if test="goldCoin != null">uie_gold_coin=#{goldCoin,jdbcType=INTEGER},</if>
      <if test="createTime != null">uie_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">uie_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where uie_uid = #{userInfo.id,jdbcType=BIGINT}
  </update>
   <select id="getInfoExtraByUid" resultMap="BaseResultMap">
        SELECT * FROM yeshi_ec_user_info_extra
    <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.UserInfoExtra">
        <id column="uie_id" property="id" jdbcType="BIGINT" />
        <result column="uie_rank_source" property="rankSource"
            jdbcType="INTEGER" />
        <result column="uie_rank_order_num" property="rankOrderNum"
            jdbcType="INTEGER" />
        <result column="uie_rank_update_time" property="rankUpdateTime"
            jdbcType="TIMESTAMP" />
        <result column="uie_invite_code" property="inviteCode"
            jdbcType="VARCHAR" />
        <result column="uie_lottery_newbies" property="lotteryNewbies"
            jdbcType="INTEGER" />
        <result column="uie_coupon_news" property="couponNews"
            jdbcType="INTEGER" />
        <result column="uie_synch_navbar" property="synchNavbar"
            jdbcType="VARCHAR" />
        <result column="uie_first_login_time" property="firstLoginTime"
            jdbcType="TIMESTAMP" />
        <result column="uie_create_time" property="createTime"
            jdbcType="TIMESTAMP" />
        <result column="uie_update_time" property="updateTime"
            jdbcType="TIMESTAMP" />
        <result column="uie_sex" property="sex" jdbcType="INTEGER" />
        <result column="uie_weixin" property="weiXin" jdbcType="VARCHAR" />
        <result column="uie_gold_coin" property="goldCoin" jdbcType="INTEGER" />
        <result column="uie_auto_extract" property="autoExtract"
            jdbcType="BOOLEAN" />
        <association property="userInfo" column="uie_uid"
            javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
            <id column="uie_uid" property="id" jdbcType="BIGINT" />
        </association>
        <association property="userRank" column="uie_rank_id"
            javaType="com.yeshi.fanli.entity.bus.user.UserRank">
            <id column="uie_rank_id" property="id" jdbcType="BIGINT" />
        </association>
    </resultMap>
    <resultMap id="VOResultMap" type="com.yeshi.fanli.vo.user.UserInfoExtraVO">
        <id column="uie_id" property="id" jdbcType="BIGINT" />
        <result column="uie_rank_source" property="rankSource"
            jdbcType="INTEGER" />
        <result column="uie_rank_order_num" property="rankOrderNum"
            jdbcType="INTEGER" />
        <result column="uie_rank_update_time" property="rankUpdateTime"
            jdbcType="TIMESTAMP" />
        <result column="uie_invite_code" property="inviteCode"
            jdbcType="VARCHAR" />
        <result column="uie_lottery_newbies" property="lotteryNewbies"
            jdbcType="INTEGER" />
        <result column="uie_coupon_news" property="couponNews"
            jdbcType="INTEGER" />
        <result column="uie_synch_navbar" property="synchNavbar"
            jdbcType="VARCHAR" />
        <result column="uie_first_login_time" property="firstLoginTime"
            jdbcType="TIMESTAMP" />
        <result column="uie_create_time" property="createTime"
            jdbcType="TIMESTAMP" />
        <result column="uie_update_time" property="updateTime"
            jdbcType="TIMESTAMP" />
        <result column="uie_sex" property="sex" jdbcType="INTEGER" />
        <result column="uie_weixin" property="weiXin" jdbcType="VARCHAR" />
        <result column="uie_gold_coin" property="goldCoin" jdbcType="INTEGER" />
        <result column="uie_auto_extract" property="autoExtract"
            jdbcType="BOOLEAN" />
        <association property="userInfo" column="uie_uid"
            resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap" />
        <association property="userRank" column="uie_rank_id"
            resultMap="com.yeshi.fanli.dao.mybatis.user.UserRankMapper.BaseResultMap" />
    </resultMap>
    <resultMap id="AllResultMap" type="com.yeshi.fanli.entity.bus.user.UserInfoExtra">
        <id column="uie_id" property="id" jdbcType="BIGINT" />
        <result column="uie_rank_source" property="rankSource"
            jdbcType="INTEGER" />
        <result column="uie_rank_order_num" property="rankOrderNum"
            jdbcType="INTEGER" />
        <result column="uie_rank_update_time" property="rankUpdateTime"
            jdbcType="TIMESTAMP" />
        <result column="uie_invite_code" property="inviteCode"
            jdbcType="VARCHAR" />
        <result column="uie_lottery_newbies" property="lotteryNewbies"
            jdbcType="INTEGER" />
        <result column="uie_coupon_news" property="couponNews"
            jdbcType="INTEGER" />
        <result column="uie_synch_navbar" property="synchNavbar"
            jdbcType="VARCHAR" />
        <result column="uie_first_login_time" property="firstLoginTime"
            jdbcType="TIMESTAMP" />
        <result column="uie_create_time" property="createTime"
            jdbcType="TIMESTAMP" />
        <result column="uie_update_time" property="updateTime"
            jdbcType="TIMESTAMP" />
        <result column="uie_sex" property="sex" jdbcType="INTEGER" />
        <result column="uie_weixin" property="weiXin" jdbcType="VARCHAR" />
        <result column="uie_gold_coin" property="goldCoin" jdbcType="INTEGER" />
        <result column="uie_auto_extract" property="autoExtract"
            jdbcType="BOOLEAN" />
        <association property="userInfo" column="uie_uid"
            javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
            <id column="uie_uid" property="id" jdbcType="BIGINT" />
        </association>
        <association property="userRank" column="uie_rank_id"
            resultMap="com.yeshi.fanli.dao.mybatis.user.UserRankMapper.BaseResultMap" />
    </resultMap>
    <sql id="Base_Column_List">uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_invite_code,uie_lottery_newbies,uie_coupon_news,uie_synch_navbar,uie_first_login_time,uie_sex,uie_weixin,uie_gold_coin,uie_create_time,uie_update_time,uie_auto_extract
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user_info_extra where uie_id = #{id,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_user_info_extra where uie_id = #{id,jdbcType=BIGINT}</delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_user_info_extra
        (uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_invite_code,uie_lottery_newbies,uie_coupon_news,uie_synch_navbar,uie_first_login_time,uie_sex,uie_weixin,uie_gold_coin,uie_create_time,uie_update_time,uie_auto_extract)
        values
        (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{userRank.id,jdbcType=BIGINT},#{rankSource,jdbcType=INTEGER},#{rankOrderNum,jdbcType=INTEGER},#{rankUpdateTime,jdbcType=TIMESTAMP},#{inviteCode,jdbcType=VARCHAR},#{lotteryNewbies,jdbcType=INTEGER},#{couponNews,jdbcType=INTEGER},#{synchNavbar,jdbcType=VARCHAR},#{firstLoginTime,jdbcType=TIMESTAMP},#{sex,jdbcType=INTEGER},#{weiXin,jdbcType=VARCHAR},#{goldCoin,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{autoExtract,jdbcType=BOOLEAN})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_user_info_extra
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">uie_id,</if>
            <if test="userInfo != null">uie_uid,</if>
            <if test="userRank != null">uie_rank_id,</if>
            <if test="rankSource != null">uie_rank_source,</if>
            <if test="rankOrderNum != null">uie_rank_order_num,</if>
            <if test="rankUpdateTime != null">uie_rank_update_time,</if>
            <if test="inviteCode != null">uie_invite_code,</if>
            <if test="lotteryNewbies != null">uie_lottery_newbies,</if>
            <if test="couponNews != null">uie_coupon_news,</if>
            <if test="synchNavbar != null">uie_synch_navbar,</if>
            <if test="firstLoginTime != null">uie_first_login_time,</if>
            <if test="sex != null">uie_sex,</if>
            <if test="weiXin != null">uie_weixin,</if>
            <if test="goldCoin != null">uie_gold_coin,</if>
            <if test="createTime != null">uie_create_time,</if>
            <if test="updateTime != null">uie_update_time,</if>
            <if test="autoExtract != null">uie_auto_extract,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="userInfo != null">#{userInfo.id,jdbcType=BIGINT},</if>
            <if test="userRank != null">#{userRank.id,jdbcType=BIGINT},</if>
            <if test="rankSource != null">#{rankSource,jdbcType=INTEGER},</if>
            <if test="rankOrderNum != null">#{rankOrderNum,jdbcType=INTEGER},</if>
            <if test="rankUpdateTime != null">#{rankUpdateTime,jdbcType=TIMESTAMP},</if>
            <if test="inviteCode != null">#{inviteCode,jdbcType=VARCHAR},</if>
            <if test="lotteryNewbies != null">#{lotteryNewbies,jdbcType=INTEGER},</if>
            <if test="couponNews != null">#{couponNews,jdbcType=INTEGER},</if>
            <if test="synchNavbar != null">#{synchNavbar,jdbcType=VARCHAR},</if>
            <if test="firstLoginTime != null">#{firstLoginTime,jdbcType=TIMESTAMP},</if>
            <if test="sex != null">#{sex,jdbcType=INTEGER},</if>
            <if test="weiXin != null">#{weiXin,jdbcType=VARCHAR},</if>
            <if test="goldCoin != null">#{goldCoin,jdbcType=INTEGER},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="autoExtract != null">#{autoExtract,jdbcType=BOOLEAN},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra">update
        yeshi_ec_user_info_extra set uie_uid =
        #{userInfo.id,jdbcType=BIGINT},uie_rank_id =
        #{userRank.id,jdbcType=BIGINT},uie_rank_source =
        #{rankSource,jdbcType=INTEGER},uie_rank_order_num =
        #{rankOrderNum,jdbcType=INTEGER},uie_rank_update_time =
        #{rankUpdateTime,jdbcType=TIMESTAMP},uie_invite_code =
        #{inviteCode,jdbcType=VARCHAR},uie_lottery_newbies =
        #{lotteryNewbies,jdbcType=INTEGER},uie_coupon_news =
        #{couponNews,jdbcType=INTEGER},uie_synch_navbar =
        #{synchNavbar,jdbcType=VARCHAR},uie_first_login_time =
        #{firstLoginTime,jdbcType=TIMESTAMP},uie_sex =
        #{sex,jdbcType=INTEGER},uie_weixin =
        #{weiXin,jdbcType=VARCHAR},uie_gold_coin =
        #{goldCoin,jdbcType=INTEGER},uie_create_time =
        #{createTime,jdbcType=TIMESTAMP},uie_update_time =
        #{updateTime,jdbcType=TIMESTAMP},uie_auto_extract =
        #{autoExtract,jdbcType=BOOLEAN}  where uie_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra">
        update yeshi_ec_user_info_extra
        <set>
            <if test="userInfo != null">uie_uid=#{userInfo.id,jdbcType=BIGINT},</if>
            <if test="userRank != null">uie_rank_id=#{userRank.id,jdbcType=BIGINT},</if>
            <if test="rankSource != null">uie_rank_source=#{rankSource,jdbcType=INTEGER},</if>
            <if test="rankOrderNum != null">uie_rank_order_num=#{rankOrderNum,jdbcType=INTEGER},</if>
            <if test="rankUpdateTime != null">uie_rank_update_time=#{rankUpdateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="inviteCode != null">uie_invite_code=#{inviteCode,jdbcType=VARCHAR},</if>
            <if test="lotteryNewbies != null">uie_lottery_newbies=#{lotteryNewbies,jdbcType=INTEGER},
            </if>
            <if test="couponNews != null">uie_coupon_news=#{couponNews,jdbcType=INTEGER},</if>
            <if test="synchNavbar != null">uie_synch_navbar=#{synchNavbar,jdbcType=VARCHAR},</if>
            <if test="firstLoginTime != null">uie_first_login_time=#{firstLoginTime,jdbcType=TIMESTAMP},
            </if>
            <if test="sex != null">uie_sex=#{sex,jdbcType=INTEGER},</if>
            <if test="weiXin != null">uie_weixin=#{weiXin,jdbcType=VARCHAR},</if>
            <if test="goldCoin != null">uie_gold_coin=#{goldCoin,jdbcType=INTEGER},</if>
            <if test="createTime != null">uie_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">uie_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="autoExtract != null">uie_auto_extract=#{autoExtract,jdbcType=BOOLEAN},</if>
        </set>
        where uie_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateInfoExtraByUid" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra">
        update yeshi_ec_user_info_extra
        <set>
            <if test="userRank != null">uie_rank_id=#{userRank.id,jdbcType=BIGINT},</if>
            <if test="rankSource != null">uie_rank_source=#{rankSource,jdbcType=INTEGER},</if>
            <if test="rankOrderNum != null">uie_rank_order_num=#{rankOrderNum,jdbcType=INTEGER},</if>
            <if test="rankUpdateTime != null">uie_rank_update_time=#{rankUpdateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="inviteCode != null">uie_invite_code=#{inviteCode,jdbcType=VARCHAR},</if>
            <if test="lotteryNewbies != null">uie_lottery_newbies=#{lotteryNewbies,jdbcType=INTEGER},
            </if>
            <if test="couponNews != null">uie_coupon_news=#{couponNews,jdbcType=INTEGER},</if>
            <if test="synchNavbar != null">uie_synch_navbar=#{synchNavbar,jdbcType=VARCHAR},</if>
            <if test="firstLoginTime != null">uie_first_login_time=#{firstLoginTime,jdbcType=TIMESTAMP},
            </if>
            <if test="sex != null">uie_sex=#{sex,jdbcType=INTEGER},</if>
            <if test="weiXin != null">uie_weixin=#{weiXin,jdbcType=VARCHAR},</if>
            <if test="goldCoin != null">uie_gold_coin=#{goldCoin,jdbcType=INTEGER},</if>
            <if test="createTime != null">uie_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">uie_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="autoExtract != null">uie_auto_extract=#{autoExtract,jdbcType=BOOLEAN},</if>
        </set>
        where uie_uid = #{userInfo.id,jdbcType=BIGINT}
    </update>
    <select id="getInfoExtraByUid" resultMap="BaseResultMap">
        SELECT * FROM
        yeshi_ec_user_info_extra
        WHERE uie_uid = #{uid}
   </select>
   <select id="getInfoExtraVOByUid" resultMap="VOResultMap">
        SELECT u.`id`,u.`nick_name`,u.`portrait`,ue.*,rk.*
        FROM yeshi_ec_user_info_extra ue
        LEFT JOIN yeshi_ec_user u ON ue.`uie_uid` = u.`id`
    </select>
    <select id="getInfoExtraVOByUid" resultMap="VOResultMap">
        SELECT
        u.`id`,u.`nick_name`,u.`portrait`,ue.*,rk.*
        FROM
        yeshi_ec_user_info_extra ue
        LEFT JOIN yeshi_ec_user u ON ue.`uie_uid` =
        u.`id`
        LEFT JOIN yeshi_ec_user_rank rk ON rk.`ur_id` = ue.`uie_rank_id`
        WHERE u.id = #{uid}
   </select>
   <select id="countByRankId" parameterType="java.lang.Long" resultType="java.lang.Long" >
        SELECT IFNULL(COUNT(t.`uie_id`),0)  FROM `yeshi_ec_user_info_extra` t
        WHERE  t.`uie_rank_id` = #{rankId}
   </select>
   <select id="gerUserRank" resultMap="AllResultMap">
        SELECT * FROM yeshi_ec_user_info_extra ue
        LEFT JOIN yeshi_ec_user_rank rk ON rk.`ur_id` = ue.`uie_rank_id`
        WHERE u.id
        = #{uid}
    </select>
    <select id="countByRankId" parameterType="java.lang.Long"
        resultType="java.lang.Long">
        SELECT IFNULL(COUNT(t.`uie_id`),0) FROM
        `yeshi_ec_user_info_extra` t
        WHERE t.`uie_rank_id` = #{rankId}
    </select>
    <select id="gerUserRank" resultMap="AllResultMap">
        SELECT * FROM
        yeshi_ec_user_info_extra ue
        LEFT JOIN yeshi_ec_user_rank rk ON
        rk.`ur_id` = ue.`uie_rank_id`
        WHERE ue.`uie_uid` = #{uid}
   </select>
    </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskRecordServiceImpl.java
@@ -372,7 +372,7 @@
    }
    
    
//    @Async()
    @Async()
    @Override
    public void firstRebateOrderRewardBoss(Long uid, Long originUid, String beizu) {
        if (uid == null || originUid == null)
@@ -384,7 +384,7 @@
        firstOrderReward(uid, originUid, Integer.parseInt(reward), "一", beizu);
    }
    
//    @Async()
    @Async()
    @Override
    public void firstRebateOrderRewardBossSuper(Long uid, Long originUid, String beizu) {
        if (uid == null || originUid == null)
@@ -397,7 +397,7 @@
    }
    
    
//    @Async()
    @Async()
    @Override
    public void firstShareOrderReward(Long uid, String beizu) {
        if(uid == null)
@@ -410,7 +410,7 @@
    }
    
    
//    @Async()
    @Async()
    @Override
    public void firstSharerOrderRewardBoss(Long uid, Long originUid, String beizu) {
        if (uid == null || originUid == null)
fanli/src/main/java/com/yeshi/fanli/service/impl/jd/JDOrderProcessServiceImpl.java
File was deleted
fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java
@@ -20,6 +20,7 @@
import com.yeshi.fanli.dao.mybatis.order.CommonOrderMapper;
import com.yeshi.fanli.dao.mybatis.order.CommonOrderTradeIdMapMapper;
import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanOrderMapper;
import com.yeshi.fanli.dto.order.CommonOrderAddResultDTO;
import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
@@ -728,8 +729,9 @@
    @Transactional
    @Override
    public List<CommonOrder> addTaoBaoOrder(List<TaoBaoOrder> taoBaoOrders, Long uid) throws CommonOrderException {
        List<CommonOrder> commonOrderList = new ArrayList<>();
    public List<CommonOrderAddResultDTO> addTaoBaoOrder(List<TaoBaoOrder> taoBaoOrders, Long uid)
            throws CommonOrderException {
        List<CommonOrderAddResultDTO> commonOrderList = new ArrayList<>();
        // 判断所有的订单状态
        int invalidCount = 0;
        for (TaoBaoOrder tb : taoBaoOrders) {
@@ -789,8 +791,9 @@
    @Transactional
    @Override
    public List<CommonOrder> addPDDOrder(List<PDDOrder> pddOrderList, Long uid) throws CommonOrderException {
        List<CommonOrder> commonOrderList = new ArrayList<>();
    public List<CommonOrderAddResultDTO> addPDDOrder(List<PDDOrder> pddOrderList, Long uid)
            throws CommonOrderException {
        List<CommonOrderAddResultDTO> commonOrderList = new ArrayList<>();
        // 判断所有的订单状态
        int invalidCount = 0;
        for (PDDOrder order : pddOrderList) {
@@ -838,8 +841,8 @@
    @Transactional
    @Override
    public List<CommonOrder> addJDOrder(JDOrder jdOrder, Long uid) throws CommonOrderException {
        List<CommonOrder> commonOrderList = new ArrayList<>();
    public List<CommonOrderAddResultDTO> addJDOrder(JDOrder jdOrder, Long uid) throws CommonOrderException {
        List<CommonOrderAddResultDTO> commonOrderList = new ArrayList<>();
        // 判断所有的订单状态
        int invalidCount = 0;
        for (JDOrderItem tb : jdOrder.getOrderItemList()) {
@@ -907,7 +910,7 @@
     * @param commonOrder
     */
    @Transactional
    private CommonOrder addCommonOrder(CommonOrder commonOrder) throws CommonOrderException {
    private CommonOrderAddResultDTO addCommonOrder(CommonOrder commonOrder) throws CommonOrderException {
        // 判断商品是否存在
        if (commonOrder == null)
            throw new CommonOrderException(1, "订单为空");
@@ -950,13 +953,13 @@
            // 插入映射,保证交易ID的完整性
            commonOrderTradeIdMapMapper.insertSelective(new CommonOrderTradeIdMap(commonOrder.getId(),
                    commonOrder.getTradeId(), new Date(), commonOrder.getSourceType()));
            return commonOrder;
            return new CommonOrderAddResultDTO(commonOrder, CommonOrderAddResultDTO.TYPE_ADD);
        } else {// 修改
            // 已经结算,已经失效,状态未改变的订单不处理
            if (oldCommonOrder.getState() == CommonOrder.STATE_JS || oldCommonOrder.getState() == CommonOrder.STATE_SX
                    || oldCommonOrder.getState() == CommonOrder.STATE_WQ
                    || (oldCommonOrder.getState().intValue() == commonOrder.getState())) {
                return oldCommonOrder;
                return new CommonOrderAddResultDTO(oldCommonOrder, CommonOrderAddResultDTO.TYPE_NOUPDATE);
            }
            // 交易ID一致才修改
            if (commonOrder.getTradeId() != null
@@ -972,9 +975,10 @@
                updateCommonOrder.setUpdateTime(new Date());
                updateCommonOrder.setTradeId(commonOrder.getTradeId());
                commonOrderMapper.updateByPrimaryKeySelective(updateCommonOrder);
                return commonOrderMapper.selectByPrimaryKey(updateCommonOrder.getId());
                return new CommonOrderAddResultDTO(commonOrderMapper.selectByPrimaryKey(updateCommonOrder.getId()),
                        CommonOrderAddResultDTO.TYPE_UPDATE);
            } else
                return oldCommonOrder;
                return new CommonOrderAddResultDTO(oldCommonOrder, CommonOrderAddResultDTO.TYPE_NOUPDATE);
        }
    }
@@ -1451,4 +1455,15 @@
        return commonOrderMapper.getByOrderNo(uid, orderNO);
    }
    @Override
    public CommonOrder selectLatestValidByUid(Long uid) {
        List<Integer> stateList = new ArrayList<>();
        stateList.add(CommonOrder.STATE_FK);
        stateList.add(CommonOrder.STATE_JS);
        List<CommonOrder> commonOrderList = commonOrderMapper.listByUid(uid, stateList, 0, 1);
        if (commonOrderList == null || commonOrderList.size() == 0)
            return null;
        return commonOrderList.get(0);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java
@@ -26,6 +26,7 @@
import com.yeshi.fanli.dao.mybatis.order.OrderMapper;
import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanOrderMapper;
import com.yeshi.fanli.dto.HongBao;
import com.yeshi.fanli.dto.order.CommonOrderAddResultDTO;
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
import com.yeshi.fanli.entity.bus.user.Order;
import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
@@ -49,10 +50,12 @@
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.hongbao.AccountDetailsHongBaoMapService;
import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
import com.yeshi.fanli.service.inter.jd.JDOrderService;
import com.yeshi.fanli.service.inter.msg.UserMoneyMsgNotificationService;
import com.yeshi.fanli.service.inter.order.CommonOrderService;
import com.yeshi.fanli.service.inter.order.LostOrderService;
import com.yeshi.fanli.service.inter.order.OrderProcessService;
import com.yeshi.fanli.service.inter.pdd.PDDOrderService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoBuyRelationMapService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoOrderService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
@@ -67,6 +70,7 @@
import com.yeshi.fanli.util.TaoBaoConstant;
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.util.cmq.HongBaoRecieveCMQManager;
import com.yeshi.fanli.util.cmq.PlaceOrderCMQManager;
import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
import com.yeshi.fanli.util.jd.JDApiUtil;
import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
@@ -125,6 +129,43 @@
    @Resource
    private HongBaoV2Service hongBaoV2Service;
    @Resource
    private JDOrderService jdOrderService;
    @Resource
    private PDDOrderService pddOrderService;
    /**
     * 是否是分享订单
     *
     * @param order
     * @return
     */
    private boolean isShareOrder(TaoBaoOrder order) {
        List<TaoBaoUnionConfig> configList = taoBaoUnionConfigService.getConfigByTypeCache(PidUser.TYPE_FANLI_ANDROID);
        String pid = String.format("mm_%s_%s_%s", configList.get(0).getAccountId(), order.getSourceMediaId(),
                order.getAdPositionId());
        if (!StringUtil.isNullOrEmpty(order.getSpecialId())
                || pid.equalsIgnoreCase(TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID)) {// 设置渠道ID当做会员运营ID的位置ID
            return false;
        } else if (!StringUtil.isNullOrEmpty(order.getRelationId())) {
            return true;
        } else {
            // 通过红包查询
            CommonOrder commonOrder = commonOrderService.selectBySourceTypeAndTradeId(Constant.SOURCE_TYPE_TAOBAO,
                    order.getTradeId());
            if (commonOrder != null) {
                HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(commonOrder.getId());
                if (hongBaoOrder != null && hongBaoOrder.getHongBaoV2() != null
                        && hongBaoOrder.getHongBaoV2().getType() == HongBaoV2.TYPE_SHARE_GOODS) {
                    return true;
                }
            }
            return false;
        }
    }
    @Override
    public synchronized void processOrder(Map<String, List<TaoBaoOrder>> orders) {
@@ -947,11 +988,21 @@
            orderMapper.updateByPrimaryKeySelective(updateOrder);
            // 用第一个子订单锁定用户
            List<CommonOrder> commonOrderList = null;
            List<CommonOrderAddResultDTO> commonOrderList = null;
            try {
                commonOrderList = commonOrderService.addTaoBaoOrder(orderList, uid);
                hongBaoV2Service.addHongBao(commonOrderList, HongBaoV2.TYPE_ZIGOU);
                hongBaoV2Service.addHongBao(convertCommonOrder(commonOrderList), HongBaoV2.TYPE_ZIGOU);
                if (isCommonOrderAllAdd(commonOrderList)) {
                    Order order = new Order();
                    order.setOrderId(orderId);
                    order.setOrderType(Constant.SOURCE_TYPE_TAOBAO);
                    order.setUserInfo(new UserInfo(uid));
                    try {
                        PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order);
                    } catch (Exception e) {
                    }
                }
            } catch (CommonOrderException e) {
                try {
                    LogHelper.errorDetailInfo(e, "addTaoBaoOrder或addHongBao出错", "订单号:" + orderId);
@@ -999,14 +1050,40 @@
            // 用第一个子订单锁定用户
            try {
                List<CommonOrder> commonOrders = commonOrderService.addTaoBaoOrder(orderList, uid);
                hongBaoV2Service.addHongBao(commonOrders, HongBaoV2.TYPE_SHARE_GOODS);
                List<CommonOrderAddResultDTO> commonOrders = commonOrderService.addTaoBaoOrder(orderList, uid);
                hongBaoV2Service.addHongBao(convertCommonOrder(commonOrders), HongBaoV2.TYPE_SHARE_GOODS);
                if (isCommonOrderAllAdd(commonOrders)) {
                    Order order = new Order();
                    order.setOrderId(orderId);
                    order.setOrderType(Constant.SOURCE_TYPE_TAOBAO);
                    order.setUserInfo(new UserInfo(uid));
                    try {
                        PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order);
                    } catch (Exception e) {
                    }
                }
            } catch (CommonOrderException e) {
                e.printStackTrace();
            } catch (HongBaoException e1) {
                e1.printStackTrace();
            }
        }
    }
    /**
     * 是否为分享订单
     *
     * @param order
     * @return
     */
    private boolean isShareOrder(JDOrder order) {
        if (order == null || order.getOrderItemList() == null || order.getOrderItemList().size() == 0)
            return false;
        Long positionId = order.getOrderItemList().get(0).getPositionId();
        if (positionId == JDApiUtil.POSITION_SHARE) {// 分享订单
            return true;
        }
        return false;
    }
    @Override
@@ -1092,8 +1169,18 @@
        }
        try {
            List<CommonOrder> commonOrderList = commonOrderService.addJDOrder(jdOrder, uid);
            hongBaoV2Service.addHongBao(commonOrderList, HongBaoV2.TYPE_ZIGOU);
            List<CommonOrderAddResultDTO> commonOrderList = commonOrderService.addJDOrder(jdOrder, uid);
            hongBaoV2Service.addHongBao(convertCommonOrder(commonOrderList), HongBaoV2.TYPE_ZIGOU);
            if (isCommonOrderAllAdd(commonOrderList)) {
                Order order = new Order();
                order.setOrderId(jdOrder.getOrderId() + "");
                order.setOrderType(Constant.SOURCE_TYPE_TAOBAO);
                order.setUserInfo(new UserInfo(uid));
                try {
                    PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order);
                } catch (Exception e) {
                }
            }
        } catch (CommonOrderException e) {
            try {
                LogHelper.errorDetailInfo(e, "addJDOrder或addHongBao出错", "订单号:" + jdOrder.getOrderId());
@@ -1116,23 +1203,47 @@
     * @param uid
     */
    @Transactional
    private void processShareJDOrder(JDOrder order, Long uid) {
    private void processShareJDOrder(JDOrder jdOrder, Long uid) {
        try {
            List<CommonOrder> commonOrderList = commonOrderService.addJDOrder(order, uid);
            hongBaoV2Service.addHongBao(commonOrderList, HongBaoV2.TYPE_SHARE_GOODS);
            List<CommonOrderAddResultDTO> commonOrderList = commonOrderService.addJDOrder(jdOrder, uid);
            hongBaoV2Service.addHongBao(convertCommonOrder(commonOrderList), HongBaoV2.TYPE_SHARE_GOODS);
            if (isCommonOrderAllAdd(commonOrderList)) {
                Order order = new Order();
                order.setOrderId(jdOrder.getOrderId() + "");
                order.setOrderType(Constant.SOURCE_TYPE_TAOBAO);
                order.setUserInfo(new UserInfo(uid));
                try {
                    PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order);
                } catch (Exception e) {
                }
            }
        } catch (CommonOrderException e) {
            try {
                LogHelper.errorDetailInfo(e, "addJDOrder或addHongBao出错", "订单号:" + order.getOrderId());
                LogHelper.errorDetailInfo(e, "addJDOrder或addHongBao出错", "订单号:" + jdOrder.getOrderId());
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        } catch (HongBaoException e) {
            try {
                LogHelper.errorDetailInfo(e, "addJDOrder或addHongBao出错", "订单号:" + order.getOrderId());
                LogHelper.errorDetailInfo(e, "addJDOrder或addHongBao出错", "订单号:" + jdOrder.getOrderId());
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        }
    }
    /**
     * 是否是分享赚订单
     *
     * @param order
     * @return
     */
    private boolean isShareOrder(PDDOrder pddOrder) {
        String positionId = pddOrder.getpId();
        if (PinDuoDuoApiUtil.PID_SHARE.equalsIgnoreCase(positionId))
            return true;
        else
            return false;
    }
    /**
@@ -1208,8 +1319,18 @@
        try {
            List<PDDOrder> pddOrderList = new ArrayList<>();
            pddOrderList.add(pddOrder);
            List<CommonOrder> commonOrderList = commonOrderService.addPDDOrder(pddOrderList, uid);
            hongBaoV2Service.addHongBao(commonOrderList, HongBaoV2.TYPE_ZIGOU);
            List<CommonOrderAddResultDTO> commonOrderList = commonOrderService.addPDDOrder(pddOrderList, uid);
            hongBaoV2Service.addHongBao(convertCommonOrder(commonOrderList), HongBaoV2.TYPE_ZIGOU);
            if (isCommonOrderAllAdd(commonOrderList)) {
                Order order = new Order();
                order.setOrderId(pddOrder.getOrderSn());
                order.setOrderType(Constant.SOURCE_TYPE_TAOBAO);
                order.setUserInfo(new UserInfo(uid));
                try {
                    PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order);
                } catch (Exception e) {
                }
            }
        } catch (CommonOrderException e) {
            try {
                LogHelper.errorDetailInfo(e, "addPDDOrder或addHongBao出错", "订单号:" + pddOrder.getOrderSn());
@@ -1232,21 +1353,31 @@
     * @param uid
     */
    @Transactional
    private void processSharePDDOrder(PDDOrder order, Long uid) {
    private void processSharePDDOrder(PDDOrder pddOrder, Long uid) {
        try {
            List<PDDOrder> pddOrderList = new ArrayList<>();
            pddOrderList.add(order);
            List<CommonOrder> commonOrderList = commonOrderService.addPDDOrder(pddOrderList, uid);
            hongBaoV2Service.addHongBao(commonOrderList, HongBaoV2.TYPE_SHARE_GOODS);
            pddOrderList.add(pddOrder);
            List<CommonOrderAddResultDTO> commonOrderList = commonOrderService.addPDDOrder(pddOrderList, uid);
            hongBaoV2Service.addHongBao(convertCommonOrder(commonOrderList), HongBaoV2.TYPE_SHARE_GOODS);
            if (isCommonOrderAllAdd(commonOrderList)) {
                Order order = new Order();
                order.setOrderId(pddOrder.getOrderSn());
                order.setOrderType(Constant.SOURCE_TYPE_TAOBAO);
                order.setUserInfo(new UserInfo(uid));
                try {
                    PlaceOrderCMQManager.getInstance().addPlaceOrderMsg(order);
                } catch (Exception e) {
                }
            }
        } catch (CommonOrderException e) {
            try {
                LogHelper.errorDetailInfo(e, "addJDOrder或addHongBao出错", "订单号:" + order.getOrderId());
                LogHelper.errorDetailInfo(e, "addJDOrder或addHongBao出错", "订单号:" + pddOrder.getOrderId());
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        } catch (HongBaoException e) {
            try {
                LogHelper.errorDetailInfo(e, "addJDOrder或addHongBao出错", "订单号:" + order.getOrderId());
                LogHelper.errorDetailInfo(e, "addJDOrder或addHongBao出错", "订单号:" + pddOrder.getOrderId());
            } catch (Exception e1) {
                e1.printStackTrace();
            }
@@ -1272,4 +1403,53 @@
            }
    }
    @Override
    public boolean isShareOrder(CommonOrder commonOrder) {
        switch (commonOrder.getSourceType()) {
        case Constant.SOURCE_TYPE_TAOBAO:
            return isShareOrder(taoBaoOrderService.selectByTradeId(commonOrder.getTradeId()));
        case Constant.SOURCE_TYPE_JD:
            return isShareOrder(jdOrderService.selectDetailByOrderId(Long.parseLong(commonOrder.getOrderNo())));
        case Constant.SOURCE_TYPE_PDD:
            return isShareOrder(pddOrderService.selectByOrderSn(commonOrder.getOrderNo()).get(0));
        }
        return false;
    }
    /**
     * 转为普通订单
     *
     * @param dtoList
     * @return
     */
    private List<CommonOrder> convertCommonOrder(List<CommonOrderAddResultDTO> dtoList) {
        List<CommonOrder> commonOrderList = new ArrayList<>();
        if (dtoList != null)
            for (CommonOrderAddResultDTO dto : dtoList)
                commonOrderList.add(dto.getCommonOrder());
        return commonOrderList;
    }
    /**
     * 是否全是增加
     *
     * @param list
     * @return
     */
    private boolean isCommonOrderAllAdd(List<CommonOrderAddResultDTO> list) {
        if (list == null || list.size() == 0)
            return false;
        int addCount = 0;
        if (list != null)
            for (CommonOrderAddResultDTO dto : list) {
                if (dto.getType() == CommonOrderAddResultDTO.TYPE_ADD)
                    addCount++;
            }
        if (addCount == list.size())
            return true;
        else
            return false;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/pdd/PDDOrderProcessServiceImpl.java
File was deleted
fanli/src/main/java/com/yeshi/fanli/service/impl/user/ExtractServiceImpl.java
@@ -720,4 +720,16 @@
    public BigDecimal sumTodayApplyMoney(Long uid,String day) {
        return extractMapper.sumToadyApplyByUid(uid,day);
    }
    @Override
    public BigDecimal sumVerifyingMoney(Long uid) {
        List<Integer> stateList=new ArrayList<>();
        stateList.add(Extract.STATE_NOT_PROCESS);
        stateList.add(Extract.STATE_PROCESSING);
        BigDecimal money= extractMapper.sumMoneyByUidAndState(uid, stateList);
        if(money==null)
            return new BigDecimal(0);
        else
            return money;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/jd/JDOrderProcessService.java
File was deleted
fanli/src/main/java/com/yeshi/fanli/service/inter/order/CommonOrderService.java
@@ -5,6 +5,7 @@
import java.util.List;
import java.util.Map;
import com.yeshi.fanli.dto.order.CommonOrderAddResultDTO;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.jd.JDOrder;
import com.yeshi.fanli.entity.order.CommonOrder;
@@ -76,8 +77,9 @@
     *            到账状态
     * @return
     */
    public List<CommonOrderVO> getOrderByUid(AcceptData acceptData, Integer page, Long uid, Integer state, Integer type, Integer orderState,
            String orderNo, String startTime, String endTime, Integer dateType, Integer source) throws CommonOrderException;
    public List<CommonOrderVO> getOrderByUid(AcceptData acceptData, Integer page, Long uid, Integer state, Integer type,
            Integer orderState, String orderNo, String startTime, String endTime, Integer dateType, Integer source)
            throws CommonOrderException;
    /**
     * 统计订单-根据红包类型 自购 邀请 分享
@@ -93,7 +95,8 @@
     * @param uid
     * @return
     */
    public long countBonusOrderNumber(Long uid, Integer type, Integer isToday, String startTime, String endTime, Integer source);
    public long countBonusOrderNumber(Long uid, Integer type, Integer isToday, String startTime, String endTime,
            Integer source);
    /**
     * 统计订单
@@ -101,7 +104,8 @@
     * @param uid
     * @return
     */
    public BigDecimal countBonusOrderMoney(Long uid, Integer type, Integer isToday, String startTime, String endTime, Integer source);
    public BigDecimal countBonusOrderMoney(Long uid, Integer type, Integer isToday, String startTime, String endTime,
            Integer source);
    /**
     * 统计奖金订单数量、金额
@@ -145,7 +149,7 @@
     * @return
     * @throws CommonOrderException
     */
    public List<CommonOrder> addTaoBaoOrder(List<TaoBaoOrder> taoBaoOrder, Long uid) throws CommonOrderException;
    public List<CommonOrderAddResultDTO> addTaoBaoOrder(List<TaoBaoOrder> taoBaoOrder, Long uid) throws CommonOrderException;
    /**
     * 缓存拼多多类普通订单
@@ -155,7 +159,7 @@
     * @return
     * @throws CommonOrderException
     */
    public List<CommonOrder> addPDDOrder(List<PDDOrder> pddOrderList, Long uid) throws CommonOrderException;
    public List<CommonOrderAddResultDTO> addPDDOrder(List<PDDOrder> pddOrderList, Long uid) throws CommonOrderException;
    /**
     * 缓存京东普通订单
@@ -165,7 +169,7 @@
     * @return
     * @throws CommonOrderException
     */
    public List<CommonOrder> addJDOrder(JDOrder jdOrder, Long uid) throws CommonOrderException;
    public List<CommonOrderAddResultDTO> addJDOrder(JDOrder jdOrder, Long uid) throws CommonOrderException;
    /**
     * 根据用户ID,订单状态,结算时间统计订单数量
@@ -219,10 +223,12 @@
     */
    public List<CommonOrderVO> listQuery(long start, int count, Integer keyType, String key, Integer state,
            Integer type, Integer orderState, String startTime, String endTime, Integer source) throws CommonOrderException;
            Integer type, Integer orderState, String startTime, String endTime, Integer source)
            throws CommonOrderException;
    public long countQuery(Integer keyType, String key, Integer state, Integer type, Integer orderState,
            String startTime, String endTime, Integer source) throws CommonOrderException;
    /**
     * 查询订单
     * 
@@ -282,11 +288,20 @@
            Long maxTime, int page, int pageSize);
    /**
     * 查询订单  -根据订单号
     * 查询订单 -根据订单号
     *
     * @param uid
     * @param orderNO
     * @return
     */
    public List<CommonOrder> getByOrderNo(Long uid, String orderNO);
    /**
     * 根据用户ID查询最近一条有效的订单
     *
     * @param uid
     * @return
     */
    public CommonOrder selectLatestValidByUid(Long uid);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/order/OrderProcessService.java
@@ -5,6 +5,7 @@
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
import com.yeshi.fanli.entity.jd.JDOrder;
import com.yeshi.fanli.entity.order.CommonOrder;
import com.yeshi.fanli.entity.pdd.PDDOrder;
import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
@@ -97,15 +98,24 @@
    /**
     * 处理拼多多订单
     *
     * @param pddOrder
     */
    public void processPDDOrder(PDDOrder pddOrder);
    /**
     * 根据淘宝订单的排序值修复常规订单的排序值
     *
     * @param orderId
     */
    public void repairCommonOrderByByTaoBaoOrder(String orderId);
    /**
     * 是否是分享赚订单
     *
     * @param commonOrder
     * @return
     */
    public boolean isShareOrder(CommonOrder commonOrder);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/pdd/PDDOrderProcessService.java
File was deleted
fanli/src/main/java/com/yeshi/fanli/service/inter/user/ExtractService.java
@@ -96,5 +96,13 @@
     * @return
     */
    public BigDecimal sumTodayApplyMoney(Long uid, String day);
    /**
     * 统计正在审核中的金额
     * @param uid
     * @return
     */
    public BigDecimal sumVerifyingMoney(Long uid);
}
fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java
@@ -20,8 +20,12 @@
import com.yeshi.fanli.dto.money.UserMoneyChangeDTO;
import com.yeshi.fanli.entity.bus.user.AlipayTransferResultInfo;
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
import com.yeshi.fanli.entity.bus.user.Order;
import com.yeshi.fanli.entity.bus.user.ThreeSale;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.jd.JDOrder;
import com.yeshi.fanli.entity.order.CommonOrder;
import com.yeshi.fanli.entity.order.HongBaoOrder;
import com.yeshi.fanli.entity.pdd.PDDOrder;
import com.yeshi.fanli.entity.push.PushQueueRecord;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
@@ -32,10 +36,13 @@
import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
import com.yeshi.fanli.service.inter.integral.IntegralGetService;
import com.yeshi.fanli.service.inter.integral.IntegralTaskRecordService;
import com.yeshi.fanli.service.inter.jd.JDOrderService;
import com.yeshi.fanli.service.inter.lable.BoutiqueAutoRuleService;
import com.yeshi.fanli.service.inter.lable.LabelService;
import com.yeshi.fanli.service.inter.money.UserMoneyDebtService;
import com.yeshi.fanli.service.inter.order.CommonOrderService;
import com.yeshi.fanli.service.inter.order.HongBaoOrderService;
import com.yeshi.fanli.service.inter.order.OrderProcessService;
import com.yeshi.fanli.service.inter.pdd.PDDOrderService;
import com.yeshi.fanli.service.inter.push.IOSPushService;
@@ -47,6 +54,7 @@
import com.yeshi.fanli.util.cmq.HongBaoRecieveCMQManager;
import com.yeshi.fanli.util.cmq.JDOrderCMQManager;
import com.yeshi.fanli.util.cmq.PDDOrderCMQManager;
import com.yeshi.fanli.util.cmq.PlaceOrderCMQManager;
import com.yeshi.fanli.util.cmq.ThreeSaleCMQManager;
import com.yeshi.fanli.util.cmq.UserMoneyChangeCMQManager;
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
@@ -111,6 +119,15 @@
    @Resource
    private IntegralGetService integralGetService;
    @Resource
    private CommonOrderService commonOrderService;
    @Resource
    private HongBaoOrderService hongBaoOrderService;
    @Resource
    private IntegralTaskRecordService integralTaskRecordService;
    private static boolean isInited = false;
    public void onApplicationEvent(ContextRefreshedEvent arg0) {
@@ -146,6 +163,7 @@
            doPDDOrderJob();// 拼多多订单处理
            doImportantTaoBaoGoodsUpdateJob();// 淘宝重要商品的信息更新
            doHongBaoRecieveIntegralGetJob();// 返利到账,金币增加
            doPlaceOrderIntegralJob();// 下单赠送金币任务
        }
    }
@@ -743,7 +761,136 @@
                }
            }
        });
    }
    private boolean isFirstValidOrder(String orderId, int sourceType, Long uid) {
        CommonOrder commonOrder = commonOrderService.selectLatestValidByUid(uid);
        if (commonOrder != null && commonOrder.getOrderNo().equalsIgnoreCase(orderId)
                && sourceType == commonOrder.getSourceType())
            return true;
        else
            return false;
    }
    // 下单获取金币任务
    public void doPlaceOrderIntegralJob() {
        executor.execute(new Runnable() {
            @Override
            public void run() {
                while (true) {
                    Map<String, Order> map = PlaceOrderCMQManager.getInstance()
                            .consumeQueueMsg(PlaceOrderCMQManager.QUEUE_INTEGRAL, 16);
                    if (map != null) {
                        // 是否是首单
                        for (Iterator<String> its = map.keySet().iterator(); its.hasNext();) {
                            try {
                                String key = its.next();
                                Order order = map.get(key);
                                // 统计订单下的用户所获得的返利金额
                                List<CommonOrder> list = commonOrderService
                                        .listBySourceTypeAndOrderId(order.getOrderType(), order.getOrderId());
                                Map<Long, BigDecimal> hongBaoMoney = new HashMap<>();
                                if (list != null)
                                    for (CommonOrder commonOrder : list) {
                                        HongBaoOrder hongBaoOrder = hongBaoOrderService
                                                .selectDetailByCommonOrderId(commonOrder.getId());
                                        if (hongBaoOrder != null && hongBaoOrder.getHongBaoV2() != null) {
                                            Long mainUid = hongBaoOrder.getHongBaoV2().getUserInfo().getId();
                                            if (hongBaoMoney.get(mainUid) == null)
                                                hongBaoMoney.put(mainUid, new BigDecimal(0));
                                            hongBaoMoney.put(mainUid, hongBaoMoney.get(mainUid)
                                                    .add(hongBaoOrder.getHongBaoV2().getMoney()));
                                            // 查询上级
                                            List<HongBaoV2> children = hongBaoV2Service
                                                    .listChildrenById(hongBaoOrder.getHongBaoV2().getId());
                                            if (children != null) {
                                                for (HongBaoV2 hongBao : children) {
                                                    Long uid = hongBao.getUserInfo().getId();
                                                    if (hongBaoMoney.get(uid) == null)
                                                        hongBaoMoney.put(uid, new BigDecimal(0));
                                                    hongBaoMoney.put(uid,
                                                            hongBaoMoney.get(uid).add(hongBao.getMoney()));
                                                }
                                            }
                                        }
                                    }
                                if (isFirstValidOrder(order.getOrderId(), order.getOrderType(),
                                        order.getUserInfo().getId())) {// 有效的首单
                                    if (hongBaoMoney.get(order.getUserInfo().getId()) == null || hongBaoMoney
                                            .get(order.getUserInfo().getId()).compareTo(new BigDecimal("0")) <= 0) {
                                        // 分享奖金是0
                                        integralTaskRecordService.firstShareOrderReward(order.getUserInfo().getId(),
                                                null);
                                    }
                                    // 获取上两级数据
                                    UserInfo boss = threeSaleSerivce.getBoss(order.getUserInfo().getId());
                                    if (boss != null) {// 判断上级的红包
                                        if (hongBaoMoney.get(boss.getId()) == null
                                                || hongBaoMoney.get(boss.getId()).compareTo(new BigDecimal("0")) <= 0) {
                                            // 补偿金币
                                            integralTaskRecordService.firstSharerOrderRewardBoss(boss.getId(),
                                                    order.getUserInfo().getId(), null);
                                        }
                                    }
                                } else {// 自购订单
                                    UserInfo boss = threeSaleSerivce.getBoss(order.getUserInfo().getId());
                                    if (boss != null) {// 判断上级的红包
                                        if (hongBaoMoney.get(boss.getId()) == null
                                                || hongBaoMoney.get(boss.getId()).compareTo(new BigDecimal("0")) <= 0) {
                                            // 补偿金币1级
                                            integralTaskRecordService.firstRebateOrderRewardBoss(boss.getId(),
                                                    order.getUserInfo().getId(), null);
                                        }
                                    }
                                    boss = threeSaleSerivce.getBoss(boss.getId());
                                    if (boss != null) {// 判断上级的红包
                                        if (hongBaoMoney.get(boss.getId()) == null
                                                || hongBaoMoney.get(boss.getId()).compareTo(new BigDecimal("0")) <= 0) {
                                            // 补偿金币2级
                                            integralTaskRecordService.firstRebateOrderRewardBossSuper(boss.getId(),
                                                    order.getUserInfo().getId(), null);
                                        }
                                    }
                                }
                                PlaceOrderCMQManager.getInstance().deleteQueueMsg(PlaceOrderCMQManager.QUEUE_INTEGRAL,
                                        key);
                            } catch (Exception e) {
                                LogHelper.errorDetailInfo(e);
                            }
                        }
                    }
                }
            }
        });
    }
    // 抖音广告监控
    public void doPlaceOrderAdJob() {
        executor.execute(new Runnable() {
            @Override
            public void run() {
                while (true) {
                    Map<String, Order> map = PlaceOrderCMQManager.getInstance()
                            .consumeQueueMsg(PlaceOrderCMQManager.QUEUE_AD, 16);
                    if (map != null) {
                        // 是否是首单
                        for (Iterator<String> its = map.keySet().iterator(); its.hasNext();) {
                            String key = its.next();
                            Order order = map.get(key);
                            if (isFirstValidOrder(order.getOrderId(), order.getOrderType(),
                                    order.getUserInfo().getId())) {// 有效的首单
                                // TODO 抖音的数据回调
                            }
                        }
                    }
                }
            }
        });
    }
}
fanli/src/main/java/com/yeshi/fanli/util/cmq/PlaceOrderCMQManager.java
New file
@@ -0,0 +1,92 @@
package com.yeshi.fanli.util.cmq;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.yeshi.utils.CMQUtil;
import com.google.gson.Gson;
import com.qcloud.cmq.Message;
import com.yeshi.fanli.entity.bus.user.Order;
import com.yeshi.fanli.entity.order.CommonOrder;
public class PlaceOrderCMQManager {
    private static String secretId = "AKIDTlpgJhLjOozvd6QI2XnpfGbgV4NQJk25";
    private static String secretKey = "xhCSUHo55oHUQ6XicFcmfIgspX0EEzWo";
    private static PlaceOrderCMQManager placeOrderCMQManager;
    private static CMQUtil cmqUtil;
    private final static String TOPIC_NAME = "topic_place_order";
    public static String QUEUE_AD = TOPIC_NAME + "_" + "ad";
    public static String QUEUE_INTEGRAL = TOPIC_NAME + "_" + "integral";
    public static String SUBSCRIBE_AD = "ad";
    public static String SUBSCRIBE_INTEGRAL = "integral";
    static {
        cmqUtil = CMQUtil.getInstance(secretId, secretKey);
        // 创建主题,添加订阅
        cmqUtil.createTopic(TOPIC_NAME);
        // 用户券订阅
        String[] subscripts = new String[] { SUBSCRIBE_AD, SUBSCRIBE_INTEGRAL };
        String[] queues = new String[] { QUEUE_AD, QUEUE_INTEGRAL };
        for (int i = 0; i < subscripts.length; i++) {
            String queueName = queues[i];
            try {
                cmqUtil.createQueue(queueName);
            } catch (Exception e) {
            }
            try {
                cmqUtil.subscribeTopic(TOPIC_NAME, subscripts[i], queueName);
            } catch (Exception e) {
            }
        }
    }
    public static PlaceOrderCMQManager getInstance() {
        if (placeOrderCMQManager == null)
            placeOrderCMQManager = new PlaceOrderCMQManager();
        return placeOrderCMQManager;
    }
    /**
     * 下单
     *
     * @param order(只需要订单号与sourceType)
     */
    public void addPlaceOrderMsg(Order order) {
        if (order == null)
            return;
        cmqUtil.publishTopicMessage(TOPIC_NAME, new Gson().toJson(order));
    }
    /**
     * 消费队列消息
     *
     * @param queueName
     * @param count
     * @return
     */
    public Map<String, Order> consumeQueueMsg(String queueName, int count) {
        List<Message> list = cmqUtil.recieveMsg(count, queueName);
        Map<String, Order> map = new HashMap<>();
        if (list != null)
            for (Message msg : list) {
                String result = msg.msgBody;
                Order dto = new Gson().fromJson(result, Order.class);
                map.put(msg.receiptHandle, dto);
            }
        return map;
    }
    public void deleteQueueMsg(String queueName, String receiptHandle) {
        cmqUtil.deleteMsg(queueName, receiptHandle);
    }
}
fanli/src/main/java/com/yeshi/fanli/util/factory/goods/GoodsDetailVOFactory.java
@@ -160,7 +160,7 @@
        goodsInfo.setMoneyInfo(moneyInfoVO);
        // 券信息
        if (goods.getCouponAmount().compareTo(BigDecimal.valueOf(0)) > 0) {
        if (goods.getCouponAmount()!=null&&goods.getCouponAmount().compareTo(BigDecimal.valueOf(0)) > 0) {
            // 计算券后价
            BigDecimal sub = goods.getPrice().subtract(goods.getCouponStartPrice());
            if (sub.compareTo(BigDecimal.valueOf(0)) >= 0) {
fanli/src/main/java/com/yeshi/fanli/vo/money/UserMoneyStatisticVO.java
@@ -14,6 +14,43 @@
    private BigDecimal totalInviteMoney;// 累计邀请奖金
    private BigDecimal monthUnRecievedMoney;// 本月未到账
    private BigDecimal totalUnRecievedMoney; // 全部未到账
    private String extractingMoneyInfo;//提现中的资金信息
    private boolean bindingWX;//是否绑定了微信
    private boolean autoExtract;//是否自动提现
    private String autoExtractHelpUrl;//自动提现帮助链接
    public String getAutoExtractHelpUrl() {
        return autoExtractHelpUrl;
    }
    public void setAutoExtractHelpUrl(String autoExtractHelpUrl) {
        this.autoExtractHelpUrl = autoExtractHelpUrl;
    }
    public String getExtractingMoneyInfo() {
        return extractingMoneyInfo;
    }
    public void setExtractingMoneyInfo(String extractingMoneyInfo) {
        this.extractingMoneyInfo = extractingMoneyInfo;
    }
    public boolean isBindingWX() {
        return bindingWX;
    }
    public void setBindingWX(boolean bindingWX) {
        this.bindingWX = bindingWX;
    }
    public boolean isAutoExtract() {
        return autoExtract;
    }
    public void setAutoExtract(boolean autoExtract) {
        this.autoExtract = autoExtract;
    }
    public BigDecimal getMonthUnRecievedMoney() {
        return monthUnRecievedMoney;