| | |
| | | private Date updateTime;
|
| | |
|
| | | private Integer state;//老版明细适用该字段
|
| | | |
| | | @Column(name = "umd_show")
|
| | | private Boolean show;//是否显示
|
| | |
|
| | | public Boolean getShow() {
|
| | | return show;
|
| | | }
|
| | |
|
| | | public void setShow(Boolean show) {
|
| | | this.show = show;
|
| | | }
|
| | |
|
| | | public Integer getState() {
|
| | | return state;
|
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.money.UserMoneyDetailMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.money.UserMoneyDetail"> |
| | | <id column="umd_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="umd_money" property="money" jdbcType="DECIMAL" /> |
| | | <result column="umd_type" property="type" |
| | | typeHandler="com.yeshi.fanli.util.mybatishandler.UserMoneyDetailTypeEnumHandler" /> |
| | | <result column="umd_title" property="title" jdbcType="VARCHAR" /> |
| | | <result column="umd_sub_title" property="subTitle" jdbcType="VARCHAR" /> |
| | | <result column="umd_desc_info" property="descInfo" jdbcType="VARCHAR" /> |
| | | <result column="umd_source_identify_id" property="sourceIdentifyId" |
| | | jdbcType="BIGINT" /> |
| | | <result column="umd_identify_code" property="identifyCode" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="umd_beizhu" property="beiZhu" jdbcType="VARCHAR" /> |
| | | <result column="umd_createtime" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="umd_updatetime" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | <!-- 老版明细适用该字段 --> |
| | | <result column="state" property="state" jdbcType="INTEGER" /> |
| | | <result column="umd_order_type" property="orderType" jdbcType="INTEGER" /> |
| | | <association property="userInfo" column="umd_uid" |
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | | <id column="umd_uid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | </resultMap> |
| | | <resultMap id="UserMonthMoneyMap" type="com.yeshi.fanli.vo.money.UserMonthMoneyVO"> |
| | | <result column="expend" property="expend" jdbcType="DECIMAL" /> |
| | | <result column="income" property="income" jdbcType="DECIMAL" /> |
| | | <result column="dateFormate" property="dateFormate" jdbcType="VARCHAR" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">umd_id,umd_uid,umd_money,umd_type,umd_title,umd_sub_title,umd_desc_info,umd_source_identify_id,umd_identify_code,umd_beizhu,umd_createtime,umd_updatetime,umd_order_type |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user_money_detail where umd_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <select id="selectByUidWithIndexId" resultMap="BaseResultMap"> |
| | | SELECT |
| | | <include refid="Base_Column_List" /> |
| | | FROM yeshi_ec_user_money_detail d WHERE d.`umd_createtime` <![CDATA[ |
| | | <= |
| | | ]]> |
| | | (SELECT d.`umd_createtime` FROM yeshi_ec_user_money_detail d WHERE |
| | | d.`umd_id`=#{id}) and d.umd_uid=#{uid} order by d.`umd_createtime` |
| | | desc,d.umd_id desc limit #{count} |
| | | </select> |
| | | <select id="selectCountByUid" resultType="java.lang.Long" |
| | | parameterType="java.lang.Long">SELECT count(umd_id) FROM yeshi_ec_user_money_detail |
| | | where umd_uid=#{uid}</select> |
| | | <select id="selectByMaxCreateTime" resultMap="BaseResultMap"> |
| | | SELECT |
| | | <include refid="Base_Column_List" /> |
| | | FROM yeshi_ec_user_money_detail d WHERE d.umd_uid=#{uid} and |
| | | d.`umd_createtime`<![CDATA[ |
| | | <= |
| | | ]]> |
| | | #{date} order by d.`umd_createtime` desc,d.umd_id desc limit #{count} |
| | | </select> |
| | | <select id="selectCountByUidAndMaxCreateTime" resultType="java.lang.Long">SELECT |
| | | count(umd_id) FROM yeshi_ec_user_money_detail where umd_uid=#{uid} and |
| | | `umd_createtime`<![CDATA[ |
| | | <= |
| | | ]]> |
| | | #{date} |
| | | </select> |
| | | <select id="selectMonthCountByUid" resultType="java.lang.Integer">SELECT |
| | | COUNT(*) FROM (SELECT * FROM yeshi_ec_user_money_detail d WHERE |
| | | d.`umd_uid`=#{uid} and d.`umd_createtime` <![CDATA[<=]]> |
| | | #{date} group by DATE_FORMAT(d.`umd_createtime`,'%y-%m')) a |
| | | </select> |
| | | <select id="selectMonthMoneyByUid" resultMap="UserMonthMoneyMap"> |
| | | <foreach collection="dateFormat" index="index" item="item" |
| | | separator="UNION ALL"> |
| | | <trim prefix="(" suffix=")"> |
| | | SELECT c.time as dateFormate , if(a.money is null,0,a.money) as |
| | | income ,if(b.money is null,0,b.money) as expend FROM (select #{item} |
| | | as `time`) c left join ( SELECT DATE_FORMAT( |
| | | d.`umd_createtime`,'%Y-%m') AS `time`,SUM(d.`umd_money`) AS money |
| | | FROM `yeshi_ec_user_money_detail` d WHERE d.`umd_uid`=#{uid} AND |
| | | d.`umd_money`>=0 AND DATE_FORMAT( |
| | | d.`umd_createtime`,'%Y-%m')=#{item} GROUP BY DATE_FORMAT( |
| | | d.`umd_createtime`,'%Y-%m') ) a on a.time=c.time LEFT JOIN ( SELECT |
| | | DATE_FORMAT( d.`umd_createtime`,'%Y-%m') AS |
| | | `time`,SUM(d.`umd_money`) AS money FROM `yeshi_ec_user_money_detail` |
| | | d WHERE d.`umd_uid`=#{uid} AND d.`umd_money`<![CDATA[<0]]> |
| | | AND DATE_FORMAT( d.`umd_createtime`,'%Y-%m')=#{item} GROUP BY |
| | | DATE_FORMAT( d.`umd_createtime`,'%Y-%m') ) b ON c.time=b.time |
| | | </trim> |
| | | </foreach> |
| | | </select> |
| | | <select id="selectByUidWithState" resultMap="BaseResultMap">SELECT a.* FROM |
| | | ((SELECT d.*,-1 AS state FROM `yeshi_ec_user_money_detail` d WHERE |
| | | d.`umd_uid`=#{uid} AND (d.`umd_type`!='extract' AND |
| | | d.`umd_type`!='extractReject') ) UNION ALL( SELECT d.*,-1 AS state |
| | | FROM `yeshi_ec_user_money_detail` d LEFT JOIN `yeshi_ec_extract` e ON |
| | | e.`id`=d.umd_source_identify_id WHERE d.`umd_uid`=#{uid} AND |
| | | d.umd_type='extractReject' ) UNION ALL( SELECT d.*,e.state FROM |
| | | `yeshi_ec_user_money_detail` d LEFT JOIN `yeshi_ec_extract` e ON |
| | | e.`id`=d.`umd_source_identify_id` WHERE d.`umd_uid`=#{uid} AND |
| | | d.umd_type='extract' )) a ORDER BY a.umd_createtime DESC LIMIT |
| | | #{start},#{count}</select> |
| | | <select id="selectCountByUidWithState" resultType="java.lang.Long">SELECT |
| | | count(*) FROM ((SELECT d.*,-1 AS state FROM |
| | | `yeshi_ec_user_money_detail` d WHERE d.`umd_uid`=#{uid} AND |
| | | (d.`umd_type`!='extract' AND d.`umd_type`!='extractReject') ) UNION |
| | | ALL( SELECT d.*,-1 AS state FROM `yeshi_ec_user_money_detail` d LEFT |
| | | JOIN `yeshi_ec_extract` e ON e.`id`=d.umd_source_identify_id WHERE |
| | | d.`umd_uid`=#{uid} AND d.umd_type='extractReject' ) UNION ALL( SELECT |
| | | d.*,e.state FROM `yeshi_ec_user_money_detail` d LEFT JOIN |
| | | `yeshi_ec_extract` e ON e.`id`=d.`umd_source_identify_id` WHERE |
| | | d.`umd_uid`=#{uid} AND d.umd_type='extract' )) a</select> |
| | | <select id="getTotalMoneyByTypeAndUidWithDate" resultType="java.math.BigDecimal">select |
| | | sum(umd_money) from yeshi_ec_user_money_detail where umd_uid=#{uid} |
| | | and umd_createtime>=#{minDate} and umd_createtime<![CDATA[<]]>#{maxDate} |
| | | <foreach collection="typeList" item="item" open=" and (" |
| | | separator=" or " close=")">umd_type=#{item}</foreach> |
| | | </select> |
| | | <select id="selectByTypeAndUidAndIdentifyCode" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user_money_detail where umd_uid=#{uid} and |
| | | umd_type=#{type} and umd_source_identify_id=#{sourceIdentifyId} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_user_money_detail where umd_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.money.UserMoneyDetail" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_user_money_detail |
| | | (umd_id,umd_uid,umd_money,umd_type,umd_title,umd_sub_title,umd_desc_info,umd_source_identify_id,umd_identify_code,umd_beizhu,umd_createtime,umd_updatetime,umd_order_type) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{type,jdbcType=VARCHAR},#{title,jdbcType=VARCHAR},#{subTitle,jdbcType=VARCHAR},#{descInfo,jdbcType=VARCHAR},#{sourceIdentifyId,jdbcType=BIGINT},#{identifyCode,jdbcType=VARCHAR},#{beiZhu,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{orderType,jdbcType=INTEGER}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.money.UserMoneyDetail" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_user_money_detail |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">umd_id,</if> |
| | | <if test="userInfo != null">umd_uid,</if> |
| | | <if test="money != null">umd_money,</if> |
| | | <if test="type != null">umd_type,</if> |
| | | <if test="title != null">umd_title,</if> |
| | | <if test="subTitle != null">umd_sub_title,</if> |
| | | <if test="descInfo != null">umd_desc_info,</if> |
| | | <if test="sourceIdentifyId != null">umd_source_identify_id,</if> |
| | | <if test="identifyCode != null">umd_identify_code,</if> |
| | | <if test="beiZhu != null">umd_beizhu,</if> |
| | | <if test="createTime != null">umd_createtime,</if> |
| | | <if test="updateTime != null">umd_updatetime,</if> |
| | | <if test="orderType != null">umd_order_type,</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="money != null">#{money,jdbcType=DECIMAL},</if> |
| | | <if test="type != null">#{type,jdbcType=VARCHAR},</if> |
| | | <if test="title != null">#{title,jdbcType=VARCHAR},</if> |
| | | <if test="subTitle != null">#{subTitle,jdbcType=VARCHAR},</if> |
| | | <if test="descInfo != null">#{descInfo,jdbcType=VARCHAR},</if> |
| | | <if test="sourceIdentifyId != null">#{sourceIdentifyId,jdbcType=BIGINT},</if> |
| | | <if test="identifyCode != null">#{identifyCode,jdbcType=VARCHAR},</if> |
| | | <if test="beiZhu != null">#{beiZhu,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="orderType != null">#{orderType,jdbcType=INTEGER}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.money.UserMoneyDetail">update |
| | | yeshi_ec_user_money_detail set umd_uid = |
| | | #{userInfo.id,jdbcType=BIGINT},umd_money = |
| | | #{money,jdbcType=DECIMAL},umd_type = |
| | | #{type,jdbcType=VARCHAR},umd_title = |
| | | #{title,jdbcType=VARCHAR},umd_sub_title = |
| | | #{subTitle,jdbcType=VARCHAR},umd_desc_info = |
| | | #{descInfo,jdbcType=VARCHAR},umd_source_identify_id = |
| | | #{sourceIdentifyId,jdbcType=BIGINT},umd_identify_code = |
| | | #{identifyCode,jdbcType=VARCHAR},umd_beizhu = |
| | | #{beiZhu,jdbcType=VARCHAR},umd_createtime = |
| | | #{createTime,jdbcType=TIMESTAMP},umd_updatetime = |
| | | #{updateTime,jdbcType=TIMESTAMP} ,umd_order_type |
| | | =#{orderType,jdbcType=INTEGER} where umd_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.money.UserMoneyDetail"> |
| | | update yeshi_ec_user_money_detail |
| | | <set> |
| | | <if test="userInfo != null">umd_uid=#{userInfo.id,jdbcType=BIGINT},</if> |
| | | <if test="money != null">umd_money=#{money,jdbcType=DECIMAL},</if> |
| | | <if test="type != null">umd_type=#{type,jdbcType=VARCHAR},</if> |
| | | <if test="title != null">umd_title=#{title,jdbcType=VARCHAR},</if> |
| | | <if test="subTitle != null">umd_sub_title=#{subTitle,jdbcType=VARCHAR},</if> |
| | | <if test="descInfo != null">umd_desc_info=#{descInfo,jdbcType=VARCHAR},</if> |
| | | <if test="sourceIdentifyId != null">umd_source_identify_id=#{sourceIdentifyId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="identifyCode != null">umd_identify_code=#{identifyCode,jdbcType=VARCHAR},</if> |
| | | <if test="beiZhu != null">umd_beizhu=#{beiZhu,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">umd_createtime=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">umd_updatetime=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="orderType !=null">umd_order_type =#{orderType,jdbcType=INTEGER},</if> |
| | | </set> |
| | | where umd_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | | <?xml version="1.0" encoding="UTF-8"?>
|
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
| | |
|
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.money.UserMoneyDetailMapper">
|
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.money.UserMoneyDetail">
|
| | | <id column="umd_id" property="id" jdbcType="BIGINT" />
|
| | | <result column="umd_money" property="money" jdbcType="DECIMAL" />
|
| | | <result column="umd_type" property="type"
|
| | | typeHandler="com.yeshi.fanli.util.mybatishandler.UserMoneyDetailTypeEnumHandler" />
|
| | | <result column="umd_title" property="title" jdbcType="VARCHAR" />
|
| | | <result column="umd_sub_title" property="subTitle" jdbcType="VARCHAR" />
|
| | | <result column="umd_desc_info" property="descInfo" jdbcType="VARCHAR" />
|
| | | <result column="umd_source_identify_id" property="sourceIdentifyId"
|
| | | jdbcType="BIGINT" />
|
| | | <result column="umd_identify_code" property="identifyCode"
|
| | | jdbcType="VARCHAR" />
|
| | | <result column="umd_beizhu" property="beiZhu" jdbcType="VARCHAR" />
|
| | | <result column="umd_createtime" property="createTime" jdbcType="TIMESTAMP" />
|
| | | <result column="umd_updatetime" property="updateTime" jdbcType="TIMESTAMP" />
|
| | | <!-- 老版明细适用该字段 -->
|
| | | <result column="state" property="state" jdbcType="INTEGER" />
|
| | | <result column="umd_order_type" property="orderType" jdbcType="INTEGER" />
|
| | | <result column="umd_show" property="show" jdbcType="BOOLEAN" />
|
| | | <association property="userInfo" column="umd_uid"
|
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
|
| | | <id column="umd_uid" property="id" jdbcType="BIGINT" />
|
| | | </association>
|
| | |
|
| | | </resultMap>
|
| | | <resultMap id="UserMonthMoneyMap" type="com.yeshi.fanli.vo.money.UserMonthMoneyVO">
|
| | | <result column="expend" property="expend" jdbcType="DECIMAL" />
|
| | | <result column="income" property="income" jdbcType="DECIMAL" />
|
| | | <result column="dateFormate" property="dateFormate" jdbcType="VARCHAR" />
|
| | | </resultMap>
|
| | | <sql id="Base_Column_List">umd_id,umd_uid,umd_money,umd_type,umd_title,umd_sub_title,umd_desc_info,umd_source_identify_id,umd_identify_code,umd_beizhu,umd_createtime,umd_updatetime,umd_order_type,umd_show
|
| | | </sql>
|
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
| | | parameterType="java.lang.Long">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_user_money_detail where umd_id = #{id,jdbcType=BIGINT}
|
| | | </select>
|
| | | <select id="selectByUidWithIndexId" resultMap="BaseResultMap">
|
| | | SELECT
|
| | | <include refid="Base_Column_List" />
|
| | | FROM yeshi_ec_user_money_detail d WHERE d.`umd_createtime` <![CDATA[
|
| | | <=
|
| | | ]]>
|
| | | (SELECT d.`umd_createtime` FROM yeshi_ec_user_money_detail d WHERE
|
| | | d.`umd_id`=#{id}) and d.umd_uid=#{uid} and d.umd_show=1 order by d.`umd_createtime`
|
| | | desc,d.umd_id desc limit #{count}
|
| | | </select>
|
| | | <select id="selectCountByUid" resultType="java.lang.Long"
|
| | | parameterType="java.lang.Long">SELECT count(umd_id) FROM yeshi_ec_user_money_detail
|
| | | where umd_uid=#{uid} and umd_show=1 </select>
|
| | | <select id="selectByMaxCreateTime" resultMap="BaseResultMap">
|
| | | SELECT
|
| | | <include refid="Base_Column_List" />
|
| | | FROM yeshi_ec_user_money_detail d WHERE d.umd_uid=#{uid} and d.umd_show=1 and
|
| | | d.`umd_createtime`<![CDATA[
|
| | | <=
|
| | | ]]>
|
| | | #{date} order by d.`umd_createtime` desc,d.umd_id desc limit #{count}
|
| | | </select>
|
| | | <select id="selectCountByUidAndMaxCreateTime" resultType="java.lang.Long">SELECT
|
| | | count(umd_id) FROM yeshi_ec_user_money_detail where umd_uid=#{uid} and d.umd_show=1 and
|
| | | `umd_createtime`<![CDATA[
|
| | | <=
|
| | | ]]>
|
| | | #{date}
|
| | | </select>
|
| | | <select id="selectMonthCountByUid" resultType="java.lang.Integer">SELECT
|
| | | COUNT(*) FROM (SELECT * FROM yeshi_ec_user_money_detail d WHERE
|
| | | d.`umd_uid`=#{uid} and d.umd_show=1 and d.`umd_createtime` <![CDATA[<=]]>
|
| | | #{date} group by DATE_FORMAT(d.`umd_createtime`,'%y-%m')) a
|
| | | </select>
|
| | | <select id="selectMonthMoneyByUid" resultMap="UserMonthMoneyMap">
|
| | | <foreach collection="dateFormat" index="index" item="item"
|
| | | separator="UNION ALL">
|
| | | <trim prefix="(" suffix=")">
|
| | | SELECT c.time as dateFormate , if(a.money is null,0,a.money) as
|
| | | income ,if(b.money is null,0,b.money) as expend FROM (select #{item}
|
| | | as `time`) c left join ( SELECT DATE_FORMAT(
|
| | | d.`umd_createtime`,'%Y-%m') AS `time`,SUM(d.`umd_money`) AS money
|
| | | FROM `yeshi_ec_user_money_detail` d WHERE d.`umd_uid`=#{uid} and d.umd_show=1 AND
|
| | | d.`umd_money`>=0 AND DATE_FORMAT(
|
| | | d.`umd_createtime`,'%Y-%m')=#{item} GROUP BY DATE_FORMAT(
|
| | | d.`umd_createtime`,'%Y-%m') ) a on a.time=c.time LEFT JOIN ( SELECT
|
| | | DATE_FORMAT( d.`umd_createtime`,'%Y-%m') AS
|
| | | `time`,SUM(d.`umd_money`) AS money FROM `yeshi_ec_user_money_detail`
|
| | | d WHERE d.`umd_uid`=#{uid} and d.umd_show=1 AND d.`umd_money`<![CDATA[<0]]>
|
| | | AND DATE_FORMAT( d.`umd_createtime`,'%Y-%m')=#{item} GROUP BY
|
| | | DATE_FORMAT( d.`umd_createtime`,'%Y-%m') ) b ON c.time=b.time
|
| | | </trim>
|
| | | </foreach>
|
| | | </select>
|
| | | <select id="selectByUidWithState" resultMap="BaseResultMap">SELECT a.* FROM
|
| | | ((SELECT d.*,-1 AS state FROM `yeshi_ec_user_money_detail` d WHERE
|
| | | d.`umd_uid`=#{uid} AND (d.`umd_type`!='extract' AND
|
| | | d.`umd_type`!='extractReject') ) UNION ALL( SELECT d.*,-1 AS state
|
| | | FROM `yeshi_ec_user_money_detail` d LEFT JOIN `yeshi_ec_extract` e ON
|
| | | e.`id`=d.umd_source_identify_id WHERE d.`umd_uid`=#{uid} AND
|
| | | d.umd_type='extractReject' ) UNION ALL( SELECT d.*,e.state FROM
|
| | | `yeshi_ec_user_money_detail` d LEFT JOIN `yeshi_ec_extract` e ON
|
| | | e.`id`=d.`umd_source_identify_id` WHERE d.`umd_uid`=#{uid} AND
|
| | | d.umd_type='extract' )) a ORDER BY a.umd_createtime DESC LIMIT
|
| | | #{start},#{count}</select>
|
| | | <select id="selectCountByUidWithState" resultType="java.lang.Long">SELECT
|
| | | count(*) FROM ((SELECT d.*,-1 AS state FROM
|
| | | `yeshi_ec_user_money_detail` d WHERE d.`umd_uid`=#{uid} AND
|
| | | (d.`umd_type`!='extract' AND d.`umd_type`!='extractReject') ) UNION
|
| | | ALL( SELECT d.*,-1 AS state FROM `yeshi_ec_user_money_detail` d LEFT
|
| | | JOIN `yeshi_ec_extract` e ON e.`id`=d.umd_source_identify_id WHERE
|
| | | d.`umd_uid`=#{uid} AND d.umd_type='extractReject' ) UNION ALL( SELECT
|
| | | d.*,e.state FROM `yeshi_ec_user_money_detail` d LEFT JOIN
|
| | | `yeshi_ec_extract` e ON e.`id`=d.`umd_source_identify_id` WHERE
|
| | | d.`umd_uid`=#{uid} AND d.umd_type='extract' )) a</select>
|
| | | <select id="getTotalMoneyByTypeAndUidWithDate" resultType="java.math.BigDecimal">select
|
| | | sum(umd_money) from yeshi_ec_user_money_detail where umd_uid=#{uid}
|
| | | and umd_createtime>=#{minDate} and umd_createtime<![CDATA[<]]>#{maxDate}
|
| | | <foreach collection="typeList" item="item" open=" and ("
|
| | | separator=" or " close=")">umd_type=#{item}</foreach>
|
| | | </select>
|
| | | <select id="selectByTypeAndUidAndIdentifyCode" resultMap="BaseResultMap">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_user_money_detail where umd_uid=#{uid} and
|
| | | umd_type=#{type} and umd_source_identify_id=#{sourceIdentifyId}
|
| | | </select>
|
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
|
| | | yeshi_ec_user_money_detail where umd_id = #{id,jdbcType=BIGINT}
|
| | | </delete>
|
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.money.UserMoneyDetail"
|
| | | useGeneratedKeys="true" keyProperty="id">insert into
|
| | | yeshi_ec_user_money_detail
|
| | | (umd_id,umd_uid,umd_money,umd_type,umd_title,umd_sub_title,umd_desc_info,umd_source_identify_id,umd_identify_code,umd_beizhu,umd_createtime,umd_updatetime,umd_order_type,umd_show)
|
| | | values
|
| | | (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{type,jdbcType=VARCHAR},#{title,jdbcType=VARCHAR},#{subTitle,jdbcType=VARCHAR},#{descInfo,jdbcType=VARCHAR},#{sourceIdentifyId,jdbcType=BIGINT},#{identifyCode,jdbcType=VARCHAR},#{beiZhu,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{orderType,jdbcType=INTEGER},#{show,jdbcType=BOOLEAN})
|
| | | </insert>
|
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.money.UserMoneyDetail"
|
| | | useGeneratedKeys="true" keyProperty="id">
|
| | | insert into yeshi_ec_user_money_detail
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">umd_id,</if>
|
| | | <if test="userInfo != null">umd_uid,</if>
|
| | | <if test="money != null">umd_money,</if>
|
| | | <if test="type != null">umd_type,</if>
|
| | | <if test="title != null">umd_title,</if>
|
| | | <if test="subTitle != null">umd_sub_title,</if>
|
| | | <if test="descInfo != null">umd_desc_info,</if>
|
| | | <if test="sourceIdentifyId != null">umd_source_identify_id,</if>
|
| | | <if test="identifyCode != null">umd_identify_code,</if>
|
| | | <if test="beiZhu != null">umd_beizhu,</if>
|
| | | <if test="createTime != null">umd_createtime,</if>
|
| | | <if test="updateTime != null">umd_updatetime,</if>
|
| | | <if test="orderType != null">umd_order_type,</if>
|
| | | <if test="show != null">umd_show,</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="money != null">#{money,jdbcType=DECIMAL},</if>
|
| | | <if test="type != null">#{type,jdbcType=VARCHAR},</if>
|
| | | <if test="title != null">#{title,jdbcType=VARCHAR},</if>
|
| | | <if test="subTitle != null">#{subTitle,jdbcType=VARCHAR},</if>
|
| | | <if test="descInfo != null">#{descInfo,jdbcType=VARCHAR},</if>
|
| | | <if test="sourceIdentifyId != null">#{sourceIdentifyId,jdbcType=BIGINT},</if>
|
| | | <if test="identifyCode != null">#{identifyCode,jdbcType=VARCHAR},</if>
|
| | | <if test="beiZhu != null">#{beiZhu,jdbcType=VARCHAR},</if>
|
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="orderType != null">#{orderType,jdbcType=INTEGER}</if>
|
| | | <if test="show != null">#{show,jdbcType=BOOLEAN}</if>
|
| | | </trim>
|
| | | </insert>
|
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.money.UserMoneyDetail">update
|
| | | yeshi_ec_user_money_detail set umd_uid =
|
| | | #{userInfo.id,jdbcType=BIGINT},umd_money =
|
| | | #{money,jdbcType=DECIMAL},umd_type =
|
| | | #{type,jdbcType=VARCHAR},umd_title =
|
| | | #{title,jdbcType=VARCHAR},umd_sub_title =
|
| | | #{subTitle,jdbcType=VARCHAR},umd_desc_info =
|
| | | #{descInfo,jdbcType=VARCHAR},umd_source_identify_id =
|
| | | #{sourceIdentifyId,jdbcType=BIGINT},umd_identify_code =
|
| | | #{identifyCode,jdbcType=VARCHAR},umd_beizhu =
|
| | | #{beiZhu,jdbcType=VARCHAR},umd_createtime =
|
| | | #{createTime,jdbcType=TIMESTAMP},umd_updatetime =
|
| | | #{updateTime,jdbcType=TIMESTAMP} ,umd_order_type
|
| | | =#{orderType,jdbcType=INTEGER},umd_show
|
| | | =#{show,jdbcType=BOOLEAN} where umd_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.money.UserMoneyDetail">
|
| | | update yeshi_ec_user_money_detail
|
| | | <set>
|
| | | <if test="userInfo != null">umd_uid=#{userInfo.id,jdbcType=BIGINT},</if>
|
| | | <if test="money != null">umd_money=#{money,jdbcType=DECIMAL},</if>
|
| | | <if test="type != null">umd_type=#{type,jdbcType=VARCHAR},</if>
|
| | | <if test="title != null">umd_title=#{title,jdbcType=VARCHAR},</if>
|
| | | <if test="subTitle != null">umd_sub_title=#{subTitle,jdbcType=VARCHAR},</if>
|
| | | <if test="descInfo != null">umd_desc_info=#{descInfo,jdbcType=VARCHAR},</if>
|
| | | <if test="sourceIdentifyId != null">umd_source_identify_id=#{sourceIdentifyId,jdbcType=BIGINT},
|
| | | </if>
|
| | | <if test="identifyCode != null">umd_identify_code=#{identifyCode,jdbcType=VARCHAR},</if>
|
| | | <if test="beiZhu != null">umd_beizhu=#{beiZhu,jdbcType=VARCHAR},</if>
|
| | | <if test="createTime != null">umd_createtime=#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="updateTime != null">umd_updatetime=#{updateTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="orderType !=null">umd_order_type =#{orderType,jdbcType=INTEGER},</if>
|
| | | <if test="show !=null">umd_show =#{show,jdbcType=BOOLEAN},</if>
|
| | | </set>
|
| | | where umd_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | </mapper>
|
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanOrderMapper"> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder"> |
| | | <id column="tmo_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="tmo_order_id" property="orderId" jdbcType="VARCHAR" /> |
| | | <result column="tmo_order_item_id" property="orderItemId" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="tmo_goods_name" property="goodsName" jdbcType="VARCHAR" /> |
| | | <result column="tmo_money" property="money" jdbcType="DECIMAL" /> |
| | | <result column="tmo_fan_money" property="fanMoney" jdbcType="DECIMAL" /> |
| | | <result column="tmo_state" property="state" jdbcType="VARCHAR" /> |
| | | <result column="tmo_jiesuan_time" property="jieSuanTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="tmo_weiquan_time" property="weiQuanTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="tmo_weiquan_finish_time" property="weiQuanFinishTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="tmo_createtime" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="tmo_updatetime" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | <result column="tmo_settlement" property="settlement" jdbcType="DECIMAL" /> |
| | | </resultMap> |
| | | |
| | | <resultMap id="ChartMap" type="com.yeshi.fanli.dto.ChartTDO"> |
| | | <result column="showDate" property="showDate" jdbcType="VARCHAR" /> |
| | | <result column="showValue" property="showValue" jdbcType="VARCHAR" /> |
| | | </resultMap> |
| | | |
| | | |
| | | <sql id="Base_Column_List">tmo_id,tmo_order_id,tmo_order_item_id,tmo_goods_name,tmo_money,tmo_fan_money,tmo_state,tmo_jiesuan_time,tmo_weiquan_time,tmo_weiquan_finish_time,tmo_createtime,tmo_updatetime,tmo_settlement |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_taobao_weiqaun_order where tmo_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <select id="selectByOrderIdAndOrderItemId" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_taobao_weiqaun_order where tmo_order_id =#{orderId} and |
| | | tmo_order_item_id=#{orderItemId} |
| | | </select> |
| | | <select id="selectListByOrderIdAndState" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_taobao_weiqaun_order where tmo_order_id =#{orderId} and |
| | | tmo_state like '${state}%' |
| | | </select> |
| | | <select id="selectByOrderItemId" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_taobao_weiqaun_order where tmo_order_item_id =#{0} |
| | | </select> |
| | | |
| | | |
| | | <select id="listByOrderId" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_taobao_weiqaun_order |
| | | where tmo_order_id=#{0} |
| | | </select> |
| | | |
| | | |
| | | <select id="listByState" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_taobao_weiqaun_order |
| | | <if test="state!=null">where tmo_state like '${state}%'</if> |
| | | order by tmo_createtime desc limit #{start},#{count} |
| | | </select> |
| | | |
| | | <select id="countByState" resultType="java.lang.Long" |
| | | parameterType="java.lang.String"> |
| | | select |
| | | count(*) |
| | | from yeshi_ec_taobao_weiqaun_order |
| | | <if test="state!=null">where tmo_state like '${state}%'</if> |
| | | </select> |
| | | |
| | | |
| | | <select id="selectByOrderItem" resultMap="BaseResultMap" parameterType="java.lang.String"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_taobao_weiqaun_order |
| | | where tmo_order_item_id=#{0} |
| | | </select> |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_taobao_weiqaun_order where tmo_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_taobao_weiqaun_order |
| | | (tmo_id,tmo_order_id,tmo_order_item_id,tmo_goods_name,tmo_money,tmo_fan_money,tmo_state,tmo_jiesuan_time,tmo_weiquan_time,tmo_weiquan_finish_time,tmo_createtime,tmo_updatetime,tmo_settlement) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{orderId,jdbcType=VARCHAR},#{orderItemId,jdbcType=VARCHAR},#{goodsName,jdbcType=VARCHAR},#{money,jdbcType=DECIMAL},#{fanMoney,jdbcType=DECIMAL},#{state,jdbcType=VARCHAR},#{jieSuanTime,jdbcType=TIMESTAMP},#{weiQuanTime,jdbcType=TIMESTAMP},#{weiQuanFinishTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{settlement,jdbcType=DECIMAL}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_taobao_weiqaun_order |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">tmo_id,</if> |
| | | <if test="orderId != null">tmo_order_id,</if> |
| | | <if test="orderItemId != null">tmo_order_item_id,</if> |
| | | <if test="goodsName != null">tmo_goods_name,</if> |
| | | <if test="money != null">tmo_money,</if> |
| | | <if test="fanMoney != null">tmo_fan_money,</if> |
| | | <if test="state != null">tmo_state,</if> |
| | | <if test="jieSuanTime != null">tmo_jiesuan_time,</if> |
| | | <if test="weiQuanTime != null">tmo_weiquan_time,</if> |
| | | <if test="weiQuanFinishTime != null">tmo_weiquan_finish_time,</if> |
| | | <if test="createTime != null">tmo_createtime,</if> |
| | | <if test="updateTime != null">tmo_updatetime,</if> |
| | | <if test="settlement != null">tmo_settlement,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="orderId != null">#{orderId,jdbcType=VARCHAR},</if> |
| | | <if test="orderItemId != null">#{orderItemId,jdbcType=VARCHAR},</if> |
| | | <if test="goodsName != null">#{goodsName,jdbcType=VARCHAR},</if> |
| | | <if test="money != null">#{money,jdbcType=DECIMAL},</if> |
| | | <if test="fanMoney != null">#{fanMoney,jdbcType=DECIMAL},</if> |
| | | <if test="state != null">#{state,jdbcType=VARCHAR},</if> |
| | | <if test="jieSuanTime != null">#{jieSuanTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="weiQuanTime != null">#{weiQuanTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="weiQuanFinishTime != null">#{weiQuanFinishTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="settlement != null">#{settlement,jdbcType=DECIMAL}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder">update |
| | | yeshi_ec_taobao_weiqaun_order set tmo_order_id = |
| | | #{orderId,jdbcType=VARCHAR},tmo_order_item_id = |
| | | #{orderItemId,jdbcType=VARCHAR},tmo_goods_name = |
| | | #{goodsName,jdbcType=VARCHAR},tmo_money = |
| | | #{money,jdbcType=DECIMAL},tmo_fan_money = |
| | | #{fanMoney,jdbcType=DECIMAL},tmo_state = |
| | | #{state,jdbcType=VARCHAR},tmo_jiesuan_time = |
| | | #{jieSuanTime,jdbcType=TIMESTAMP},tmo_weiquan_time = |
| | | #{weiQuanTime,jdbcType=TIMESTAMP},tmo_weiquan_finish_time = |
| | | #{weiQuanFinishTime,jdbcType=TIMESTAMP},tmo_createtime = |
| | | #{createTime,jdbcType=TIMESTAMP},tmo_updatetime = |
| | | #{updateTime,jdbcType=TIMESTAMP} ,tmo_settlement |
| | | =#{settlement,jdbcType=DECIMAL} where tmo_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder"> |
| | | update yeshi_ec_taobao_weiqaun_order |
| | | <set> |
| | | <if test="orderId != null">tmo_order_id=#{orderId,jdbcType=VARCHAR},</if> |
| | | <if test="orderItemId != null">tmo_order_item_id=#{orderItemId,jdbcType=VARCHAR},</if> |
| | | <if test="goodsName != null">tmo_goods_name=#{goodsName,jdbcType=VARCHAR},</if> |
| | | <if test="money != null">tmo_money=#{money,jdbcType=DECIMAL},</if> |
| | | <if test="fanMoney != null">tmo_fan_money=#{fanMoney,jdbcType=DECIMAL},</if> |
| | | <if test="state != null">tmo_state=#{state,jdbcType=VARCHAR},</if> |
| | | <if test="jieSuanTime != null">tmo_jiesuan_time=#{jieSuanTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="weiQuanTime != null">tmo_weiquan_time=#{weiQuanTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="weiQuanFinishTime != null">tmo_weiquan_finish_time=#{weiQuanFinishTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="createTime != null">tmo_createtime=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">tmo_updatetime=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="settlement !=null">tmo_settlement =#{settlement,jdbcType=DECIMAL},</if> |
| | | </set> |
| | | where tmo_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <sql id="Column_DateType"> |
| | | <if test="dateType == 1">DATE_FORMAT(t.`tmo_weiquan_time`,'%Y-%m-%d') AS 'showDate' |
| | | </if> |
| | | <if test="dateType == 2">DATE_FORMAT(t.`tmo_weiquan_time`,'%m') AS 'showDate'</if> |
| | | <if test="dateType == 3">DATE_FORMAT(t.`tmo_weiquan_time`,'%Y') AS 'showDate'</if> |
| | | </sql> |
| | | <sql id="Count_Select_DateType"> |
| | | <if test="startTime != null and startTime != '' "> |
| | | AND DATE_FORMAT(t.`tmo_weiquan_time`,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}' |
| | | </if> |
| | | <if test="endTime != null and endTime != '' "> |
| | | AND DATE_FORMAT(t.`tmo_weiquan_time`,'%Y-%m-%d') <![CDATA[ <= ]]>'${endTime}' |
| | | </if> |
| | | <if test="year != null and year != '' ">AND DATE_FORMAT(t.`tmo_weiquan_time`,'%Y') = '${year}' |
| | | </if> |
| | | </sql> |
| | | <sql id="Count_Group_DateType"> |
| | | <if test="dateType == 1">GROUP BY DATE_FORMAT(t.`tmo_weiquan_time`,'%Y-%m-%d')</if> |
| | | <if test="dateType == 2">GROUP BY DATE_FORMAT(t.`tmo_weiquan_time`,'%Y-%m')</if> |
| | | <if test="dateType == 3">GROUP BY DATE_FORMAT(t.`tmo_weiquan_time`,'%Y')</if> |
| | | </sql> |
| | | <select id="countWeiQaunOrderNumber" resultMap="ChartMap"> |
| | | SELECT IFNULL(COUNT(t.`tmo_id`),0) AS showValue, |
| | | <include refid="Column_DateType" /> |
| | | FROM yeshi_ec_taobao_weiqaun_order t WHERE t.`tmo_createtime`IS NOT |
| | | NULL |
| | | <include refid="Count_Select_DateType" /> |
| | | <include refid="Count_Group_DateType" /> |
| | | ORDER BY t.`tmo_weiquan_time` |
| | | </select> |
| | | <select id="countWeiQaunOrderMoney" resultMap="ChartMap"> |
| | | SELECT CAST(SUM(t.`tmo_fan_money`)AS DECIMAL(19,2)) AS showValue, |
| | | <include refid="Column_DateType" /> |
| | | FROM yeshi_ec_taobao_weiqaun_order t WHERE t.`tmo_createtime` IS NOT |
| | | NULL |
| | | <include refid="Count_Select_DateType" /> |
| | | <include refid="Count_Group_DateType" /> |
| | | ORDER BY t.`tmo_weiquan_time` |
| | | </select> |
| | | </mapper> |
| | | <?xml version="1.0" encoding="UTF-8"?>
|
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
| | |
|
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanOrderMapper">
|
| | | <resultMap id="BaseResultMap"
|
| | | type="com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder">
|
| | | <id column="tmo_id" property="id" jdbcType="BIGINT" />
|
| | | <result column="tmo_order_id" property="orderId" jdbcType="VARCHAR" />
|
| | | <result column="tmo_order_item_id" property="orderItemId"
|
| | | jdbcType="VARCHAR" />
|
| | | <result column="tmo_goods_name" property="goodsName" jdbcType="VARCHAR" />
|
| | | <result column="tmo_money" property="money" jdbcType="DECIMAL" />
|
| | | <result column="tmo_fan_money" property="fanMoney" jdbcType="DECIMAL" />
|
| | | <result column="tmo_state" property="state" jdbcType="VARCHAR" />
|
| | | <result column="tmo_jiesuan_time" property="jieSuanTime"
|
| | | jdbcType="TIMESTAMP" />
|
| | | <result column="tmo_weiquan_time" property="weiQuanTime"
|
| | | jdbcType="TIMESTAMP" />
|
| | | <result column="tmo_weiquan_finish_time" property="weiQuanFinishTime"
|
| | | jdbcType="TIMESTAMP" />
|
| | | <result column="tmo_createtime" property="createTime" jdbcType="TIMESTAMP" />
|
| | | <result column="tmo_updatetime" property="updateTime" jdbcType="TIMESTAMP" />
|
| | | <result column="tmo_settlement" property="settlement" jdbcType="DECIMAL" />
|
| | | </resultMap>
|
| | | |
| | | <resultMap id="ChartMap" type="com.yeshi.fanli.dto.ChartTDO">
|
| | | <result column="showDate" property="showDate" jdbcType="VARCHAR" />
|
| | | <result column="showValue" property="showValue" jdbcType="VARCHAR" />
|
| | | </resultMap>
|
| | | |
| | | |
| | | <sql id="Base_Column_List">tmo_id,tmo_order_id,tmo_order_item_id,tmo_goods_name,tmo_money,tmo_fan_money,tmo_state,tmo_jiesuan_time,tmo_weiquan_time,tmo_weiquan_finish_time,tmo_createtime,tmo_updatetime,tmo_settlement
|
| | | </sql>
|
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
| | | parameterType="java.lang.Long">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_taobao_weiqaun_order where tmo_id =
|
| | | #{id,jdbcType=BIGINT}
|
| | | </select>
|
| | | <select id="selectByOrderIdAndOrderItemId" resultMap="BaseResultMap">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_taobao_weiqaun_order where tmo_order_id =#{orderId} and
|
| | | tmo_order_item_id=#{orderItemId}
|
| | | </select>
|
| | | <select id="selectListByOrderIdAndState" resultMap="BaseResultMap">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_taobao_weiqaun_order where tmo_order_id =#{orderId} and
|
| | | tmo_state like '${state}%'
|
| | | </select>
|
| | | <select id="selectByOrderItemId" resultMap="BaseResultMap">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_taobao_weiqaun_order where tmo_order_item_id =#{0}
|
| | | </select>
|
| | |
|
| | |
|
| | | <select id="listByOrderId" resultMap="BaseResultMap">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_taobao_weiqaun_order
|
| | | where tmo_order_id=#{0}
|
| | | </select>
|
| | |
|
| | |
|
| | | <select id="listByState" resultMap="BaseResultMap">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_taobao_weiqaun_order
|
| | | <if test="state!=null">where tmo_state like '${state}%'</if>
|
| | | order by tmo_createtime desc limit #{start},#{count}
|
| | | </select>
|
| | |
|
| | | <select id="countByState" resultType="java.lang.Long"
|
| | | parameterType="java.lang.String">
|
| | | select
|
| | | count(*)
|
| | | from yeshi_ec_taobao_weiqaun_order
|
| | | <if test="state!=null">where tmo_state like '${state}%'</if>
|
| | | </select>
|
| | | |
| | | |
| | | <select id="selectByOrderItem" resultMap="BaseResultMap" parameterType="java.lang.String">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_taobao_weiqaun_order
|
| | | where tmo_order_item_id=#{0}
|
| | | </select>
|
| | |
|
| | |
|
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
|
| | | yeshi_ec_taobao_weiqaun_order where tmo_id = #{id,jdbcType=BIGINT}
|
| | | </delete>
|
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder"
|
| | | useGeneratedKeys="true" keyProperty="id">insert into
|
| | | yeshi_ec_taobao_weiqaun_order
|
| | | (tmo_id,tmo_order_id,tmo_order_item_id,tmo_goods_name,tmo_money,tmo_fan_money,tmo_state,tmo_jiesuan_time,tmo_weiquan_time,tmo_weiquan_finish_time,tmo_createtime,tmo_updatetime,tmo_settlement)
|
| | | values
|
| | | (#{id,jdbcType=BIGINT},#{orderId,jdbcType=VARCHAR},#{orderItemId,jdbcType=VARCHAR},#{goodsName,jdbcType=VARCHAR},#{money,jdbcType=DECIMAL},#{fanMoney,jdbcType=DECIMAL},#{state,jdbcType=VARCHAR},#{jieSuanTime,jdbcType=TIMESTAMP},#{weiQuanTime,jdbcType=TIMESTAMP},#{weiQuanFinishTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{settlement,jdbcType=DECIMAL})
|
| | | </insert>
|
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder"
|
| | | useGeneratedKeys="true" keyProperty="id">
|
| | | insert into yeshi_ec_taobao_weiqaun_order
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">tmo_id,</if>
|
| | | <if test="orderId != null">tmo_order_id,</if>
|
| | | <if test="orderItemId != null">tmo_order_item_id,</if>
|
| | | <if test="goodsName != null">tmo_goods_name,</if>
|
| | | <if test="money != null">tmo_money,</if>
|
| | | <if test="fanMoney != null">tmo_fan_money,</if>
|
| | | <if test="state != null">tmo_state,</if>
|
| | | <if test="jieSuanTime != null">tmo_jiesuan_time,</if>
|
| | | <if test="weiQuanTime != null">tmo_weiquan_time,</if>
|
| | | <if test="weiQuanFinishTime != null">tmo_weiquan_finish_time,</if>
|
| | | <if test="createTime != null">tmo_createtime,</if>
|
| | | <if test="updateTime != null">tmo_updatetime,</if>
|
| | | <if test="settlement != null">tmo_settlement,</if>
|
| | | </trim>
|
| | | values
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if>
|
| | | <if test="orderId != null">#{orderId,jdbcType=VARCHAR},</if>
|
| | | <if test="orderItemId != null">#{orderItemId,jdbcType=VARCHAR},</if>
|
| | | <if test="goodsName != null">#{goodsName,jdbcType=VARCHAR},</if>
|
| | | <if test="money != null">#{money,jdbcType=DECIMAL},</if>
|
| | | <if test="fanMoney != null">#{fanMoney,jdbcType=DECIMAL},</if>
|
| | | <if test="state != null">#{state,jdbcType=VARCHAR},</if>
|
| | | <if test="jieSuanTime != null">#{jieSuanTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="weiQuanTime != null">#{weiQuanTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="weiQuanFinishTime != null">#{weiQuanFinishTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="settlement != null">#{settlement,jdbcType=DECIMAL}</if>
|
| | | </trim>
|
| | | </insert>
|
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder">update
|
| | | yeshi_ec_taobao_weiqaun_order set tmo_order_id =
|
| | | #{orderId,jdbcType=VARCHAR},tmo_order_item_id =
|
| | | #{orderItemId,jdbcType=VARCHAR},tmo_goods_name =
|
| | | #{goodsName,jdbcType=VARCHAR},tmo_money =
|
| | | #{money,jdbcType=DECIMAL},tmo_fan_money =
|
| | | #{fanMoney,jdbcType=DECIMAL},tmo_state =
|
| | | #{state,jdbcType=VARCHAR},tmo_jiesuan_time =
|
| | | #{jieSuanTime,jdbcType=TIMESTAMP},tmo_weiquan_time =
|
| | | #{weiQuanTime,jdbcType=TIMESTAMP},tmo_weiquan_finish_time =
|
| | | #{weiQuanFinishTime,jdbcType=TIMESTAMP},tmo_createtime =
|
| | | #{createTime,jdbcType=TIMESTAMP},tmo_updatetime =
|
| | | #{updateTime,jdbcType=TIMESTAMP} ,tmo_settlement
|
| | | =#{settlement,jdbcType=DECIMAL} where tmo_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder">
|
| | | update yeshi_ec_taobao_weiqaun_order
|
| | | <set>
|
| | | <if test="orderId != null">tmo_order_id=#{orderId,jdbcType=VARCHAR},</if>
|
| | | <if test="orderItemId != null">tmo_order_item_id=#{orderItemId,jdbcType=VARCHAR},</if>
|
| | | <if test="goodsName != null">tmo_goods_name=#{goodsName,jdbcType=VARCHAR},</if>
|
| | | <if test="money != null">tmo_money=#{money,jdbcType=DECIMAL},</if>
|
| | | <if test="fanMoney != null">tmo_fan_money=#{fanMoney,jdbcType=DECIMAL},</if>
|
| | | <if test="state != null">tmo_state=#{state,jdbcType=VARCHAR},</if>
|
| | | <if test="jieSuanTime != null">tmo_jiesuan_time=#{jieSuanTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="weiQuanTime != null">tmo_weiquan_time=#{weiQuanTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="weiQuanFinishTime != null">tmo_weiquan_finish_time=#{weiQuanFinishTime,jdbcType=TIMESTAMP},
|
| | | </if>
|
| | | <if test="createTime != null">tmo_createtime=#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="updateTime != null">tmo_updatetime=#{updateTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="settlement !=null">tmo_settlement =#{settlement,jdbcType=DECIMAL},</if>
|
| | | </set>
|
| | | where tmo_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | <sql id="Column_DateType">
|
| | | <if test="dateType == 1">DATE_FORMAT(t.`tmo_weiquan_time`,'%Y-%m-%d') AS 'showDate'
|
| | | </if>
|
| | | <if test="dateType == 2">DATE_FORMAT(t.`tmo_weiquan_time`,'%m') AS 'showDate'</if>
|
| | | <if test="dateType == 3">DATE_FORMAT(t.`tmo_weiquan_time`,'%Y') AS 'showDate'</if>
|
| | | </sql>
|
| | | <sql id="Count_Select_DateType">
|
| | | <if test="startTime != null and startTime != '' ">
|
| | | AND DATE_FORMAT(t.`tmo_weiquan_time`,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
|
| | | </if>
|
| | | <if test="endTime != null and endTime != '' ">
|
| | | AND DATE_FORMAT(t.`tmo_weiquan_time`,'%Y-%m-%d') <![CDATA[ <= ]]>'${endTime}'
|
| | | </if>
|
| | | <if test="year != null and year != '' ">AND DATE_FORMAT(t.`tmo_weiquan_time`,'%Y') = '${year}'
|
| | | </if>
|
| | | </sql>
|
| | | <sql id="Count_Group_DateType">
|
| | | <if test="dateType == 1">GROUP BY DATE_FORMAT(t.`tmo_weiquan_time`,'%Y-%m-%d')</if>
|
| | | <if test="dateType == 2">GROUP BY DATE_FORMAT(t.`tmo_weiquan_time`,'%Y-%m')</if>
|
| | | <if test="dateType == 3">GROUP BY DATE_FORMAT(t.`tmo_weiquan_time`,'%Y')</if>
|
| | | </sql>
|
| | | <select id="countWeiQaunOrderNumber" resultMap="ChartMap">
|
| | | SELECT IFNULL(COUNT(t.`tmo_id`),0) AS showValue,
|
| | | <include refid="Column_DateType" />
|
| | | FROM yeshi_ec_taobao_weiqaun_order t WHERE t.`tmo_createtime`IS NOT
|
| | | NULL
|
| | | <include refid="Count_Select_DateType" />
|
| | | <include refid="Count_Group_DateType" />
|
| | | ORDER BY t.`tmo_weiquan_time`
|
| | | </select>
|
| | | <select id="countWeiQaunOrderMoney" resultMap="ChartMap">
|
| | | SELECT CAST(SUM(t.`tmo_fan_money`)AS DECIMAL(19,2)) AS showValue,
|
| | | <include refid="Column_DateType" />
|
| | | FROM yeshi_ec_taobao_weiqaun_order t WHERE t.`tmo_createtime` IS NOT
|
| | | NULL
|
| | | <include refid="Count_Select_DateType" />
|
| | | <include refid="Count_Group_DateType" />
|
| | | ORDER BY t.`tmo_weiquan_time`
|
| | | </select>
|
| | | </mapper>
|
| | |
| | |
|
| | | @Resource
|
| | | private OrderUserStatisticService orderUserStatisticService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private ExtractWeiXinRecordService extractWeiXinRecordService;
|
| | | |
| | |
|
| | | @Transactional
|
| | | public Integer addExtract(Extract extract) {
|
| | |
| | | * @param extract
|
| | | * @param session
|
| | | */
|
| | | //TODO 转账逻辑需要改变,固定IP
|
| | | // TODO 转账逻辑需要改变,固定IP
|
| | | @Transactional
|
| | | private void extractByZhiFuBao(Extract extract, AdminUser adminUser) {
|
| | | LogHelper.userErrorInfo("提现:开始通过提现-"+extract.getId());
|
| | | LogHelper.userErrorInfo("提现:开始通过提现-" + extract.getId());
|
| | | String privateKey = Constant.alipayConfig.getPrivateKey();
|
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do",
|
| | | Constant.alipayConfig.getAppId(), privateKey, "json", "gbk", null, "RSA2");
|
| | | AlipayFundTransToaccountTransferRequest request = new AlipayFundTransToaccountTransferRequest();
|
| | | String appName = Constant.systemCommonConfig.getProjectChineseName();
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("out_biz_no", "widthdraw_"+extract.getId());//最长长度64位,支持英文,下划线,数字
|
| | | json.put("out_biz_no", "widthdraw_" + extract.getId());// 最长长度64位,支持英文,下划线,数字
|
| | | json.put("payee_type", "ALIPAY_LOGONID");
|
| | | json.put("payee_account", extract.getAccount());
|
| | | json.put("amount", extract.getMoney());
|
| | |
| | | AlipayFundTransToaccountTransferResponse response = null;
|
| | | try {
|
| | | response = alipayClient.execute(request);
|
| | | LogHelper.userErrorInfo("提现:支付宝通过提现成功-"+extract.getId());
|
| | | LogHelper.userErrorInfo("提现:支付宝通过提现成功-" + extract.getId());
|
| | | } catch (AlipayApiException e) {
|
| | | e.printStackTrace();
|
| | | LogHelper.userErrorInfo("提现:支付宝提现异常:" + response + ",提现信息" + GsonUtil.toJson(extract));
|
| | |
| | |
|
| | | try {
|
| | | CMQManager.getInstance().addExtractResultMsg(extract, response, adminUser);
|
| | | LogHelper.userErrorInfo("提现:添加处理队列成功-"+extract.getId());
|
| | | LogHelper.userErrorInfo("提现:添加处理队列成功-" + extract.getId());
|
| | | } catch (Exception e) {
|
| | | LogHelper.userErrorInfo("提现:支付宝提现CMQ异常:" + new Gson().toJson(response) + ",提现信息" + GsonUtil.toJson(extract));
|
| | | LogHelper
|
| | | .userErrorInfo("提现:支付宝提现CMQ异常:" + new Gson().toJson(response) + ",提现信息" + GsonUtil.toJson(extract));
|
| | | }
|
| | | }
|
| | |
|
| | |
| | |
|
| | | // 更新提现记录审核表
|
| | | extractAuditRecordMapper.updateByPrimaryKeySelective(auditRecord);
|
| | | }
|
| | |
|
| | | // 外显账户明细
|
| | | UserMoneyDetail userMoneyDetail = userMoneyDetailMapper.selectByTypeAndUidAndIdentifyCode(
|
| | | UserMoneyDetailTypeEnum.extract, extract.getUserInfo().getId(), extract.getId());
|
| | | if (userMoneyDetail != null) {
|
| | | UserMoneyDetail detail = new UserMoneyDetail(userMoneyDetail.getId());
|
| | | detail.setShow(true);
|
| | | detail.setUpdateTime(new Date());
|
| | | userMoneyDetailMapper.updateByPrimaryKeySelective(detail);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal sumTodayApplyMoney(Long uid,String day) {
|
| | | return extractMapper.sumToadyApplyByUid(uid,day);
|
| | | 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)
|
| | | 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;
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void autoExtract(UserInfo user) {
|
| | | if (user == null || user.getWxOpenId() == null || user.getWxUnionId() == null ||
|
| | | user.getState() != UserInfo.STATE_NORMAL)
|
| | | if (user == null || user.getWxOpenId() == null || user.getWxUnionId() == null
|
| | | || user.getState() != UserInfo.STATE_NORMAL)
|
| | | return;
|
| | | |
| | |
|
| | | Date date = new Date();
|
| | | BigDecimal money = new BigDecimal(Constant.AUTO_EXTRACT_MONEY);
|
| | | |
| | |
|
| | | // 1、插入记录
|
| | | ExtractWeiXinRecord extractRecord = new ExtractWeiXinRecord();
|
| | | extractRecord.setUid(user.getId());
|
| | | extractRecord.setOpenId(user.getWxOpenId());
|
| | | extractRecord.setUnionId(user.getWxUnionId() );
|
| | | extractRecord.setUnionId(user.getWxUnionId());
|
| | | extractRecord.setMoney(money);
|
| | | extractRecord.setCreateTime(date);
|
| | | extractRecord.setUpdateTime(date);
|
| | | extractWeiXinRecordService.insertSelective(extractRecord);
|
| | | |
| | |
|
| | | // 交易号
|
| | | Long recordId = extractRecord.getId();
|
| | | String billno = "BanLiExtract" + recordId;
|
| | | |
| | |
|
| | | // 更新记录
|
| | | ExtractWeiXinRecord updeteRecord = null;
|
| | | |
| | |
|
| | | String mchId = "1520950211";
|
| | | String appId = "wx5c0d167c6e3ad726";
|
| | | String key = "XYJkJ2018FAfaodCCx899mLl138rfGVd";
|
| | | |
| | |
|
| | | // 2、发放微信红包
|
| | | RedPackParams redPackParams = new RedPackParams();
|
| | | redPackParams.setBillno(billno);
|
| | |
| | | redPackParams.setActName("自动提现");
|
| | | redPackParams.setKey(key);
|
| | | redPackParams.setRemark("微信自动提现");
|
| | | //redPackParams.setSceneId(null);
|
| | | //redPackParams.setRiskInfo(null);
|
| | | |
| | | |
| | | // redPackParams.setSceneId(null);
|
| | | // redPackParams.setRiskInfo(null);
|
| | |
|
| | | // 发生红包状态
|
| | | boolean stateRedPack = false;
|
| | | |
| | |
|
| | | String pwd = "1520950211";
|
| | | InputStream cert = ExtractServiceImpl.class.getClassLoader().getResourceAsStream("certificate/apiclient_cert.p12"); // 读取.p12文件
|
| | | InputStream cert = ExtractServiceImpl.class.getClassLoader()
|
| | | .getResourceAsStream("certificate/apiclient_cert.p12"); // 读取.p12文件
|
| | | // 执行发放红包
|
| | | try {
|
| | | String result = WXPayUtil.redPackToOpenId(redPackParams, pwd, cert);
|
| | | if (!StringUtil.isNullOrEmpty(result)) {
|
| | | stateRedPack = parseSendResult(result);
|
| | | }
|
| | | |
| | |
|
| | | if (!stateRedPack) {
|
| | | String redPackRecord = WXPayUtil.getRedPackRecord(billno, mchId, appId, key, pwd, cert);
|
| | | if (!StringUtil.isNullOrEmpty(redPackRecord)) {
|
| | |
| | | } catch (IOException e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | |
| | |
|
| | | // 更新信息
|
| | | if (updeteRecord == null) {
|
| | | updeteRecord = new ExtractWeiXinRecord();
|
| | | } else {
|
| | | stateRedPack = true;
|
| | | }
|
| | | |
| | |
|
| | | updeteRecord.setId(recordId);
|
| | | updeteRecord.setStatus(ExtractWeiXinRecord.SENDING);
|
| | | updeteRecord.setBillno(billno);
|
| | | extractWeiXinRecordService.updateByPrimaryKeySelective(updeteRecord);
|
| | | |
| | |
|
| | | // 红包发放失败
|
| | | if (!stateRedPack) |
| | | return; |
| | | |
| | | if (!stateRedPack)
|
| | | return;
|
| | |
|
| | | // 3、加入资金明细
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(new Date());
|
| | |
| | | } catch (UserMoneyDetailException e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | |
| | |
|
| | | // 4、发送消息通知
|
| | | String desc = "为保障你的账户余额安全,自动提现金额将不会高于5元";
|
| | | String beizu = "账户中剩余余额请在本App内完成提现";
|
| | | userMoneyMsgNotificationService.extractAuto(extractRecord, "未领取-提现中", desc, beizu);
|
| | | }
|
| | |
|
| | | |
| | | private boolean parseSendResult(String result) {
|
| | | try {
|
| | | Document document = DocumentHelper.parseText(result);
|
| | | // 获取根节点元素对象
|
| | | Element root = document.getRootElement();
|
| | | Element returnCode = root.element("return_code");
|
| | | |
| | | if (!"SUCCESS".equalsIgnoreCase(returnCode.getText())) {
|
| | | Element returnMsg = root.element("return_msg");
|
| | | System.out.println(returnMsg.getText()); |
| | | return false;
|
| | | } |
| | | |
| | | Element resultCode = root.element("result_code");
|
| | | if (!"SUCCESS".equalsIgnoreCase(resultCode.getText())) {
|
| | | Element errCode = root.element("err_code");
|
| | | Element errCodeDes = root.element("err_code_des");
|
| | | System.out.println(errCode.getText() + ":" + errCodeDes.getText()); |
| | | return false;
|
| | | }
|
| | | return true;
|
| | | Element root = document.getRootElement();
|
| | | Element returnCode = root.element("return_code");
|
| | |
|
| | | if (!"SUCCESS".equalsIgnoreCase(returnCode.getText())) {
|
| | | Element returnMsg = root.element("return_msg");
|
| | | System.out.println(returnMsg.getText());
|
| | | return false;
|
| | | }
|
| | |
|
| | | Element resultCode = root.element("result_code");
|
| | | if (!"SUCCESS".equalsIgnoreCase(resultCode.getText())) {
|
| | | Element errCode = root.element("err_code");
|
| | | Element errCodeDes = root.element("err_code_des");
|
| | | System.out.println(errCode.getText() + ":" + errCodeDes.getText());
|
| | | return false;
|
| | | }
|
| | | return true;
|
| | | } catch (DocumentException e) {
|
| | | e.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | return false;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | private ExtractWeiXinRecord parseDTO(String result) {
|
| | | try {
|
| | | |
| | |
|
| | | Document document = DocumentHelper.parseText(result);
|
| | | // 获取根节点元素对象
|
| | | Element root = document.getRootElement();
|
| | | Element returnCode = root.element("return_code");
|
| | | |
| | | if (!"SUCCESS".equalsIgnoreCase(returnCode.getText())) {
|
| | | Element returnMsg = root.element("return_msg");
|
| | | System.out.println(returnMsg.getText()); |
| | | return null;
|
| | | } |
| | | |
| | | Element resultCode = root.element("result_code");
|
| | | if (!"SUCCESS".equalsIgnoreCase(resultCode.getText())) {
|
| | | Element errCode = root.element("err_code");
|
| | | Element errCodeDes = root.element("err_code_des");
|
| | | System.out.println(errCode.getText() + ":" + errCodeDes.getText()); |
| | | }
|
| | | |
| | | ExtractWeiXinRecord resultRecord = new ExtractWeiXinRecord();
|
| | | resultRecord.setBillno(root.element("result_code").getText());
|
| | | resultRecord.setDetailno(root.element("detail_id").getText());
|
| | | resultRecord.setStatus(root.element("status").getText());
|
| | | resultRecord.setSendType(root.element("send_type").getText());
|
| | | resultRecord.setHbType(root.element("result_code").getText());
|
| | | |
| | | String totalNum = root.element("total_num").getText();
|
| | | resultRecord.setTotalNum(Integer.parseInt(totalNum));
|
| | | |
| | | String sendTime = root.element("send_time").getText();
|
| | | resultRecord.setSendTime(new Date(TimeUtil.convertDateToTemp2(sendTime)));
|
| | | |
| | | Element element = root.element("hblist");
|
| | | Iterator<?> iterator = element.elementIterator();
|
| | | while (iterator.hasNext()) {
|
| | | Element childElement = (Element)iterator.next();
|
| | | Element rcvTime = childElement.element("rcv_time");
|
| | | resultRecord.setRcvTime(new Date(TimeUtil.convertDateToTemp2(rcvTime.getText())));
|
| | | break;
|
| | | } |
| | | return resultRecord;
|
| | | |
| | | Element root = document.getRootElement();
|
| | | Element returnCode = root.element("return_code");
|
| | |
|
| | | if (!"SUCCESS".equalsIgnoreCase(returnCode.getText())) {
|
| | | Element returnMsg = root.element("return_msg");
|
| | | System.out.println(returnMsg.getText());
|
| | | return null;
|
| | | }
|
| | |
|
| | | Element resultCode = root.element("result_code");
|
| | | if (!"SUCCESS".equalsIgnoreCase(resultCode.getText())) {
|
| | | Element errCode = root.element("err_code");
|
| | | Element errCodeDes = root.element("err_code_des");
|
| | | System.out.println(errCode.getText() + ":" + errCodeDes.getText());
|
| | | }
|
| | |
|
| | | ExtractWeiXinRecord resultRecord = new ExtractWeiXinRecord();
|
| | | resultRecord.setBillno(root.element("result_code").getText());
|
| | | resultRecord.setDetailno(root.element("detail_id").getText());
|
| | | resultRecord.setStatus(root.element("status").getText());
|
| | | resultRecord.setSendType(root.element("send_type").getText());
|
| | | resultRecord.setHbType(root.element("result_code").getText());
|
| | |
|
| | | String totalNum = root.element("total_num").getText();
|
| | | resultRecord.setTotalNum(Integer.parseInt(totalNum));
|
| | |
|
| | | String sendTime = root.element("send_time").getText();
|
| | | resultRecord.setSendTime(new Date(TimeUtil.convertDateToTemp2(sendTime)));
|
| | |
|
| | | Element element = root.element("hblist");
|
| | | Iterator<?> iterator = element.elementIterator();
|
| | | while (iterator.hasNext()) {
|
| | | Element childElement = (Element) iterator.next();
|
| | | Element rcvTime = childElement.element("rcv_time");
|
| | | resultRecord.setRcvTime(new Date(TimeUtil.convertDateToTemp2(rcvTime.getText())));
|
| | | break;
|
| | | }
|
| | | return resultRecord;
|
| | |
|
| | | } catch (DocumentException e) {
|
| | | e.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | return null;
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public List<UserInfo> preAutoUser() throws Exception {
|
| | | int page = 0;
|
| | |
| | | String receivedDate = DateUtil.reduceDayTostring(30, nowDate);
|
| | | // 条件4:距离上一次未成功领取微信红包已经超过了15天时间,可在第16天再次下发;
|
| | | String refundDate = DateUtil.reduceDayTostring(15, nowDate);
|
| | | |
| | |
|
| | | // 余额最低限制
|
| | | BigDecimal minSurplus = BigDecimal.valueOf(Constant.AUTO_EXTRACT_MIN_SURPLUS);
|
| | | |
| | |
|
| | | List<UserInfo> list = new ArrayList<UserInfo>();
|
| | | |
| | |
|
| | | while (true) {
|
| | | // 查询满足条件 1、2 的uid
|
| | | List<UserInfo> listUser = userInfoService.getAutoExtractUser(page * pageSize, pageSize, minSurplus, beganDate, endDate);
|
| | | List<UserInfo> listUser = userInfoService.getAutoExtractUser(page * pageSize, pageSize, minSurplus,
|
| | | beganDate, endDate);
|
| | | if (listUser == null || listUser.isEmpty())
|
| | | break;
|
| | | |
| | |
|
| | | List<Long> listId = new ArrayList<Long>();
|
| | | for (UserInfo userInfo: listUser) {
|
| | | for (UserInfo userInfo : listUser) {
|
| | | listId.add(userInfo.getId());
|
| | | }
|
| | | |
| | |
|
| | | // 查询记录是否满足
|
| | | List<Long> listValid = extractWeiXinRecordService.getValidUsers(listId, receivedDate, refundDate);
|
| | | if (listValid == null || listValid.isEmpty()) {
|
| | | page ++;
|
| | | page++;
|
| | | continue;
|
| | | }
|
| | | |
| | | for (Long uid: listValid) {
|
| | |
|
| | | for (Long uid : listValid) {
|
| | | if (list.size() >= maxSize)
|
| | | break;
|
| | | for (UserInfo userInfo: listUser) {
|
| | | for (UserInfo userInfo : listUser) {
|
| | | if (list.size() >= maxSize)
|
| | | break;
|
| | | |
| | |
|
| | | if (userInfo.getId().longValue() == uid.longValue()) {
|
| | | list.add(userInfo);
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | if (list.size() >= maxSize)
|
| | | break;
|
| | | |
| | | page ++;
|
| | |
|
| | | page++;
|
| | | }
|
| | | return list;
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public List<String> getAutoExtractOpenIds() throws Exception {
|
| | | int page = 0;
|
| | |
| | | String receivedDate = DateUtil.reduceDayTostring(30, nowDate);
|
| | | // 条件4:距离上一次未成功领取微信红包已经超过了15天时间,可在第16天再次下发;
|
| | | String refundDate = DateUtil.reduceDayTostring(15, nowDate);
|
| | | |
| | |
|
| | | // 提现金额
|
| | | BigDecimal money = BigDecimal.valueOf(Constant.AUTO_EXTRACT_MONEY);
|
| | | // 余额最低限制
|
| | | BigDecimal minSurplus = BigDecimal.valueOf(Constant.AUTO_EXTRACT_MIN_SURPLUS);
|
| | | |
| | |
|
| | | List<String> listOpendIDs = new ArrayList<String>();
|
| | | // 首行appID
|
| | | listOpendIDs.add(Constant.getWXAccount(null, null).getAppId());
|
| | | |
| | |
|
| | | while (true) {
|
| | | // 查询满足条件 1、2 的uid
|
| | | List<UserInfo> listUser = userInfoService.getAutoExtractUser(page * pageSize, pageSize, minSurplus, beganDate, endDate);
|
| | | List<UserInfo> listUser = userInfoService.getAutoExtractUser(page * pageSize, pageSize, minSurplus,
|
| | | beganDate, endDate);
|
| | | if (listUser == null || listUser.isEmpty())
|
| | | break;
|
| | | |
| | |
|
| | | List<Long> listId = new ArrayList<Long>();
|
| | | for (UserInfo userInfo: listUser) {
|
| | | for (UserInfo userInfo : listUser) {
|
| | | listId.add(userInfo.getId());
|
| | | }
|
| | | |
| | |
|
| | | // 查询记录是否满足
|
| | | List<Long> listValid = extractWeiXinRecordService.getValidUsers(listId, receivedDate, refundDate);
|
| | | if (listValid == null || listValid.isEmpty()) {
|
| | | page ++;
|
| | | page++;
|
| | | continue;
|
| | | }
|
| | | |
| | | for (Long uid: listValid) {
|
| | |
|
| | | for (Long uid : listValid) {
|
| | | UserInfo userInfo = subHongBaoByUid(uid, money, minSurplus);
|
| | | if (userInfo != null) {
|
| | | listOpendIDs.add(userInfo.getWxOpenId());
|
| | |
| | | break;
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | if (listOpendIDs.size() >= maxSize)
|
| | | break;
|
| | | |
| | | page ++;
|
| | |
|
| | | page++;
|
| | | }
|
| | | return listOpendIDs;
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | private UserInfo subHongBaoByUid(Long uid, BigDecimal money, BigDecimal minSurplus) {
|
| | | UserInfo userInfo = userInfoMapper.selectByPrimaryKeyForUpdate(uid);
|
| | | if (userInfo != null && !StringUtil.isNullOrEmpty(userInfo.getWxOpenId())
|
| | | && !StringUtil.isNullOrEmpty(userInfo.getWxUnionId()) && userInfo.getMyHongBao().compareTo(minSurplus) >= 0) {
|
| | | && !StringUtil.isNullOrEmpty(userInfo.getWxUnionId())
|
| | | && userInfo.getMyHongBao().compareTo(minSurplus) >= 0) {
|
| | | // 微信提现记录
|
| | | ExtractWeiXinRecord extractRecord = new ExtractWeiXinRecord();
|
| | | extractRecord.setUid(uid);
|
| | |
| | | extractWeiXinRecordService.insertSelective(extractRecord);
|
| | | // 记录id
|
| | | Long recordId = extractRecord.getId();
|
| | | |
| | |
|
| | | // 资金明细
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.extractAutoWX.name() + ":" + recordId));
|
| | | detail.setMoney(new BigDecimal("-"+ money.toString()));
|
| | | detail.setMoney(new BigDecimal("-" + money.toString()));
|
| | | detail.setTitle(UserMoneyDetailTypeEnum.extractAutoWX.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.extractAutoWX);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(userInfo);
|
| | | |
| | |
|
| | | // 资金计算
|
| | | userMoneyService.subUserMoney(userInfo.getId(), money, detail);
|
| | |
|
| | |
| | | String desc = "为保障你的账户余额安全,自动提现金额将不会高于5元";
|
| | | String beizu = "账户中剩余余额请在本App内完成提现";
|
| | | userMoneyMsgNotificationService.extractAuto(extractRecord, "未领取-提现中", desc, beizu);
|
| | | |
| | |
|
| | | // 满足条件返回信息
|
| | | return userInfo;
|
| | | }
|
| | | return null;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public void updateManualExtractRecord(List<RedPackRecord> list) throws ExtractException{
|
| | | public void updateManualExtractRecord(List<RedPackRecord> list) throws ExtractException {
|
| | | if (list == null || list.isEmpty())
|
| | | throw new ExtractException(1, "红包记录信息为空");
|
| | | |
| | | for (RedPackRecord redPackRecord: list) {
|
| | |
|
| | | for (RedPackRecord redPackRecord : list) {
|
| | | updateWeiXinRecord(redPackRecord);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | private void updateWeiXinRecord(RedPackRecord redPackRecord){
|
| | | private void updateWeiXinRecord(RedPackRecord redPackRecord) {
|
| | | if (StringUtil.isNullOrEmpty(redPackRecord.getOpenId()))
|
| | | return;
|
| | | |
| | | ExtractWeiXinRecord record = extractWeiXinRecordService.getByOpenIdAndType(redPackRecord.getOpenId(), ExtractWeiXinRecord.TYPE_MANUAL);
|
| | |
|
| | | ExtractWeiXinRecord record = extractWeiXinRecordService.getByOpenIdAndType(redPackRecord.getOpenId(),
|
| | | ExtractWeiXinRecord.TYPE_MANUAL);
|
| | | if (record == null)
|
| | | return;
|
| | | |
| | |
|
| | | // 状态过滤
|
| | | String statusOld = record.getStatus();
|
| | | if (StringUtil.isNullOrEmpty(statusOld) || ExtractWeiXinRecord.REFUND.equals(statusOld) |
| | | || ExtractWeiXinRecord.RECEIVED.equals(statusOld)) |
| | | if (StringUtil.isNullOrEmpty(statusOld) || ExtractWeiXinRecord.REFUND.equals(statusOld)
|
| | | || ExtractWeiXinRecord.RECEIVED.equals(statusOld))
|
| | | return;
|
| | | |
| | |
|
| | | ExtractWeiXinRecord updeteRecord = new ExtractWeiXinRecord();
|
| | | updeteRecord.setId(record.getId());
|
| | | updeteRecord.setUpdateTime(new Date());
|
| | | |
| | |
|
| | | String billno = redPackRecord.getBillno();
|
| | | if (!StringUtil.isNullOrEmpty(billno)) {
|
| | | updeteRecord.setBillno(billno.replace("`", ""));
|
| | | }
|
| | | |
| | |
|
| | | String detailno = redPackRecord.getDetailno();
|
| | | if (!StringUtil.isNullOrEmpty(detailno)) {
|
| | | updeteRecord.setDetailno(detailno.replace("`", ""));
|
| | | }
|
| | | |
| | |
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm");
|
| | | String rcvTime = redPackRecord.getRcvTime();
|
| | | if (!StringUtil.isNullOrEmpty(rcvTime)) {
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | String sendTime = redPackRecord.getSendTime();
|
| | | if (!StringUtil.isNullOrEmpty(sendTime)) {
|
| | | try {
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | String status = redPackRecord.getStatus();
|
| | | if (!StringUtil.isNullOrEmpty(status)) {
|
| | | switch (status) {
|
| | | case "已发放待领取":
|
| | | status = ExtractWeiXinRecord.SENT;
|
| | | break;
|
| | | case "过期未领退款":
|
| | | status = ExtractWeiXinRecord.REFUND;
|
| | | break;
|
| | | case "已领取":
|
| | | status = ExtractWeiXinRecord.RECEIVED;
|
| | | break;
|
| | | default:
|
| | | status = null;
|
| | | break;
|
| | | } |
| | | case "已发放待领取":
|
| | | status = ExtractWeiXinRecord.SENT;
|
| | | break;
|
| | | case "过期未领退款":
|
| | | status = ExtractWeiXinRecord.REFUND;
|
| | | break;
|
| | | case "已领取":
|
| | | status = ExtractWeiXinRecord.RECEIVED;
|
| | | break;
|
| | | default:
|
| | | status = null;
|
| | | break;
|
| | | }
|
| | | }
|
| | | updeteRecord.setStatus(status);
|
| | | extractWeiXinRecordService.updateByPrimaryKeySelective(updeteRecord);
|
| | | |
| | |
|
| | | if (ExtractWeiXinRecord.RECEIVED.equals(status)) {
|
| | | // 发送消息通知
|
| | | userMoneyMsgNotificationService.extractAuto(record, "已领取-已提现", null, null);
|
| | |
| | | // 资金明细
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.extractAutoWXRefund.name() + ":" + record.getId()));
|
| | | detail.setIdentifyCode(
|
| | | StringUtil.Md5(UserMoneyDetailTypeEnum.extractAutoWXRefund.name() + ":" + record.getId()));
|
| | | detail.setMoney(record.getMoney());
|
| | | detail.setTitle(UserMoneyDetailTypeEnum.extractAutoWXRefund.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.extractAutoWXRefund);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(new UserInfo(record.getUid()));
|
| | | |
| | |
|
| | | // 资金计算
|
| | | userMoneyService.addUserMoney(record.getUid(), record.getMoney(), detail);
|
| | | |
| | |
|
| | | // 发送消息通知
|
| | | userMoneyMsgNotificationService.extractAuto(record, "已退回-余额中", null, null);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | |
| | | List<TaoBaoWeiQuanOrder> list = taoBaoWeiQuanOrderService.getWeiQuanSuccessOrders(orderId);
|
| | | if (list == null || list.size() == 0)
|
| | | return;
|
| | | // 查询还未扣款的主红包
|
| | | List<HongBaoV2> mainHongBaoList = new ArrayList<>();
|
| | | for (TaoBaoWeiQuanOrder weiQuanOrder : list) {
|
| | | List<CommonOrder> orderList = commonOrderMapper.listBySourceTypeAndTradeId(Constant.SOURCE_TYPE_TAOBAO,
|
| | | weiQuanOrder.getOrderItemId());
|
| | | if (orderList != null && orderList.size() > 0)
|
| | | for (CommonOrder commonOrder : orderList) {
|
| | | // 修改订单状态为维权
|
| | | CommonOrder co = new CommonOrder(commonOrder.getId());
|
| | | co.setState(CommonOrder.STATE_WQ);
|
| | | co.setUpdateTime(new Date());
|
| | | commonOrderMapper.updateByPrimaryKeySelective(co);
|
| | |
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(commonOrder.getId());
|
| | | if (hongBaoOrder.getCommonOrder() != null
|
| | | && !StringUtil.isNullOrEmpty(hongBaoOrder.getCommonOrder().getTradeId()))
|
| | | // 查询是否已经维权
|
| | | {
|
| | | TaoBaoWeiQuanDrawBack drawBack = taoBaoWeiQuanDrawBackMapper.selectByOrderItemIdAndUid(
|
| | | hongBaoOrder.getCommonOrder().getTradeId(),
|
| | | hongBaoOrder.getHongBaoV2().getUserInfo().getId());
|
| | | if (drawBack == null)// 添加还未扣款的子订单
|
| | | mainHongBaoList.add(hongBaoOrder.getHongBaoV2());
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | | List<HongBaoV2> mainHongBaoList = getWeiQuanMainHongBao(list, orderId);
|
| | |
|
| | | if (mainHongBaoList == null || mainHongBaoList.size() == 0)
|
| | | return;
|
| | | for (int i = 0; i < mainHongBaoList.size(); i++) {
|
| | | //锁行,防止重复 操作
|
| | | // 锁行,防止重复 操作
|
| | | HongBaoV2 hb = hongBaoV2Mapper.selectByPrimaryKeyForUpdate(mainHongBaoList.get(i).getId());
|
| | | mainHongBaoList.set(i, hb);
|
| | | // 只处理返利订单
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private List<HongBaoV2> getWeiQuanMainHongBao(List<TaoBaoWeiQuanOrder> list, String orderId) {
|
| | | // 查询是否为维权订单
|
| | | if (list == null || list.size() == 0)
|
| | | return null;
|
| | | // 获取和该订单号有关联的用户
|
| | | // 查询还未扣款的主红包
|
| | | List<HongBaoV2> mainHongBaoList = new ArrayList<>();
|
| | | for (TaoBaoWeiQuanOrder weiQuanOrder : list) {
|
| | | List<CommonOrder> orderList = commonOrderMapper.listBySourceTypeAndTradeId(Constant.SOURCE_TYPE_TAOBAO,
|
| | | weiQuanOrder.getOrderItemId());
|
| | | if (orderList != null && orderList.size() > 0)
|
| | | for (CommonOrder commonOrder : orderList) {
|
| | | // 修改订单状态为维权
|
| | | CommonOrder co = new CommonOrder(commonOrder.getId());
|
| | | co.setState(CommonOrder.STATE_WQ);
|
| | | co.setUpdateTime(new Date());
|
| | | commonOrderMapper.updateByPrimaryKeySelective(co);
|
| | |
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(commonOrder.getId());
|
| | | if (hongBaoOrder.getCommonOrder() != null
|
| | | && !StringUtil.isNullOrEmpty(hongBaoOrder.getCommonOrder().getTradeId()))
|
| | | // 查询是否已经维权
|
| | | {
|
| | | TaoBaoWeiQuanDrawBack drawBack = taoBaoWeiQuanDrawBackMapper.selectByOrderItemIdAndUid(
|
| | | hongBaoOrder.getCommonOrder().getTradeId(),
|
| | | hongBaoOrder.getHongBaoV2().getUserInfo().getId());
|
| | | if (drawBack == null)// 添加还未扣款的子订单
|
| | | mainHongBaoList.add(hongBaoOrder.getHongBaoV2());
|
| | | }
|
| | | }
|
| | | }
|
| | | return mainHongBaoList;
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void doWeiQuanShare(String orderId) throws TaoBaoWeiQuanException {
|
| | | if (StringUtil.isNullOrEmpty(orderId))
|
| | | throw new TaoBaoWeiQuanException(1, "订单号为空值");
|
| | | // 查询是否为维权订单
|
| | | List<TaoBaoWeiQuanOrder> list = taoBaoWeiQuanOrderService.getWeiQuanSuccessOrders(orderId);
|
| | | if (list == null || list.size() == 0)
|
| | | return;
|
| | | // 获取和该订单号有关联的用户
|
| | | // 获取主红包(同一个订单号的单只会对应同一个用户)
|
| | | List<CommonOrderVO> typeList = new ArrayList<>();
|
| | | CommonOrderVO cv = new CommonOrderVO();
|
| | | cv.setSourceType(Constant.SOURCE_TYPE_TAOBAO);
|
| | | cv.setOrderNo(orderId);
|
| | | typeList.add(cv);
|
| | |
|
| | | List<CommonOrderVO> commonOrderList = commonOrderMapper.listOrderGoodsInfo(typeList);
|
| | | List<HongBaoV2> mainHongBaoList = new ArrayList<>();
|
| | | if (commonOrderList != null)
|
| | | for (CommonOrderVO vo : commonOrderList) {
|
| | | // 更改订单状态
|
| | | CommonOrder co = new CommonOrder(vo.getId());
|
| | | co.setState(CommonOrder.STATE_WQ);
|
| | | co.setUpdateTime(new Date());
|
| | | commonOrderMapper.updateByPrimaryKeySelective(co);
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(vo.getId());
|
| | | if (hongBaoOrder.getCommonOrder() != null
|
| | | && !StringUtil.isNullOrEmpty(hongBaoOrder.getCommonOrder().getTradeId()))
|
| | | // 查询是否已经维权
|
| | | {
|
| | | TaoBaoWeiQuanDrawBack drawBack = taoBaoWeiQuanDrawBackMapper.selectByOrderItemIdAndUid(
|
| | | hongBaoOrder.getCommonOrder().getTradeId(),
|
| | | hongBaoOrder.getHongBaoV2().getUserInfo().getId());
|
| | | if (drawBack == null)// 添加还未扣款的子订单
|
| | | mainHongBaoList.add(hongBaoOrder.getHongBaoV2());
|
| | | }
|
| | | }
|
| | | List<TaoBaoWeiQuanOrder> list = taoBaoWeiQuanOrderService.getWeiQuanSuccessOrders(orderId);
|
| | | if(list==null||list.size()==0)
|
| | | return;
|
| | | List<HongBaoV2> mainHongBaoList = getWeiQuanMainHongBao(list, orderId);
|
| | |
|
| | | if (mainHongBaoList == null || mainHongBaoList.size() == 0)
|
| | | return;
|
| | |
| | | detail.setType(UserMoneyDetailTypeEnum.extract);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(extract.getUserInfo());
|
| | | detail.setShow(false);
|
| | | return detail;
|
| | | }
|
| | |
|
| | |
| | | detail.setType(UserMoneyDetailTypeEnum.extractReject);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(extract.getUserInfo());
|
| | | detail.setShow(false);// 隐藏提现失败记录
|
| | | return detail;
|
| | | }
|
| | |
|
| | |
| | | detail.setIdentifyCode(
|
| | | StringUtil.Md5(UserMoneyDetailTypeEnum.subsidy.name() + "-" + orderType + "-" + uid + "-" + timeF));
|
| | | detail.setMoney(money);
|
| | | detail.setTitle(timeF + UserMoneyDetailTypeEnum.subsidy.getDesc()+"["+Constant.getSourceName(orderType)+"]");
|
| | | detail.setTitle(
|
| | | timeF + UserMoneyDetailTypeEnum.subsidy.getDesc() + "[" + Constant.getSourceName(orderType) + "]");
|
| | | detail.setType(UserMoneyDetailTypeEnum.subsidy);
|
| | | detail.setDescInfo("邀请订单补贴");
|
| | | detail.setUpdateTime(new Date());
|