Commit d8ff60eb by yinyong

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

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