Commit 2a4347de by wutong

CRM退款数据重新获取

parent 00a9e7e1
......@@ -11,7 +11,7 @@ public class RefundItem {
@JSONField(name = "ID")
private Integer id;
private Integer crmId;
@JSONField(name = "PlatformName")
private String platformType;
@JSONField(name = "SellerAccount")
......
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.bailuntec.domain.constant.CommonConstant;
import com.bailuntec.domain.entity.DcBaseCrmRefund;
import com.bailuntec.domain.entity.JobPointLog;
import com.bailuntec.domain.example.DcBaseCrmRefundExample;
import com.bailuntec.domain.pojo.RefundDetails;
import com.bailuntec.domain.pojo.RefundItem;
import com.bailuntec.mapper.DcBaseCrmRefundMapper;
......@@ -77,11 +78,13 @@ public class CrmRefundSyncJob extends PointJob {
e.printStackTrace();
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();
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("MYBATIS操作DB异常", e);
} finally {
SessionUtil.closeSession();
......
......@@ -23,6 +23,7 @@
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" />
<result column="linked" jdbcType="BIT" property="linked" />
<result column="amount_refund_rmb" jdbcType="DECIMAL" property="amountRefundRmb" />
<result column="crm_id" jdbcType="INTEGER" property="crmId" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
......@@ -97,7 +98,7 @@
-->
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_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>
<select id="selectByExample" parameterType="com.bailuntec.domain.example.DcBaseCrmRefundExample" resultMap="BaseResultMap">
<!--
......@@ -163,13 +164,15 @@
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)
linked, amount_refund_rmb, crm_id
)
values (#{id,jdbcType=INTEGER}, #{platformType,jdbcType=VARCHAR}, #{bailunAccount,jdbcType=VARCHAR},
#{bailunAccountId,jdbcType=INTEGER}, #{website,jdbcType=VARCHAR}, #{originOrderId,jdbcType=VARCHAR},
#{bailunSku,jdbcType=VARCHAR}, #{platformSku,jdbcType=VARCHAR}, #{amountRefund,jdbcType=DECIMAL},
#{orderCurrency,jdbcType=VARCHAR}, #{refundTime,jdbcType=TIMESTAMP}, #{bailunSkuQuantityRefund,jdbcType=INTEGER},
#{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 id="insertSelective" parameterType="com.bailuntec.domain.entity.DcBaseCrmRefund">
<!--
......@@ -229,6 +232,9 @@
<if test="amountRefundRmb != null">
amount_refund_rmb,
</if>
<if test="crmId != null">
crm_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
......@@ -282,6 +288,9 @@
<if test="amountRefundRmb != null">
#{amountRefundRmb,jdbcType=DECIMAL},
</if>
<if test="crmId != null">
#{crmId,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.bailuntec.domain.example.DcBaseCrmRefundExample" resultType="java.lang.Long">
......@@ -352,6 +361,9 @@
<if test="record.amountRefundRmb != null">
amount_refund_rmb = #{record.amountRefundRmb,jdbcType=DECIMAL},
</if>
<if test="record.crmId != null">
crm_id = #{record.crmId,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
......@@ -379,7 +391,8 @@
gmt_create = #{record.gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{record.gmtModified,jdbcType=TIMESTAMP},
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">
<include refid="Update_By_Example_Where_Clause" />
</if>
......@@ -439,6 +452,9 @@
<if test="amountRefundRmb != null">
amount_refund_rmb = #{amountRefundRmb,jdbcType=DECIMAL},
</if>
<if test="crmId != null">
crm_id = #{crmId,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
......@@ -463,7 +479,8 @@
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
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}
</update>
<insert id="upsertSelective" parameterType="com.bailuntec.domain.entity.DcBaseCrmRefund">
......@@ -525,6 +542,9 @@
<if test="amountRefundRmb != null">
amount_refund_rmb,
</if>
<if test="crmId != null">
crm_id,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
......@@ -579,6 +599,9 @@
<if test="amountRefundRmb != null">
#{amountRefundRmb,jdbcType=DECIMAL},
</if>
<if test="crmId != null">
#{crmId,jdbcType=INTEGER},
</if>
</trim>
on duplicate key update
<trim suffixOverrides=",">
......@@ -633,6 +656,9 @@
<if test="amountRefundRmb != null">
amount_refund_rmb = #{amountRefundRmb,jdbcType=DECIMAL},
</if>
<if test="crmId != null">
crm_id = #{crmId,jdbcType=INTEGER},
</if>
</trim>
</insert>
<insert id="upsert" parameterType="com.bailuntec.domain.entity.DcBaseCrmRefund">
......@@ -644,14 +670,16 @@
insert into dc_base_crm_refund
(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_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
(#{id,jdbcType=INTEGER}, #{platformType,jdbcType=VARCHAR}, #{bailunAccount,jdbcType=VARCHAR},
#{bailunAccountId,jdbcType=INTEGER}, #{website,jdbcType=VARCHAR}, #{originOrderId,jdbcType=VARCHAR},
#{bailunSku,jdbcType=VARCHAR}, #{platformSku,jdbcType=VARCHAR}, #{amountRefund,jdbcType=DECIMAL},
#{orderCurrency,jdbcType=VARCHAR}, #{refundTime,jdbcType=TIMESTAMP}, #{bailunSkuQuantityRefund,jdbcType=INTEGER},
#{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
id = #{id,jdbcType=INTEGER},
platform_type = #{platformType,jdbcType=VARCHAR},
......@@ -669,7 +697,8 @@
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
linked = #{linked,jdbcType=BIT},
amount_refund_rmb = #{amountRefundRmb,jdbcType=DECIMAL}
amount_refund_rmb = #{amountRefundRmb,jdbcType=DECIMAL},
crm_id = #{crmId,jdbcType=INTEGER}
</insert>
<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