Commit d8ff60eb by yinyong

数据中心--CRM退款是否系统订单整形修改为字符串

parent 308dc8b2
...@@ -58,5 +58,5 @@ public class RefundItem { ...@@ -58,5 +58,5 @@ public class RefundItem {
@JSONField(name = "shipping_status") @JSONField(name = "shipping_status")
private String shippingStatus; private String shippingStatus;
@JSONField(name = "refund_type") @JSONField(name = "refund_type")
private Integer refundType; private String refundType;
} }
package com.bailuntec.job; package com.bailuntec.job;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.bailuntec.domain.constant.CommonConstant;
import com.bailuntec.domain.entity.DcBaseCrmRefund; import com.bailuntec.domain.entity.DcBaseCrmRefund;
import com.bailuntec.domain.entity.DcBaseOmsOrder; import com.bailuntec.domain.entity.DcBaseOmsOrder;
import com.bailuntec.domain.entity.JobPointLog; import com.bailuntec.domain.entity.JobPointLog;
import com.bailuntec.domain.example.DcBaseCrmRefundExample; import com.bailuntec.domain.example.DcBaseCrmRefundExample;
import com.bailuntec.domain.example.DcBaseOmsOrderExample; import com.bailuntec.domain.example.DcBaseOmsOrderExample;
import com.bailuntec.domain.pojo.RefundDetails;
import com.bailuntec.domain.pojo.RefundItem;
import com.bailuntec.mapper.DcBaseCrmRefundMapper; import com.bailuntec.mapper.DcBaseCrmRefundMapper;
import com.bailuntec.mapper.DcBaseOmsOrderMapper; import com.bailuntec.mapper.DcBaseOmsOrderMapper;
import com.bailuntec.support.PointJob; import com.bailuntec.support.PointJob;
import com.bailuntec.utils.OkHttpUtil;
import com.bailuntec.utils.PropertiesUtil;
import com.bailuntec.utils.SessionUtil; import com.bailuntec.utils.SessionUtil;
import com.dangdang.ddframe.job.api.ShardingContext; import com.dangdang.ddframe.job.api.ShardingContext;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils;
import java.io.IOException;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List; import java.util.List;
@Slf4j @Slf4j
public class CrmStatusSyncJob extends PointJob { public class CrmStatusSyncJob extends PointJob {
private PropertiesUtil propertiesUtil = PropertiesUtil.getInstance("const");
private OkHttpClient client = OkHttpUtil.getInstance();
@Override @Override
public void executeJob(ShardingContext shardingContext, JobPointLog jobPointLog) { public void executeJob(ShardingContext shardingContext, JobPointLog jobPointLog) {
LocalDate localDate = LocalDate.now(); DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM");
long count = count(localDate); LocalDate localDate1 = LocalDate.now();
String localDateStr = fmt.format(localDate1);
long count = count(localDateStr);
long totalPage = count % jobPointLog.getPageSize() == 0 ? count/jobPointLog.getPageSize() : count/jobPointLog.getPageSize() + 1 ; long totalPage = count % jobPointLog.getPageSize() == 0 ? count/jobPointLog.getPageSize() : count/jobPointLog.getPageSize() + 1 ;
do{ do{
DcBaseCrmRefundMapper dcBaseCrmRefundMapper = SessionUtil.getSession().getMapper(DcBaseCrmRefundMapper.class); DcBaseCrmRefundMapper dcBaseCrmRefundMapper = SessionUtil.getSession().getMapper(DcBaseCrmRefundMapper.class);
List<DcBaseCrmRefund> dcBaseCrmRefundList = dcBaseCrmRefundMapper.selectByRefundDate(localDate, jobPointLog.getPageIndex()*jobPointLog.getPageSize(), jobPointLog.getPageSize()); List<DcBaseCrmRefund> dcBaseCrmRefundList = dcBaseCrmRefundMapper.selectByRefundDate(localDateStr, jobPointLog.getPageIndex()*jobPointLog.getPageSize(), jobPointLog.getPageSize());
try { try {
for (DcBaseCrmRefund dcBaseCrmRefund : dcBaseCrmRefundList) { for (DcBaseCrmRefund dcBaseCrmRefund : dcBaseCrmRefundList) {
DcBaseOmsOrderMapper omsOrderMapper = SessionUtil.getSession().getMapper(DcBaseOmsOrderMapper.class); DcBaseOmsOrderMapper omsOrderMapper = SessionUtil.getSession().getMapper(DcBaseOmsOrderMapper.class);
...@@ -73,7 +57,6 @@ public class CrmStatusSyncJob extends PointJob { ...@@ -73,7 +57,6 @@ public class CrmStatusSyncJob extends PointJob {
} }
} }
} }
DcBaseCrmRefundMapper mapper = SessionUtil.getSession().getMapper(DcBaseCrmRefundMapper.class); DcBaseCrmRefundMapper mapper = SessionUtil.getSession().getMapper(DcBaseCrmRefundMapper.class);
int i = mapper.updateByExampleSelective(dcBaseCrmRefund, DcBaseCrmRefundExample.newAndCreateCriteria().andCrmIdEqualTo(dcBaseCrmRefund.getCrmId()).example()); int i = mapper.updateByExampleSelective(dcBaseCrmRefund, DcBaseCrmRefundExample.newAndCreateCriteria().andCrmIdEqualTo(dcBaseCrmRefund.getCrmId()).example());
if (i == 0) { if (i == 0) {
...@@ -87,18 +70,15 @@ public class CrmStatusSyncJob extends PointJob { ...@@ -87,18 +70,15 @@ public class CrmStatusSyncJob extends PointJob {
SessionUtil.closeSession(); SessionUtil.closeSession();
} }
}while (jobPointLog.getPageIndex() < totalPage); }while (jobPointLog.getPageIndex() < totalPage);
jobPointLog.setPageIndex(0);
jobPointLog.setGmtModified(LocalDateTime.now());
jobPointLog.setPageIndex(1);
jobPointLog.setStartTime(jobPointLog.getEndTime());
jobPointLog.setEndTime(jobPointLog.getEndTime().plusDays(jobPointLog.getIntervalTime()).isAfter(LocalDateTime.now()) ? LocalDateTime.now() : jobPointLog.getEndTime().plusDays(jobPointLog.getIntervalTime()));
} }
public long count(LocalDate localDate) { public long count(String localDateStr) {
long count = 0; long count = 0;
try{ try{
DcBaseCrmRefundMapper dcBaseCrmRefundMapper = SessionUtil.getSession().getMapper(DcBaseCrmRefundMapper.class); DcBaseCrmRefundMapper dcBaseCrmRefundMapper = SessionUtil.getSession().getMapper(DcBaseCrmRefundMapper.class);
count = dcBaseCrmRefundMapper.countByDate(localDate); count = dcBaseCrmRefundMapper.countByDate(localDateStr);
}catch (Exception e){ }catch (Exception e){
throw new RuntimeException("MYBATIS操作DB异常", e); throw new RuntimeException("MYBATIS操作DB异常", e);
}finally { }finally {
......
...@@ -257,7 +257,7 @@ public class DcBaseCrmRefund { ...@@ -257,7 +257,7 @@ public class DcBaseCrmRefund {
* *
* @mbg.generated * @mbg.generated
*/ */
private Integer refundType; private String refundType;
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
......
...@@ -2091,52 +2091,62 @@ public class DcBaseCrmRefundExample { ...@@ -2091,52 +2091,62 @@ public class DcBaseCrmRefundExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andRefundTypeEqualTo(Integer value) { public Criteria andRefundTypeEqualTo(String value) {
addCriterion("refund_type =", value, "refundType"); addCriterion("refund_type =", value, "refundType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andRefundTypeNotEqualTo(Integer value) { public Criteria andRefundTypeNotEqualTo(String value) {
addCriterion("refund_type <>", value, "refundType"); addCriterion("refund_type <>", value, "refundType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andRefundTypeGreaterThan(Integer value) { public Criteria andRefundTypeGreaterThan(String value) {
addCriterion("refund_type >", value, "refundType"); addCriterion("refund_type >", value, "refundType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andRefundTypeGreaterThanOrEqualTo(Integer value) { public Criteria andRefundTypeGreaterThanOrEqualTo(String value) {
addCriterion("refund_type >=", value, "refundType"); addCriterion("refund_type >=", value, "refundType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andRefundTypeLessThan(Integer value) { public Criteria andRefundTypeLessThan(String value) {
addCriterion("refund_type <", value, "refundType"); addCriterion("refund_type <", value, "refundType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andRefundTypeLessThanOrEqualTo(Integer value) { public Criteria andRefundTypeLessThanOrEqualTo(String value) {
addCriterion("refund_type <=", value, "refundType"); addCriterion("refund_type <=", value, "refundType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andRefundTypeIn(List<Integer> values) { public Criteria andRefundTypeLike(String value) {
addCriterion("refund_type like", value, "refundType");
return (Criteria) this;
}
public Criteria andRefundTypeNotLike(String value) {
addCriterion("refund_type not like", value, "refundType");
return (Criteria) this;
}
public Criteria andRefundTypeIn(List<String> values) {
addCriterion("refund_type in", values, "refundType"); addCriterion("refund_type in", values, "refundType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andRefundTypeNotIn(List<Integer> values) { public Criteria andRefundTypeNotIn(List<String> values) {
addCriterion("refund_type not in", values, "refundType"); addCriterion("refund_type not in", values, "refundType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andRefundTypeBetween(Integer value1, Integer value2) { public Criteria andRefundTypeBetween(String value1, String value2) {
addCriterion("refund_type between", value1, value2, "refundType"); addCriterion("refund_type between", value1, value2, "refundType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andRefundTypeNotBetween(Integer value1, Integer value2) { public Criteria andRefundTypeNotBetween(String value1, String value2) {
addCriterion("refund_type not between", value1, value2, "refundType"); addCriterion("refund_type not between", value1, value2, "refundType");
return (Criteria) this; return (Criteria) this;
} }
......
...@@ -123,7 +123,7 @@ public interface DcBaseCrmRefundMapper { ...@@ -123,7 +123,7 @@ public interface DcBaseCrmRefundMapper {
*/ */
int upsertSelective(DcBaseCrmRefund record); int upsertSelective(DcBaseCrmRefund record);
List<DcBaseCrmRefund> selectByRefundDate(@Param("localDate") LocalDate localDate, @Param("v1") Integer v1, @Param("v2") Integer v2); List<DcBaseCrmRefund> selectByRefundDate(@Param("localDateStr") String localDateStr, @Param("v1") Integer v1, @Param("v2") Integer v2);
long countByDate(@Param("localDate") LocalDate localDate); long countByDate(@Param("localDateStr") String localDate);
} }
\ No newline at end of file
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<result column="is_freeze" jdbcType="BIT" property="isFreeze" /> <result column="is_freeze" jdbcType="BIT" property="isFreeze" />
<result column="order_status" jdbcType="VARCHAR" property="orderStatus" /> <result column="order_status" jdbcType="VARCHAR" property="orderStatus" />
<result column="shipping_status" jdbcType="VARCHAR" property="shippingStatus" /> <result column="shipping_status" jdbcType="VARCHAR" property="shippingStatus" />
<result column="refund_type" jdbcType="INTEGER" property="refundType" /> <result column="refund_type" jdbcType="VARCHAR" property="refundType" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<!-- <!--
...@@ -190,7 +190,7 @@ ...@@ -190,7 +190,7 @@
#{amountRefundUsd,jdbcType=DECIMAL}, #{companyId,jdbcType=INTEGER}, #{orderTotalAmount,jdbcType=DECIMAL}, #{amountRefundUsd,jdbcType=DECIMAL}, #{companyId,jdbcType=INTEGER}, #{orderTotalAmount,jdbcType=DECIMAL},
#{usdOrderTotalAmount,jdbcType=DECIMAL}, #{productSaleAmount,jdbcType=DECIMAL}, #{usdOrderTotalAmount,jdbcType=DECIMAL}, #{productSaleAmount,jdbcType=DECIMAL},
#{isDeleted,jdbcType=BIT}, #{isFreeze,jdbcType=BIT}, #{orderStatus,jdbcType=VARCHAR}, #{isDeleted,jdbcType=BIT}, #{isFreeze,jdbcType=BIT}, #{orderStatus,jdbcType=VARCHAR},
#{shippingStatus,jdbcType=VARCHAR}, #{refundType,jdbcType=INTEGER}) #{shippingStatus,jdbcType=VARCHAR}, #{refundType,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="com.bailuntec.domain.entity.DcBaseCrmRefund"> <insert id="insertSelective" parameterType="com.bailuntec.domain.entity.DcBaseCrmRefund">
<!-- <!--
...@@ -367,7 +367,7 @@ ...@@ -367,7 +367,7 @@
#{shippingStatus,jdbcType=VARCHAR}, #{shippingStatus,jdbcType=VARCHAR},
</if> </if>
<if test="refundType != null"> <if test="refundType != null">
#{refundType,jdbcType=INTEGER}, #{refundType,jdbcType=VARCHAR},
</if> </if>
</trim> </trim>
</insert> </insert>
...@@ -470,7 +470,7 @@ ...@@ -470,7 +470,7 @@
shipping_status = #{record.shippingStatus,jdbcType=VARCHAR}, shipping_status = #{record.shippingStatus,jdbcType=VARCHAR},
</if> </if>
<if test="record.refundType != null"> <if test="record.refundType != null">
refund_type = #{record.refundType,jdbcType=INTEGER}, refund_type = #{record.refundType,jdbcType=VARCHAR},
</if> </if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
...@@ -510,7 +510,7 @@ ...@@ -510,7 +510,7 @@
is_freeze = #{record.isFreeze,jdbcType=BIT}, is_freeze = #{record.isFreeze,jdbcType=BIT},
order_status = #{record.orderStatus,jdbcType=VARCHAR}, order_status = #{record.orderStatus,jdbcType=VARCHAR},
shipping_status = #{record.shippingStatus,jdbcType=VARCHAR}, shipping_status = #{record.shippingStatus,jdbcType=VARCHAR},
refund_type = #{record.refundType,jdbcType=INTEGER} refund_type = #{record.refundType,jdbcType=VARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
...@@ -601,7 +601,7 @@ ...@@ -601,7 +601,7 @@
shipping_status = #{shippingStatus,jdbcType=VARCHAR}, shipping_status = #{shippingStatus,jdbcType=VARCHAR},
</if> </if>
<if test="refundType != null"> <if test="refundType != null">
refund_type = #{refundType,jdbcType=INTEGER}, refund_type = #{refundType,jdbcType=VARCHAR},
</if> </if>
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
...@@ -638,7 +638,7 @@ ...@@ -638,7 +638,7 @@
is_freeze = #{isFreeze,jdbcType=BIT}, is_freeze = #{isFreeze,jdbcType=BIT},
order_status = #{orderStatus,jdbcType=VARCHAR}, order_status = #{orderStatus,jdbcType=VARCHAR},
shipping_status = #{shippingStatus,jdbcType=VARCHAR}, shipping_status = #{shippingStatus,jdbcType=VARCHAR},
refund_type = #{refundType,jdbcType=INTEGER} refund_type = #{refundType,jdbcType=VARCHAR}
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">
...@@ -818,7 +818,7 @@ ...@@ -818,7 +818,7 @@
#{shippingStatus,jdbcType=VARCHAR}, #{shippingStatus,jdbcType=VARCHAR},
</if> </if>
<if test="refundType != null"> <if test="refundType != null">
#{refundType,jdbcType=INTEGER}, #{refundType,jdbcType=VARCHAR},
</if> </if>
</trim> </trim>
on duplicate key update on duplicate key update
...@@ -905,7 +905,7 @@ ...@@ -905,7 +905,7 @@
shipping_status = #{shippingStatus,jdbcType=VARCHAR}, shipping_status = #{shippingStatus,jdbcType=VARCHAR},
</if> </if>
<if test="refundType != null"> <if test="refundType != null">
refund_type = #{refundType,jdbcType=INTEGER}, refund_type = #{refundType,jdbcType=VARCHAR},
</if> </if>
</trim> </trim>
</insert> </insert>
...@@ -931,7 +931,7 @@ ...@@ -931,7 +931,7 @@
#{amountRefundUsd,jdbcType=DECIMAL}, #{companyId,jdbcType=INTEGER}, #{orderTotalAmount,jdbcType=DECIMAL}, #{amountRefundUsd,jdbcType=DECIMAL}, #{companyId,jdbcType=INTEGER}, #{orderTotalAmount,jdbcType=DECIMAL},
#{usdOrderTotalAmount,jdbcType=DECIMAL}, #{productSaleAmount,jdbcType=DECIMAL}, #{usdOrderTotalAmount,jdbcType=DECIMAL}, #{productSaleAmount,jdbcType=DECIMAL},
#{isDeleted,jdbcType=BIT}, #{isFreeze,jdbcType=BIT}, #{orderStatus,jdbcType=VARCHAR}, #{isDeleted,jdbcType=BIT}, #{isFreeze,jdbcType=BIT}, #{orderStatus,jdbcType=VARCHAR},
#{shippingStatus,jdbcType=VARCHAR}, #{refundType,jdbcType=INTEGER}) #{shippingStatus,jdbcType=VARCHAR}, #{refundType,jdbcType=VARCHAR})
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},
...@@ -960,7 +960,7 @@ ...@@ -960,7 +960,7 @@
is_freeze = #{isFreeze,jdbcType=BIT}, is_freeze = #{isFreeze,jdbcType=BIT},
order_status = #{orderStatus,jdbcType=VARCHAR}, order_status = #{orderStatus,jdbcType=VARCHAR},
shipping_status = #{shippingStatus,jdbcType=VARCHAR}, shipping_status = #{shippingStatus,jdbcType=VARCHAR},
refund_type = #{refundType,jdbcType=INTEGER} refund_type = #{refundType,jdbcType=VARCHAR}
</insert> </insert>
<select id="selectOneByExample" parameterType="com.bailuntec.domain.example.DcBaseCrmRefundExample" resultMap="BaseResultMap"> <select id="selectOneByExample" parameterType="com.bailuntec.domain.example.DcBaseCrmRefundExample" resultMap="BaseResultMap">
<!-- <!--
...@@ -984,7 +984,7 @@ ...@@ -984,7 +984,7 @@
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from dc_base_crm_refund from dc_base_crm_refund
where date_format(refund_time, '%Y-%m') = date_format(#{localDate}, '%Y-%m') where date_format(refund_time, '%Y-%m') = #{localDateStr}
limit #{v1}, #{v2} limit #{v1}, #{v2}
</select> </select>
...@@ -992,6 +992,6 @@ ...@@ -992,6 +992,6 @@
select select
count(*) count(*)
from dc_base_crm_refund from dc_base_crm_refund
where date_format(refund_time, '%Y-%m') = date_format(#{localDate}, '%Y-%m') where date_format(refund_time, '%Y-%m') = #{localDateStr}
</select> </select>
</mapper> </mapper>
\ No newline at end of file
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