Commit 2a4347de by wutong

CRM退款数据重新获取

parent 00a9e7e1
...@@ -11,7 +11,7 @@ public class RefundItem { ...@@ -11,7 +11,7 @@ public class RefundItem {
@JSONField(name = "ID") @JSONField(name = "ID")
private Integer id; private Integer crmId;
@JSONField(name = "PlatformName") @JSONField(name = "PlatformName")
private String platformType; private String platformType;
@JSONField(name = "SellerAccount") @JSONField(name = "SellerAccount")
......
...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.bailuntec.domain.constant.CommonConstant; import com.bailuntec.domain.constant.CommonConstant;
import com.bailuntec.domain.entity.DcBaseCrmRefund; import com.bailuntec.domain.entity.DcBaseCrmRefund;
import com.bailuntec.domain.entity.JobPointLog; import com.bailuntec.domain.entity.JobPointLog;
import com.bailuntec.domain.example.DcBaseCrmRefundExample;
import com.bailuntec.domain.pojo.RefundDetails; import com.bailuntec.domain.pojo.RefundDetails;
import com.bailuntec.domain.pojo.RefundItem; import com.bailuntec.domain.pojo.RefundItem;
import com.bailuntec.mapper.DcBaseCrmRefundMapper; import com.bailuntec.mapper.DcBaseCrmRefundMapper;
...@@ -77,11 +78,13 @@ public class CrmRefundSyncJob extends PointJob { ...@@ -77,11 +78,13 @@ public class CrmRefundSyncJob extends PointJob {
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException("CRM退款BeanUtils.copyProperties失败", e); throw new RuntimeException("CRM退款BeanUtils.copyProperties失败", e);
} }
mapper.upsertSelective(dcBaseCrmRefund); int i = mapper.updateByExampleSelective(dcBaseCrmRefund, DcBaseCrmRefundExample.newAndCreateCriteria().andCrmIdEqualTo(dcBaseCrmRefund.getCrmId()).example());
if (i == 0) {
mapper.insertSelective(dcBaseCrmRefund);
}
SessionUtil.getSession().commit(); SessionUtil.getSession().commit();
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("MYBATIS操作DB异常", e); throw new RuntimeException("MYBATIS操作DB异常", e);
} finally { } finally {
SessionUtil.closeSession(); SessionUtil.closeSession();
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" /> <result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" />
<result column="linked" jdbcType="BIT" property="linked" /> <result column="linked" jdbcType="BIT" property="linked" />
<result column="amount_refund_rmb" jdbcType="DECIMAL" property="amountRefundRmb" /> <result column="amount_refund_rmb" jdbcType="DECIMAL" property="amountRefundRmb" />
<result column="crm_id" jdbcType="INTEGER" property="crmId" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<!-- <!--
...@@ -97,7 +98,7 @@ ...@@ -97,7 +98,7 @@
--> -->
id, platform_type, bailun_account, bailun_account_id, website, origin_order_id, bailun_sku, id, platform_type, bailun_account, bailun_account_id, website, origin_order_id, bailun_sku,
platform_sku, amount_refund, order_currency, refund_time, bailun_sku_quantity_refund, platform_sku, amount_refund, order_currency, refund_time, bailun_sku_quantity_refund,
bailun_sku_unit_price, gmt_create, gmt_modified, linked, amount_refund_rmb bailun_sku_unit_price, gmt_create, gmt_modified, linked, amount_refund_rmb, crm_id
</sql> </sql>
<select id="selectByExample" parameterType="com.bailuntec.domain.example.DcBaseCrmRefundExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.bailuntec.domain.example.DcBaseCrmRefundExample" resultMap="BaseResultMap">
<!-- <!--
...@@ -163,13 +164,15 @@ ...@@ -163,13 +164,15 @@
bailun_sku, platform_sku, amount_refund, bailun_sku, platform_sku, amount_refund,
order_currency, refund_time, bailun_sku_quantity_refund, order_currency, refund_time, bailun_sku_quantity_refund,
bailun_sku_unit_price, gmt_create, gmt_modified, bailun_sku_unit_price, gmt_create, gmt_modified,
linked, amount_refund_rmb) linked, amount_refund_rmb, crm_id
)
values (#{id,jdbcType=INTEGER}, #{platformType,jdbcType=VARCHAR}, #{bailunAccount,jdbcType=VARCHAR}, values (#{id,jdbcType=INTEGER}, #{platformType,jdbcType=VARCHAR}, #{bailunAccount,jdbcType=VARCHAR},
#{bailunAccountId,jdbcType=INTEGER}, #{website,jdbcType=VARCHAR}, #{originOrderId,jdbcType=VARCHAR}, #{bailunAccountId,jdbcType=INTEGER}, #{website,jdbcType=VARCHAR}, #{originOrderId,jdbcType=VARCHAR},
#{bailunSku,jdbcType=VARCHAR}, #{platformSku,jdbcType=VARCHAR}, #{amountRefund,jdbcType=DECIMAL}, #{bailunSku,jdbcType=VARCHAR}, #{platformSku,jdbcType=VARCHAR}, #{amountRefund,jdbcType=DECIMAL},
#{orderCurrency,jdbcType=VARCHAR}, #{refundTime,jdbcType=TIMESTAMP}, #{bailunSkuQuantityRefund,jdbcType=INTEGER}, #{orderCurrency,jdbcType=VARCHAR}, #{refundTime,jdbcType=TIMESTAMP}, #{bailunSkuQuantityRefund,jdbcType=INTEGER},
#{bailunSkuUnitPrice,jdbcType=DECIMAL}, #{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP}, #{bailunSkuUnitPrice,jdbcType=DECIMAL}, #{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP},
#{linked,jdbcType=BIT}, #{amountRefundRmb,jdbcType=DECIMAL}) #{linked,jdbcType=BIT}, #{amountRefundRmb,jdbcType=DECIMAL}, #{crmId,jdbcType=INTEGER}
)
</insert> </insert>
<insert id="insertSelective" parameterType="com.bailuntec.domain.entity.DcBaseCrmRefund"> <insert id="insertSelective" parameterType="com.bailuntec.domain.entity.DcBaseCrmRefund">
<!-- <!--
...@@ -229,6 +232,9 @@ ...@@ -229,6 +232,9 @@
<if test="amountRefundRmb != null"> <if test="amountRefundRmb != null">
amount_refund_rmb, amount_refund_rmb,
</if> </if>
<if test="crmId != null">
crm_id,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
...@@ -282,6 +288,9 @@ ...@@ -282,6 +288,9 @@
<if test="amountRefundRmb != null"> <if test="amountRefundRmb != null">
#{amountRefundRmb,jdbcType=DECIMAL}, #{amountRefundRmb,jdbcType=DECIMAL},
</if> </if>
<if test="crmId != null">
#{crmId,jdbcType=INTEGER},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.bailuntec.domain.example.DcBaseCrmRefundExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="com.bailuntec.domain.example.DcBaseCrmRefundExample" resultType="java.lang.Long">
...@@ -352,6 +361,9 @@ ...@@ -352,6 +361,9 @@
<if test="record.amountRefundRmb != null"> <if test="record.amountRefundRmb != null">
amount_refund_rmb = #{record.amountRefundRmb,jdbcType=DECIMAL}, amount_refund_rmb = #{record.amountRefundRmb,jdbcType=DECIMAL},
</if> </if>
<if test="record.crmId != null">
crm_id = #{record.crmId,jdbcType=INTEGER},
</if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
...@@ -379,7 +391,8 @@ ...@@ -379,7 +391,8 @@
gmt_create = #{record.gmtCreate,jdbcType=TIMESTAMP}, gmt_create = #{record.gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{record.gmtModified,jdbcType=TIMESTAMP}, gmt_modified = #{record.gmtModified,jdbcType=TIMESTAMP},
linked = #{record.linked,jdbcType=BIT}, linked = #{record.linked,jdbcType=BIT},
amount_refund_rmb = #{record.amountRefundRmb,jdbcType=DECIMAL} amount_refund_rmb = #{record.amountRefundRmb,jdbcType=DECIMAL},
crm_id = #{record.crmId,jdbcType=INTEGER}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
...@@ -439,6 +452,9 @@ ...@@ -439,6 +452,9 @@
<if test="amountRefundRmb != null"> <if test="amountRefundRmb != null">
amount_refund_rmb = #{amountRefundRmb,jdbcType=DECIMAL}, amount_refund_rmb = #{amountRefundRmb,jdbcType=DECIMAL},
</if> </if>
<if test="crmId != null">
crm_id = #{crmId,jdbcType=INTEGER},
</if>
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
...@@ -463,7 +479,8 @@ ...@@ -463,7 +479,8 @@
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}, gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
linked = #{linked,jdbcType=BIT}, linked = #{linked,jdbcType=BIT},
amount_refund_rmb = #{amountRefundRmb,jdbcType=DECIMAL} amount_refund_rmb = #{amountRefundRmb,jdbcType=DECIMAL},
crm_id = #{crmId,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<insert id="upsertSelective" parameterType="com.bailuntec.domain.entity.DcBaseCrmRefund"> <insert id="upsertSelective" parameterType="com.bailuntec.domain.entity.DcBaseCrmRefund">
...@@ -525,6 +542,9 @@ ...@@ -525,6 +542,9 @@
<if test="amountRefundRmb != null"> <if test="amountRefundRmb != null">
amount_refund_rmb, amount_refund_rmb,
</if> </if>
<if test="crmId != null">
crm_id,
</if>
</trim> </trim>
values values
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
...@@ -579,6 +599,9 @@ ...@@ -579,6 +599,9 @@
<if test="amountRefundRmb != null"> <if test="amountRefundRmb != null">
#{amountRefundRmb,jdbcType=DECIMAL}, #{amountRefundRmb,jdbcType=DECIMAL},
</if> </if>
<if test="crmId != null">
#{crmId,jdbcType=INTEGER},
</if>
</trim> </trim>
on duplicate key update on duplicate key update
<trim suffixOverrides=","> <trim suffixOverrides=",">
...@@ -633,6 +656,9 @@ ...@@ -633,6 +656,9 @@
<if test="amountRefundRmb != null"> <if test="amountRefundRmb != null">
amount_refund_rmb = #{amountRefundRmb,jdbcType=DECIMAL}, amount_refund_rmb = #{amountRefundRmb,jdbcType=DECIMAL},
</if> </if>
<if test="crmId != null">
crm_id = #{crmId,jdbcType=INTEGER},
</if>
</trim> </trim>
</insert> </insert>
<insert id="upsert" parameterType="com.bailuntec.domain.entity.DcBaseCrmRefund"> <insert id="upsert" parameterType="com.bailuntec.domain.entity.DcBaseCrmRefund">
...@@ -644,14 +670,16 @@ ...@@ -644,14 +670,16 @@
insert into dc_base_crm_refund insert into dc_base_crm_refund
(id, platform_type, bailun_account, bailun_account_id, website, origin_order_id, (id, platform_type, bailun_account, bailun_account_id, website, origin_order_id,
bailun_sku, platform_sku, amount_refund, order_currency, refund_time, bailun_sku_quantity_refund, bailun_sku, platform_sku, amount_refund, order_currency, refund_time, bailun_sku_quantity_refund,
bailun_sku_unit_price, gmt_create, gmt_modified, linked, amount_refund_rmb) bailun_sku_unit_price, gmt_create, gmt_modified, linked, amount_refund_rmb, crm_id
)
values values
(#{id,jdbcType=INTEGER}, #{platformType,jdbcType=VARCHAR}, #{bailunAccount,jdbcType=VARCHAR}, (#{id,jdbcType=INTEGER}, #{platformType,jdbcType=VARCHAR}, #{bailunAccount,jdbcType=VARCHAR},
#{bailunAccountId,jdbcType=INTEGER}, #{website,jdbcType=VARCHAR}, #{originOrderId,jdbcType=VARCHAR}, #{bailunAccountId,jdbcType=INTEGER}, #{website,jdbcType=VARCHAR}, #{originOrderId,jdbcType=VARCHAR},
#{bailunSku,jdbcType=VARCHAR}, #{platformSku,jdbcType=VARCHAR}, #{amountRefund,jdbcType=DECIMAL}, #{bailunSku,jdbcType=VARCHAR}, #{platformSku,jdbcType=VARCHAR}, #{amountRefund,jdbcType=DECIMAL},
#{orderCurrency,jdbcType=VARCHAR}, #{refundTime,jdbcType=TIMESTAMP}, #{bailunSkuQuantityRefund,jdbcType=INTEGER}, #{orderCurrency,jdbcType=VARCHAR}, #{refundTime,jdbcType=TIMESTAMP}, #{bailunSkuQuantityRefund,jdbcType=INTEGER},
#{bailunSkuUnitPrice,jdbcType=DECIMAL}, #{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP}, #{bailunSkuUnitPrice,jdbcType=DECIMAL}, #{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP},
#{linked,jdbcType=BIT}, #{amountRefundRmb,jdbcType=DECIMAL}) #{linked,jdbcType=BIT}, #{amountRefundRmb,jdbcType=DECIMAL}, #{crmId,jdbcType=INTEGER}
)
on duplicate key update on duplicate key update
id = #{id,jdbcType=INTEGER}, id = #{id,jdbcType=INTEGER},
platform_type = #{platformType,jdbcType=VARCHAR}, platform_type = #{platformType,jdbcType=VARCHAR},
...@@ -669,7 +697,8 @@ ...@@ -669,7 +697,8 @@
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}, gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
linked = #{linked,jdbcType=BIT}, linked = #{linked,jdbcType=BIT},
amount_refund_rmb = #{amountRefundRmb,jdbcType=DECIMAL} amount_refund_rmb = #{amountRefundRmb,jdbcType=DECIMAL},
crm_id = #{crmId,jdbcType=INTEGER}
</insert> </insert>
<select id="selectOneByExample" parameterType="com.bailuntec.domain.example.DcBaseCrmRefundExample" resultMap="BaseResultMap"> <select id="selectOneByExample" parameterType="com.bailuntec.domain.example.DcBaseCrmRefundExample" resultMap="BaseResultMap">
<!-- <!--
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment