提交 0567e027 authored 作者: 吕本才's avatar 吕本才 提交者: Coding

Accept Merge Request #104: (qa -> master)

Merge Request: 上线财务成本统计需求 Created By: @吕本才 Accepted By: @吕本才 URL: https://g-pkkp8204.coding.net/p/wangxiaolu-sfa/d/wangxiaolu-sfa-module-job/git/merge/104?initial=true
......@@ -118,6 +118,7 @@
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
......
package com.sfa.job;
import com.sfa.common.security.annotation.EnableCustomConfig;
import com.sfa.common.security.annotation.EnableRyFeignClients;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import com.sfa.common.security.annotation.EnableCustomConfig;
import com.sfa.common.security.annotation.EnableRyFeignClients;
/**
* 定时任务
......@@ -14,7 +14,7 @@ import com.sfa.common.security.annotation.EnableRyFeignClients;
@EnableCustomConfig
@EnableRyFeignClients
@SpringBootApplication
@MapperScan({"com.sfa.job.domain.job.mapper","com.sfa.job.domain.system.mapper"})
@MapperScan({"com.sfa.job.domain.job.mapper","com.sfa.job.domain.system.mapper","com.sfa.job.domain.order.mapper"})
public class SfaJobApplication
{
public static void main(String[] args) {
......
package com.sfa.job.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Data
@Component
@ConfigurationProperties(prefix = "wangdiantong")
public class WangdiantongConfig {
private String url;
private String sid;
private String key;
private String salt;
private String appsecret;
}
package com.sfa.job.constants;
public class Constants {
/**
* 采集数据方式
*/
public static final String SYNC_TYPE_XXL_JOB = "xxl-job";
}
package com.sfa.job.controller.finance;
import cn.hutool.core.date.DateUtil;
import com.sfa.common.core.web.controller.BaseController;
import com.sfa.job.pojo.response.SyncOrderDetailDto;
import com.sfa.job.service.order.FinanceOrderSyncService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
/**
* 调度任务信息操作处理
*
* @author ruoyi
*/
@Slf4j
@RestController
@RequestMapping("/finance/order")
public class FinanceOrderDetailSyncController extends BaseController {
@Autowired
private FinanceOrderSyncService syncService;
@GetMapping("/syncWdtOrderDetail")
public SyncOrderDetailDto syncWangdiantongOrderDetail(Date startTime, Date endTime) {
log.info("接口开始同步-旺店通订单明细api接口数据");
// 可以传参开始时间和结束时间,用于补充特定时间的数据采集
SyncOrderDetailDto detailDto = syncService.syncWdtOrder(startTime, endTime, 1);
log.info("接口结束同步-旺店通订单明细api接口数据, 共同步订单{}条数据,订单明细{}条,订单批次号:{},订单的开始时间{}和结束时间{}",
detailDto.getOrderCount(),detailDto.getOrderDetailCount(),detailDto.getBatchNo(),
DateUtil.formatDateTime(detailDto.getStartTime()),DateUtil.formatDateTime(detailDto.getEndTime()) );
return detailDto;
}
@GetMapping("/updateZbjType")
public SyncOrderDetailDto updateZbjType(Date startTime, Date endTime) {
log.info("接口开始同步-旺店通订单明细api接口数据");
// 可以传参开始时间和结束时间,用于补充特定时间的数据采集
SyncOrderDetailDto detailDto = syncService.updateZbjType(startTime, endTime);
log.info("接口结束同步-旺店通订单明细api接口数据, 共同步订单{}条数据,订单明细{}条,订单批次号:{},订单的开始时间{}和结束时间{}",
detailDto.getOrderCount(),detailDto.getOrderDetailCount(),detailDto.getBatchNo(),
DateUtil.formatDateTime(detailDto.getStartTime()),DateUtil.formatDateTime(detailDto.getEndTime()) );
return detailDto;
}
@GetMapping("/syncWdtRefundOrder")
public SyncOrderDetailDto syncWdtRefundOrder(Date startTime, Date endTime) {
log.info("开始接口同步-旺店通退换订单明细api接口数据");
// 可以传参开始时间和结束时间,用于补充特定时间的数据采集
SyncOrderDetailDto detailDto = syncService.syncWdtRefundOrder(startTime, endTime, 1);
log.info("结束接口同步-旺店通退换订单明细api接口数据, 共同步退换货订单{}条数据,退换货订单明细{}条,退换货同步批次号:{},订单的开始时间{}和结束时间{},数量:{}",
detailDto.getOrderCount(),detailDto.getOrderDetailCount(),detailDto.getBatchNo(),
DateUtil.formatDateTime(detailDto.getStartTime()),DateUtil.formatDateTime(detailDto.getEndTime()),detailDto.getRemark() );
return detailDto;
}
}
package com.sfa.job.domain.order.dao;
import com.sfa.job.pojo.response.SyncOrderDetailDto;
public interface CollectErrorLogDao {
// 插入一条记录
void insert(SyncOrderDetailDto collectErrorLog);
}
package com.sfa.job.domain.order.dao;
import com.sfa.job.pojo.response.CollectOrderLogDto;
import com.sfa.job.pojo.response.SyncOrderDetailDto;
public interface CollectOrderLogDao {
// 插入一条记录
void insert(SyncOrderDetailDto collectOrderLog);
CollectOrderLogDto selectOrderSyncLatest(Integer syncType, String method);
}
package com.sfa.job.domain.order.dao;
import java.util.Map;
public interface FinanceBaseZbjTypeDao {
Map<String, String> selectBaseZbjType();
}
package com.sfa.job.domain.order.dao;
import com.sfa.job.domain.order.entity.FinanceOrder;
import java.util.List;
public interface FinanceOrderDao {
void saveOrUpdateBatch(List<FinanceOrder> mergeList);
}
package com.sfa.job.domain.order.dao;
import com.sfa.job.domain.order.entity.FinanceOrderDetail;
import java.util.List;
public interface FinanceOrderDetailDao {
void saveOrUpdateBatch(List<FinanceOrderDetail> mergeList);
}
package com.sfa.job.domain.order.dao;
import com.sfa.job.domain.order.entity.FinanceBaseProduct;
import java.util.Map;
public interface FinianceBaseProductDao {
Map<String, FinanceBaseProduct> selectBaseProduct();
}
package com.sfa.job.domain.order.dao;
import java.util.Map;
/**
* @author : liqiulin
* @date : 2024-11-22 16
* @describe :
*/
public interface IProductDao {
Map<String, String> selectProdSeries();
}
package com.sfa.job.domain.order.dao;
import com.sfa.job.domain.order.entity.WdtRefundAmountDetail;
import java.util.List;
public interface WdtRefundAmountDetailDao {
void saveOrUpdateBatch(List<WdtRefundAmountDetail> mergeList);
}
package com.sfa.job.domain.order.dao;
import com.sfa.job.domain.order.entity.WdtRefundOrder;
import java.util.List;
public interface WdtRefundOrderDao {
void saveOrUpdateBatch(List<WdtRefundOrder> mergeList);
}
package com.sfa.job.domain.order.dao;
import com.sfa.job.domain.order.entity.WdtRefundOrderDetail;
import java.util.List;
public interface WdtRefundOrderDetailDao {
void saveOrUpdateBatch(List<WdtRefundOrderDetail> mergeList);
}
package com.sfa.job.domain.order.dao;
import com.sfa.job.domain.order.entity.WdtSwapOrder;
import java.util.List;
public interface WdtSwapOrderDao {
void saveOrUpdateBatch(List<WdtSwapOrder> mergeList);
}
package com.sfa.job.domain.order.dao;
import com.sfa.job.domain.order.entity.WdtSwapOrderDetail;
import java.util.List;
public interface WdtSwapOrderDetailDao {
void saveOrUpdateBatch(List<WdtSwapOrderDetail> mergeList);
}
package com.sfa.job.domain.order.dao.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.sfa.job.constants.Constants;
import com.sfa.job.domain.order.dao.CollectErrorLogDao;
import com.sfa.job.domain.order.entity.CollectErrorLog;
import com.sfa.job.domain.order.mapper.CollectErrorLogMapper;
import com.sfa.job.pojo.response.SyncOrderDetailDto;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.Date;
@DS("bi")
@Repository
public class CollectErrorLogImpl implements CollectErrorLogDao {
@Autowired
private CollectErrorLogMapper collectErrorLogMapper;
@Override
public void insert(SyncOrderDetailDto detailDto) {
// 记录错误日志表 collect_error_info
CollectErrorLog errorInfo = new CollectErrorLog();
errorInfo.setBatchNo(detailDto.getBatchNo());
errorInfo.setType(Constants.SYNC_TYPE_XXL_JOB);
errorInfo.setErrorMsg(ObjectUtil.isNotEmpty(detailDto.getMessage())? StringUtils.substring(detailDto.getMessage(),0,2000):"");
errorInfo.setEndTime(detailDto.getEndTime());
errorInfo.setStartTime(detailDto.getStartTime());
errorInfo.setCollectTime(new Date());
collectErrorLogMapper.insert(errorInfo);
}
}
package com.sfa.job.domain.order.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.sfa.common.core.utils.bean.BeanUtils;
import com.sfa.job.domain.order.dao.CollectOrderLogDao;
import com.sfa.job.domain.order.entity.CollectOrderLog;
import com.sfa.job.domain.order.mapper.CollectOrderLogMapper;
import com.sfa.job.pojo.response.CollectOrderLogDto;
import com.sfa.job.pojo.response.SyncOrderDetailDto;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@DS("bi")
@Repository
public class CollectOrderLogDaoImpl implements CollectOrderLogDao {
@Autowired
private CollectOrderLogMapper logInfoMapper;
@Override
public void insert(SyncOrderDetailDto detailDto) {
CollectOrderLog collectOrderLog = new CollectOrderLog();
BeanUtils.copyProperties(detailDto,collectOrderLog);
collectOrderLog.setSyncType(detailDto.getSyncType());
collectOrderLog.setMethod(detailDto.getMethod());
collectOrderLog.setStartTime(detailDto.getStartTime());
collectOrderLog.setEndTime(detailDto.getEndTime());
collectOrderLog.setBatchNo(detailDto.getBatchNo());
collectOrderLog.setLatestTime(detailDto.getLatestTime() );
collectOrderLog.setPageNo(detailDto.getPageNo());
collectOrderLog.setTotalCount(detailDto.getTotalCount());
collectOrderLog.setRemark(detailDto.getRemark());
logInfoMapper.insert(collectOrderLog);
}
@Override
public CollectOrderLogDto selectOrderSyncLatest(Integer syncType, String method) {
// 查询最新发货日期
List<CollectOrderLog> orderList = logInfoMapper.selectList(
new LambdaQueryWrapper<CollectOrderLog>()
// 默认查询xxljob自动同步时间
.eq(CollectOrderLog::getSyncType,syncType)
.eq(CollectOrderLog::getMethod,method)
.eq(CollectOrderLog::getDelFlag,0)
.orderByDesc(CollectOrderLog::getUpdateTime)
.last("LIMIT 1"));
if(ObjectUtils.isNotEmpty(orderList)){
// 最新的数据日期
CollectOrderLog collectOrderLog = orderList.get(0);
return BeanUtils.transitionDto(collectOrderLog, CollectOrderLogDto.class);
}
return null;
}
}
package com.sfa.job.domain.order.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.sfa.job.domain.order.dao.FinianceBaseProductDao;
import com.sfa.job.domain.order.entity.FinanceBaseProduct;
import com.sfa.job.domain.order.mapper.FinanceBaseProductMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@DS("bi")
@Repository
public class FinianceBaseProductDaoImpl implements FinianceBaseProductDao {
@Autowired
FinanceBaseProductMapper mapper;
@Override
public Map<String, FinanceBaseProduct> selectBaseProduct() {
// 查询所有商品
List<FinanceBaseProduct> list = mapper.selectList(new LambdaQueryWrapper<>()) ;
// 以料号为key,商品对象为value,放入map中
Map<String, FinanceBaseProduct> map = list.stream()
.collect(HashMap::new, (k, v) -> k.put(v.getPrdCode(), v), HashMap::putAll);
return map;
}
}
package com.sfa.job.domain.order.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.sfa.job.domain.order.dao.FinanceBaseZbjTypeDao;
import com.sfa.job.domain.order.entity.FinanceBaseZbjType;
import com.sfa.job.domain.order.mapper.FinanceBaseZbjTypeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@DS("bi")
@Repository
public class FinianceBaseZbjTypeDaoImpl implements FinanceBaseZbjTypeDao {
@Autowired
FinanceBaseZbjTypeMapper mapper;
@Override
public Map<String, String> selectBaseZbjType() {
List<FinanceBaseZbjType> list = mapper.selectList(new LambdaQueryWrapper<>());
// 以fenxiaoName为key,直播间渠道类型为value,放入map中
Map<String, String> map = list.stream()
.collect(HashMap::new, (k, v) -> k.put(v.getFenxiaoName(), v.getZbjQdType()), HashMap::putAll);
return map;
}
}
package com.sfa.job.domain.order.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.sfa.job.domain.order.dao.FinanceOrderDao;
import com.sfa.job.domain.order.entity.FinanceOrder;
import com.sfa.job.domain.order.mapper.FinanceOrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@DS("bi")
@Repository
public class FinianceOrderDaoImpl implements FinanceOrderDao {
private static final int BATCH_SIZE = 1000;
@Autowired
private FinanceOrderMapper financeOrderMapper;
@Override
public void saveOrUpdateBatch(List<FinanceOrder> mergeList) {
for (int i = 0; i < mergeList.size(); i += BATCH_SIZE) {
int toIndex = Math.min(i + BATCH_SIZE, mergeList.size());
List<FinanceOrder> batchLists = mergeList.subList(i, toIndex);
financeOrderMapper.saveOrUpdateBatch(batchLists);
}
}
}
package com.sfa.job.domain.order.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.sfa.job.domain.order.dao.FinanceOrderDetailDao;
import com.sfa.job.domain.order.entity.FinanceOrderDetail;
import com.sfa.job.domain.order.mapper.FinanceOrderDetailMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@DS("bi")
@Repository
public class FinianceOrderDetailDaoImpl implements FinanceOrderDetailDao {
private static final int BATCH_SIZE = 1000;
@Autowired
private FinanceOrderDetailMapper financeOrderDetailMapper;
@Override
public void saveOrUpdateBatch(List<FinanceOrderDetail> mergeList) {
for (int i = 0; i < mergeList.size(); i += BATCH_SIZE) {
int toIndex = Math.min(i + BATCH_SIZE, mergeList.size());
List<FinanceOrderDetail> batchLists = mergeList.subList(i, toIndex);
financeOrderDetailMapper.saveOrUpdateBatch(batchLists);
}
}
}
package com.sfa.job.domain.order.dao.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.sfa.job.domain.order.dao.IProductDao;
import com.sfa.job.domain.order.entity.PrdInfo;
import com.sfa.job.domain.order.mapper.PrdInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author : liqiulin
* @date : 2024-11-22 16
* @describe :
*/
@Service
public class ProductDaoImpl implements IProductDao {
@Autowired
PrdInfoMapper prdInfoMapper;
@Override
public Map<String, String> selectProdSeries() {
List<PrdInfo> prdInfos = prdInfoMapper.selectList(
new LambdaQueryWrapper<PrdInfo>()
.select(PrdInfo::getSeries, PrdInfo::getPrdCode, PrdInfo::getPrdName)
.groupBy(PrdInfo::getSeries, PrdInfo::getPrdCode, PrdInfo::getPrdName));
// 转换成map
Map<String, String> prodSeriesMap = new HashMap<>();
if (ObjectUtil.isNotEmpty(prdInfos)) {
prdInfos.stream().forEach(prdInfoDto -> {
prodSeriesMap.put(prdInfoDto.getPrdCode(), prdInfoDto.getPrdName());
});
}
return prodSeriesMap;
}
}
package com.sfa.job.domain.order.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.sfa.job.domain.order.dao.WdtRefundAmountDetailDao;
import com.sfa.job.domain.order.entity.WdtRefundAmountDetail;
import com.sfa.job.domain.order.mapper.WdtRefundAmountDetailMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@DS("bi")
@Repository
public class WdtRefundAmountDetailDaoImpl implements WdtRefundAmountDetailDao {
private static final int BATCH_SIZE = 1000;
@Autowired
private WdtRefundAmountDetailMapper amountDetailMapper;
@Override
public void saveOrUpdateBatch(List<WdtRefundAmountDetail> mergeList) {
for (int i = 0; i < mergeList.size(); i += BATCH_SIZE) {
int toIndex = Math.min(i + BATCH_SIZE, mergeList.size());
List<WdtRefundAmountDetail> batchLists = mergeList.subList(i, toIndex);
amountDetailMapper.saveOrUpdateBatch(batchLists);
}
}
}
package com.sfa.job.domain.order.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.sfa.job.domain.order.dao.WdtRefundOrderDao;
import com.sfa.job.domain.order.entity.WdtRefundOrder;
import com.sfa.job.domain.order.mapper.WdtRefundOrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@DS("bi")
@Repository
public class WdtRefundOrderDaoImpl implements WdtRefundOrderDao {
private static final int BATCH_SIZE = 1000;
@Autowired
private WdtRefundOrderMapper wdtRefundOrderMapper;
@Override
public void saveOrUpdateBatch(List<WdtRefundOrder> mergeList) {
for (int i = 0; i < mergeList.size(); i += BATCH_SIZE) {
int toIndex = Math.min(i + BATCH_SIZE, mergeList.size());
List<WdtRefundOrder> batchLists = mergeList.subList(i, toIndex);
wdtRefundOrderMapper.saveOrUpdateBatch(batchLists);
}
}
}
package com.sfa.job.domain.order.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.sfa.job.domain.order.dao.WdtRefundOrderDetailDao;
import com.sfa.job.domain.order.entity.WdtRefundOrderDetail;
import com.sfa.job.domain.order.mapper.WdtRefundOrderDetailMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@DS("bi")
@Repository
public class WdtRefundOrderDetailDaoImpl implements WdtRefundOrderDetailDao {
private static final int BATCH_SIZE = 1000;
@Autowired
private WdtRefundOrderDetailMapper wdtRefundOrderDetailMapper;
@Override
public void saveOrUpdateBatch(List<WdtRefundOrderDetail> mergeList) {
for (int i = 0; i < mergeList.size(); i += BATCH_SIZE) {
int toIndex = Math.min(i + BATCH_SIZE, mergeList.size());
List<WdtRefundOrderDetail> batchLists = mergeList.subList(i, toIndex);
wdtRefundOrderDetailMapper.saveOrUpdateBatch(batchLists);
}
}
}
package com.sfa.job.domain.order.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.sfa.job.domain.order.dao.WdtSwapOrderDao;
import com.sfa.job.domain.order.entity.WdtSwapOrder;
import com.sfa.job.domain.order.mapper.WdtSwapOrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@DS("bi")
@Repository
public class WdtSwapOrderDaoImpl implements WdtSwapOrderDao {
private static final int BATCH_SIZE = 1000;
@Autowired
private WdtSwapOrderMapper swapOrderMapper;
@Override
public void saveOrUpdateBatch(List<WdtSwapOrder> mergeList) {
for (int i = 0; i < mergeList.size(); i += BATCH_SIZE) {
int toIndex = Math.min(i + BATCH_SIZE, mergeList.size());
List<WdtSwapOrder> batchLists = mergeList.subList(i, toIndex);
swapOrderMapper.saveOrUpdateBatch(batchLists);
}
}
}
package com.sfa.job.domain.order.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.sfa.job.domain.order.dao.WdtSwapOrderDetailDao;
import com.sfa.job.domain.order.entity.WdtSwapOrderDetail;
import com.sfa.job.domain.order.mapper.WdtSwapOrderDetailMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@DS("bi")
@Repository
public class WdtSwapOrderDetailDaoImpl implements WdtSwapOrderDetailDao {
private static final int BATCH_SIZE = 1000;
@Autowired
private WdtSwapOrderDetailMapper swapOrderDetailMapper;
@Override
public void saveOrUpdateBatch(List<WdtSwapOrderDetail> mergeList) {
for (int i = 0; i < mergeList.size(); i += BATCH_SIZE) {
int toIndex = Math.min(i + BATCH_SIZE, mergeList.size());
List<WdtSwapOrderDetail> batchLists = mergeList.subList(i, toIndex);
swapOrderDetailMapper.saveOrUpdateBatch(batchLists);
}
}
}
package com.sfa.job.domain.order.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.Map;
/**
* CollectErrorInfo 类表示采集错误记录,与数据库表 market_bi.collect_error_info 相对应。
* 包含了采集错误记录的各种信息,如唯一键、入参信息、类型、采集时间、删除标志、创建和更新的用户及时间等。
*/
@TableName(value ="collect_error_log")
@Data
public class CollectErrorLog {
/**
* 唯一键,自动递增
*/
private Long ceiId;
/**
* 入参信息,存储为 JSON 格式
*/
private Map<String, Object> param;
/**
* 类型,如 xxljob、影刀等
*/
private String type;
/**
* 采集时间
*/
private Date collectTime;
/**
* 是否删除标志,'0' 表示未删除,'1' 表示已删除
*/
private char delFlag;
/**
* 创建者
*/
private String createBy;
/**
* 创建人 UserID
*/
private Long createUserId;
/**
* 创建时间,默认为当前时间
*/
private LocalDateTime createTime;
/**
* 更新者
*/
private String updateBy;
/**
* 修改人 UserID
*/
private Long updateUserId;
/**
* 更新时间,自动更新为当前时间
*/
private LocalDateTime updateTime;
/**
* 采集批次
*/
private String batchNo;
/**
* 本批次采集开始时间
*/
private Date startTime;
/**
* 本批次采集结束时间
*/
private Date endTime;
/**
* 错误信息
*/
private String errorMsg;
}
package com.sfa.job.domain.order.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 采集订单日志信息
*
* @TableName collect_order_log_info
* @author lvbencai
* @date 2025-01-16 22:58:38
* @description
*/
@Data
@TableName("collect_order_log")
public class CollectOrderLog implements Serializable {
/**
* 唯一键,用于唯一标识采集订单日志信息记录
*/
@TableId(value = "cli_id",type= IdType.AUTO)
private Long cliId;
/**
* 方法,用于区分不同类别的同步
*/
private String method;
/**
* 备注,记录数量
*/
private String remark;
private Integer totalCount;
/**
* 采集订单的数量,存储为字符串,长度不超过 20 个字符
*/
private Date startTime;
/**
* 采集订单的详细数量,存储为字符串,长度不超过 20 个字符
*/
private Date endTime;
/**
* 采集订单的详细数量,存储为字符串,长度不超过 20 个字符
*/;
/**
* 采集批次信息,可存储长度不超过 30 个字符,使用 utf8mb4 字符集和 utf8mb4_0900_ai_ci 校对规则
*/
private String batchNo;
/**
* 采集的最新时间,代表上一次采集的结束时间,存储为日期时间类型
*/
private Date latestTime;
// 2025年01月22日17:24:37增加,用于分批次查询
private Integer pageNo;
/**
* 是否删除的标志,'0' 表示未删除,'1' 表示已删除,使用 utf8mb3 字符集和 utf8mb3_general_ci 校对规则
*/
private String delFlag;
/**
* 创建者信息,存储为长度不超过 20 个字符的字符串
*/
private String createBy;
/**
* 创建人的用户 ID,存储为长整型
*/
private Long createUserId;
/**
* 创建时间,存储为日期时间类型,使用数据库的当前时间作为默认值
*/
private Date createTime;
/**
* 更新者信息,存储为长度不超过 20 个字符的字符串
*/
private String updateBy;
/**
* 修改人的用户 ID,存储为长整型
*/
private Long updateUserId;
/**
* 更新时间,存储为日期时间类型,更新时自动更新为当前时间
*/
private Date updateTime;
private Integer syncType;
}
package com.sfa.job.domain.order.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import java.math.BigDecimal;
/**
* finance_base_product 表对应的 料号基本信息表。
* 主要字段实际成本、标准成本、规格、口味
* @author lvbencai
* @date 2025年01月07日10:04:25
*/
@Data
public class FinanceBaseProduct {
// 唯一标识主键
@TableId(type = IdType.AUTO)
private Integer fbpId;
// 料号
private String prdCode;
// 品名
private String prdName;
// 规格
private String prdBarCode;
// 实际成本
private BigDecimal actualCost;
// 标准成本
private BigDecimal standardCost;
// 一级分类
private String firstCategory;
// 二级分类
private String secondCategory;
// 规格
private String spec;
// 口味
private String flavor;
// 系列
private String series;
// 产品分类编码
private String productClassificationCode;
// 产品分类
private String productClassification;
// 主分群码(重复字段,可根据实际需求调整)
private String mainGroupCode;
// 主分群码名称
private String mainGroupName;
// 料件类别(重复字段,可根据实际需求调整)
private String materialType;
// 料件类别描述
private String materialTypeName;
// 基础单位
private String basicUnit;
// 生命周期状态
private String lifeCycleStatus;
// 生命周期
private String lifeCycle;
}
package com.sfa.job.domain.order.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import java.time.LocalDateTime;
/**
* finance_base_zbj_type 表对应的直播间分类细腻系表。
* 主要字段直播间渠道类型、分销商名称
* @author lvbcai
* @date 2025年01月07日10:04:25
*/
@Data
public class FinanceBaseZbjType {
// 唯一键
@TableId(type = IdType.AUTO)
private Long fbztId;
// 分销商名称
private String fenxiaoName;
// 直播间渠道类型 有分销商id,不是以上几类的,统一为达人 没有分销商id的,默认为商城
private String zbjQdType;
// 采集批次
private String batchNo;
// 备注
private String remark;
// 是否删除标志 0 未删除 1 已删除
private char delFlag;
// 创建者
private String createBy;
// 创建人 UserID
private Long createUserId;
// 创建时间
private LocalDateTime createTime;
// 更新者
private String updateBy;
// 修改人 UserID
private Long updateUserId;
// 更新时间
private LocalDateTime updateTime;
}
package com.sfa.job.domain.order.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* 财务-订单数据实体类,对应数据库中的 finance_order 表
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "finance_order")
public class FinanceOrder {
/**
* 订单唯一键
*/
@TableId(type = IdType.NONE)
private Long tradeId;
/**
* 订单编号(旺店通系统订单号)
*/
private String tradeNo;
/**
* 平台 ID(请点击平台代码表查看对应关系)
*/
private Integer platformId;
/**
* 仓库类型: 1、普通仓库,大于 1 为委外仓库(如京东仓储,物流宝等),如订单无仓库的话,则不返回该字段
*/
private Integer warehouseType;
/**
* 原始单号(平台订单号),如果有多个,以","分隔,且以增序排列,不重复,过长将被裁剪
*/
private String srcTids;
/**
* 平台支付帐号, (仅自有平台及线下平台返回,其他平台均不返回)
*/
private String payAccount;
/**
* 订单状态: 4 线下退款; 5 已取消; 6 待转预订单(待审核); 7 待转已完成; 10 未付款; 12 待尾款; 15 等未付; 16 延时审核; 19 预订单前处理; 20 审核前处理; 21 自流转待发货; 23 异常订单; 24 换货预订单; 25 待处理预订单; 27 待分配预订单; 30 待客审; 35 待财审; 40 审核中; 55 已审核; 95 已发货; 96 成本确认(待录入计划成本,订单结算时有货品无计划成本); 101 已过账; 110 已完成
*/
private Integer tradeStatus;
/**
* 订单类型: 1、网店销售; 2、线下订单; 3、售后换货; 4、批发业务; 7、现款销售; 8、分销订单; 101、自定义类型一; 102、自定义类型二; 103、自定义类型三; 104、自定义类型四; 105、自定义类型五; 106、自定义类型六; 107、自定义类型七; 108、自定义类型八; 109、自定义类型九; 110、自定义类型十(与 ERP 中自定义类型的映射关系,点击链接查看)
*/
private Integer tradeType;
/**
* 发货条件: 1、款到发货; 2、货到付款(包含部分货到付款); 3、分期付款; 4、挂账
*/
private Integer deliveryTerm;
/**
* 京东几环(淘宝模糊化后的买家昵称)
*/
private String receiverRing;
/**
* 冻结原因
*/
private String freezeReason;
/**
* 退款状态: 0、无退款; 1、申请退款; 2、部分退款; 3、全部退款
*/
private Integer refundStatus;
/**
* 分销类别: 0、非分销订单; 1、代销; 2、经销
*/
private Integer fenxiaoType;
/**
* 分销商昵称
*/
private String fenxiaoNick;
/**
* 下单时间(毫秒级时间戳,例如:1631861379000)
*/
private String tradeTime;
/**
* 付款时间,例如:2020 - 10 - 19 00:00:00
*/
private String payTime;
/**
* 发货时间,订单未发货不返回该字段(毫秒级时间戳,例如:1631861379000)
*/
private Date consignTime;
/**
* 客户网名(淘宝 ouid,淘系平台不返回), (仅自有平台及线下平台返回,其他平台均不返回)
*/
private String buyerNick;
/**
* 收货人/收件人, (仅自有平台及线下平台返回,其他平台均不返回)
*/
private String receiverName;
/**
* 省份 id,可参考城市代码表
*/
private Integer receiverProvince;
/**
* 城市 id,可参考城市代码表
*/
private Integer receiverCity;
/**
* 地区 id,可参考城市代码表
*/
private Integer receiverDistrict;
/**
* 收件人地址, (仅自有平台及线下平台返回,其他平台均不返回)
*/
private String receiverAddress;
/**
* 手机,(仅自有平台及线下平台返回,其他平台均不返回)
*/
private String receiverMobile;
/**
* 固话, (仅自有平台及线下平台返回,其他平台均不返回)
*/
private String receiverTelno;
/**
* 邮编
*/
private String receiverZip;
/**
* 地区
*/
private String receiverArea;
/**
* 大头笔
*/
private String receiverDtb;
/**
* 异常订单原因(位运算): 2、修改地址; 4、修改发票; 8、更换仓库; 16、修改备注; 32、更换货品; 128、拦截赠品; 256、拦截换货; 512、买家留言变化; 1024、拦截平台已发货
*/
private Integer badReason;
/**
* 物流单号
*/
private String logisticsNo;
/**
* 买家留言
*/
private String buyerMessage;
/**
* 客服备注
*/
private String csRemark;
/**
* 标旗(1 红、2 黄、3 绿、4 蓝、5 紫 )
*/
private Integer remarkFlag;
/**
* 打印备注
*/
private String printRemark;
/**
* 货品种类数
*/
private BigDecimal goodsTypeCount;
/**
* 货品总量
*/
private BigDecimal goodsCount;
/**
* 总货款(折前总额)
*/
private BigDecimal goodsAmount;
/**
* 邮费(买家支付邮费)
*/
private BigDecimal postAmount;
/**
* 其他费用
*/
private BigDecimal otherAmount;
/**
* 优惠
*/
private BigDecimal discount;
/**
* 应收
*/
private BigDecimal receivable;
/**
* COD 金额(货到付款金额)
*/
private BigDecimal codAmount;
/**
* 买家 COD 费用
*/
private BigDecimal extCodFee;
/**
* 货品预估成本
*/
private BigDecimal goodsCost;
/**
* 预估邮资成本
*/
private BigDecimal postCost;
/**
* 预估重量(kg)
*/
private BigDecimal weight;
/**
* 预估毛利
*/
private BigDecimal profit;
/**
* 税额
*/
private BigDecimal tax;
/**
* 税率
*/
private BigDecimal taxRate;
/**
* 佣金
*/
private BigDecimal commission;
/**
* 发票类型: 0:不需要; 1:普通发票; 2:增值税普通发票; 3:增值税专用发票
*/
private Integer invoiceType;
/**
* 发票抬头
*/
private String invoiceTitle;
/**
* 发票内容
*/
private String invoiceContent;
/**
* 业务员
*/
private String salesmanName;
/**
* 审核人
*/
private String checkerName;
/**
* 财审人
*/
private String fcheckerName;
/**
* 签出人
*/
private String checkouterName;
/**
* 出库单号(系统产生的出库单号)
*/
private String stockoutNo;
/**
* 标记名称
*/
private String flagName;
/**
* 订单来源: 1、API 抓单; 2、手工建单; 3、导入; 4、复制订单; 5、接口推送; 6、补发订单; 7、PDA 选货开单; 8、分销补发订单
*/
private Integer tradeFrom;
/**
* 货品商家编码,多种货品为空,组合装时为组合装编码
*/
private String singleSpecNo;
/**
* 原始货品数量
*/
private BigDecimal rawGoodsCount;
/**
* 原始货品种类数
*/
private Integer rawGoodsTypeCount;
/**
* 币种
*/
private String currency;
/**
* 发票 ID(自增生成),0 代表没有发票或已取消/已冲红
*/
private Integer invoiceId;
/**
* 版本号
*/
private Integer versionId;
/**
* 修改时间,例如:2020 - 10 - 19 00:00:00
*/
private Date modified;
/**
* 递交时间(毫秒级时间戳,例如:1631861379000)
*/
private String created;
/**
* 审核时间
*/
private String checkTime;
/**
* 证件类别
*/
private Integer idCardType;
/**
* 店铺编号
*/
private String shopNo;
/**
* 店铺名称
*/
private String shopName;
/**
* 店铺备注
*/
private String shopRemark;
/**
* 仓库编号,如订单无仓库的话,则不返回该字段
*/
private String warehouseNo;
/**
* 客户姓名
*/
private String customerName;
/**
* 客户编码
*/
private String customerNo;
/**
* 物流公司名称
*/
private String logisticsName;
/**
* 物流公司编号
*/
private String logisticsCode;
/**
* 物流类型名称
*/
private String logisticsTypeName;
/**
* 送货时间,例如:2020 - 10 - 19 00:00:00
*/
private String toDeliverTime;
/**
* 计划发货时间
*/
private String delayToTime;
/**
* 最晚发货时间
*/
private String estimateConsignTime;
/**
* 店铺 id
*/
private Integer shopId;
/**
* 仓库 id
*/
private Integer warehouseId;
/**
* 体积
*/
private BigDecimal volume;
/**
* 订单标签
*/
private String tradeLabel;
/**
* 1:使用智选物流; 2:货品标签; 4:预订单自动激活失败; 16:订单货品指定批次; 32:平台自动流转仓库; 64:部分发货; 128:全部发货; 256:优先占用; 512:待分配转审核失败或订单审核失败; 1024:催未付款订单短信发送标记; 2048:拆分(在判断的时候使用&运算)
*/
private Integer tradeMask;
/**
* 店铺平台 id
*/
private Integer shopPlatformId;
/**
* 子平台 id
*/
private Integer subPlatformId;
/**
* 包装
*/
private String packageName;
/**
* 包装 id
*/
private Integer packageId;
/**
* 包装成本
*/
private BigDecimal packageCost;
/**
* 已付
*/
private BigDecimal paid;
/**
* 大件类型: 1:普通套件; 2:独立套件; 3:分组单发,未使用; -1:非单发件 取子单中的最大值
*/
private Integer largeType;
/**
* 赠品标记: 1:自动赠送; 2:手工赠送; 4:回购赠送; 8:平台赠送(注意:如果是 3,则表示既有自动赠送也有手工赠送“1 + 2”)
*/
private Integer giftMask;
/**
* 客户 id
*/
private Integer customerId;
/**
* 其他成本
*/
private BigDecimal otherCost;
/**
* 不可合并拆分
*/
private Boolean isSealed;
/**
* 客户类型(0:普通客户;1:分销商;2:线下批发)
*/
private Integer customerType;
/**
* 物流公司 id
*/
private Integer logisticsId;
/**
* 取消原因
*/
private String cancelReason;
/**
* 驳回原因
*/
private String revertReason;
/**
* 订单标签 mask
*/
private String newTradeLabel;
/**
* 分销原始单号(无长度限制)
*/
private String fenxiaoTid;
/**
* 是否删除标志 0 未删除 1 已删除
*/
private Integer delFlag;
/**
* 创建者
*/
private String createBy;
/**
* 创建人 UserID
*/
private Long createUserId;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新者
*/
private String updateBy;
/**
* 修改人 UserID
*/
private Long updateUserId;
/**
* 更新时间
*/
private Date updateTime;
/**
* 采集批次
*/
private String batchNo;
/**
* 本批次采集开始时间,例如:2020 - 10 - 19 00:00:00
*/
private Date startTime;
/**
* 本批批次采集结束时间,例如:2020 - 10 - 19 00:00:00
*/
private Date endTime;
/**
* 同步类型 ,接口为 1 手动同步,0 xxljob 自动同步
*/
private Integer syncType;
// 订单明细
@TableField(exist = false)
private List<FinanceOrderDetail> detailList;
}
package com.sfa.job.domain.order.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.sfa.common.core.web.domain.BaseDo;
import lombok.Data;
import org.apache.commons.lang3.ObjectUtils;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 旺店通订单明细表 wangdiantong_order_detail
*/
@TableName(value = "finance_order_detail")
@Data
public class FinanceOrderDetail extends BaseDo {
// 订单唯一键
private Long tradeId;
// 订单明细唯一键
@TableId(type = IdType.NONE)
private Long recId;
// 平台ID
private Integer platformId;
// 原始子单号
private String srcOid;
// 原始单号
private String srcTid;
// 赠品方式 0、非赠品
// 1、自动赠送 2、手工赠送 4、周期购赠送 8、平台赠送 32、阶梯满赠 64、CRM追加赠送 128 主品
private Integer giftType;
// 0:未付款 1:部分付款 2:已付款(原始订单的支付状态)
private Integer payStatus;
// 退款状态:
// 0、无退款
// 1、取消退款
// 2、申请退款
// 3、待退款
// 4、待还原
// 5、退款成功
// 6、已退(未付款关闭,未付款的取消了)
private Integer refundStatus;
// 退款模式:
// 1、担保
// 2、非担保
// 3、在线非担保
private Integer guaranteeMode;
// 如果没有对应的原始单明细,则返回0.
// 平台状态:
// 10、未确认
// 20、待尾款
// 30、待发货
// 40、部分发货
// 50、已发货
// 60、已签收
// 70、已完成
// 80、已退款
// 90、已关闭
private Integer platformStatus;
// 发货条件:1、款到发货 2、货到付款(包含部分货到付款)
// 3、分期付款
private Integer deliveryTerm;
// 数量
private BigDecimal num;
// 标价,手工新建时使用货品属性中的“零售价”
private BigDecimal price;
// 售后退款数量
private BigDecimal refundNum;
// 成交价,原始单折扣及分摊之后的价格
private BigDecimal orderPrice;
// 分摊后价格,进入ERP后再次调整的价格,默认值与order_price一致
private BigDecimal sharePrice;
// 手工调整价,正数为加价,负数为减价,暂未处理
private BigDecimal adjust;
// 优惠
private BigDecimal discount;
// 分摊后总价=share_price*num
private BigDecimal shareAmount;
// 税率
private BigDecimal taxRate;
// 货品名称
private String goodsName;
// 货品编号
private String goodsNo;
// 规格名称
private String specName;
// 商家编码
private String specNo;
// 规格码
private String specCode;
// 组合装编码
private String suiteNo;
// 如果是组合装拆分的,此为组合装名称
private String suiteName;
// 组合装数量,不受拆分合并影响
private BigDecimal suiteNum;
// 组合装分摊后总价
private BigDecimal suiteAmount;
// 组合装优惠
private BigDecimal suiteDiscount;
// 平台货品名称
private String apiGoodsName;
// 平台规格名称
private String apiSpecName;
// 平台货品id
private String apiGoodsId;
// 平台规格id
private String apiSpecId;
// 货品id(系统货品主键)
private Integer goodsId;
// 单品id(系统单品主键)
private Integer specId;
// 佣金
private BigDecimal commission;
// 货品类型
// 1销售商品
// 2原材料
// 3包装
// 4周转材料
// 5虚拟商品
// 6固定资产
// 0其它
private Integer goodsType;
// 订单内部来源:
// 0:无来源
// 1:手机
// 2:聚划算
// 32:开具电子发票
// 2048:当日达
// 4096:次日达
// 8192:承诺时效
// 2097152:区域零售
// 4194304:拼多多厂家代打
// 8388608:周期购
// 1048576:预售单
// 33554432:前N有礼
// 524288:天猫物流升级
// 64:按需配送
// 256:承诺结构化/QIC
// 16384:商仓鸟配
private Integer fromMask;
// 子单备注
private String remark;
// 修改时间(毫秒级时间戳,例如:1631861379000)
private String modified;
// 创建时间(毫秒级时间戳,例如:1631861379000)
private String created;
// 自定义属性1
private String prop1;
// 自定义属性2
private String prop2;
// 货品重量(子单预估货品总重量)
private BigDecimal weight;
// 图片路径
private String imgUrl;
// 实发数量(此数量为发货数量,删除操作等于将此值设置为0)
private BigDecimal actualNum;
// 条码
private String barcode;
// 已付
private BigDecimal paid;
// 组合装id
private Integer suiteId;
// bind_oid
private String bindOid;
// 打印组合装
// 0:组合装明细
// 1:组合装及明细
// 2:组合装
private Integer printSuiteMode;
// 1:天猫物流升级-顺丰配送
// 2:需要回传
// 4:天猫物流升级-按需配送
// 8:天猫物流升级-承诺发货时效
// 16:天猫物流升级-承诺达时效
// 32:天猫物流升级-预售下沉
// 64:天猫物流升级-预计到货时效
// 128:天猫物流升级-配送线路异常
// 1024:定金链接
// 2048:补款链接
// 4096:确认收货
// (mask类型值. 在判断的时候使用&运算)
private Integer flag;
// 库存保留情况
// 0:未保留(取消的订单或完成)
// 1:无库存记录
// 2:未付款
// 3:已保留待审核
// 4:待发货
// 5:预订单库存
private Integer stockState;
// 平台已发货
private boolean isConsigned;
// 是否付款
private Integer isReceived;
// 平台类目主键
private Integer cid;
// 最后更新时间,DateTime格式
private Date modifiedDate;
// 创建时间,DateTime格式
private String createdDate;
// 分摊邮费
private BigDecimal sharePostPrice;
// 发票内容
private String invoiceContent;
// 支付时间,DateTime格式,取自原始订单支付时间
private Date payTime;
// 货品简称
private String shortName;
// 分销商昵称
private String fenxiaoNick;
// 分销商id
private String fenxiaoId;
// 分销商name
private String fenxiaoName;
// 批次号
private String batchNo;
// 采集开始时间
private Date startTime;
// 采集结束时间
private Date endTime;
// 2025年01月13日新增字段
private String tradeNo;
// 店铺编号
private String shopNo;
// 店铺名称
private String shopName;
// 店铺备注
private String shopRemark;
// 交易状态
private Integer tradeStatus;
// 交易时间
private String tradeTime;
// 发货时间,订单未发货不返回该字段(毫秒级时间戳,例如:1631861379000)
private Date consignTime;
// 收货地区
private String receiverArea;
// 主播名称--来自备注字段
private String zbjName;
// 主播ID--来自备注字段
private String zbjId;
// 主播直播ID--来自备注字段
private String zbjZbId;
// 主播销售类型--来自备注字段
private String zbjSaleType;
// 主播渠道类型--来自备注字段
private String zbjQdType;
// 应收金额
private BigDecimal receivable;
// ERP规格名称 --来自T100的定义
private String specNameErp;
// ERP口味 --来自T100的定义
private String flavorErp;
// 同步类型,接口为1手动同步,0 xxljob自动同步,
private Integer syncType;
// 实际成本
private BigDecimal actualCost;
// 标准成本
private BigDecimal standardCost;
// 系列
private String series;
// 实际成本*num 实际总成本
private BigDecimal sumActualCost;
// 标准成本*num 标准总成本
private BigDecimal sumStandardCost;
/**
* 是否删除标志0未删除1已删除
*/
private String delFlag;
public String getFenxiaoId(FinanceOrder order, Long tradeId) {
// 如果不为空,解析出
if (ObjectUtils.isNotEmpty(order.getFenxiaoNick())) {
String id = extractDistributorId(order.getFenxiaoNick());
return id;
}
return "";
}
/**
* 从输入字符串中提取分销商 ID
*
* @param input 包含分销商 ID 的字符串
* @return 提取出的分销商 ID,如果未找到则返回空字符串
*/
public String extractDistributorId(String input) {
// 使用正则表达式匹配id
Pattern pattern = Pattern.compile("id:(\\d+);");
Matcher matcher = pattern.matcher(input);
if (matcher.find()) {
return matcher.group(1);
}
return "";
}
public String extractDistributorName(String input) {
// 使用正则表达式匹配逗号后面的字符
Pattern pattern = Pattern.compile(";(.*)】");
Matcher matcher = pattern.matcher(input);
if (matcher.find()) {
return matcher.group(1);
}
return "";
}
/**
* 根据订单和交易 ID 获取分销商名称
*
* @param order 订单
* @param tradeId 交易 ID
* @return 分销商名称,如果未找到则返回空字符串
*/
public String getFenxiaoName(FinanceOrder order, Long tradeId) {
// 如果不为空,解析出
if (ObjectUtils.isNotEmpty(order.getFenxiaoNick())) {
String id = extractDistributorName(order.getFenxiaoNick());
return id;
}
return "";
}
public String getFenxiaoNick(FinanceOrder order) {
return order.getFenxiaoNick();
}
public String extractByRegex(String input, String regex) {
// 使用正则表达式匹配逗号后面的字符
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(input);
if (matcher.find()) {
return matcher.group(1);
}
return "";
}
public void setZbjName(String fenxiaoName, String remark, FinanceOrderDetail sameDetail) {
if (ObjectUtils.isNotEmpty(sameDetail) && ObjectUtils.isNotEmpty(sameDetail.getZbjName())) {
this.zbjName = sameDetail.getZbjName();
return;
}
if (ObjectUtils.isNotEmpty(fenxiaoName)) {
this.zbjName = fenxiaoName;
return;
}
// 如果不为空,解析出
if (ObjectUtils.isNotEmpty(remark) && remark.contains("直播")) {
this.zbjName = extractByRegex(remark, "“【直播】”([^;;]*)");
this.fenxiaoName = this.zbjName;
}
}
public void setZbjId(String remark, FinanceOrderDetail sameDetail) {
if (ObjectUtils.isNotEmpty(sameDetail) && ObjectUtils.isNotEmpty(sameDetail.getZbjId())) {
this.zbjId = sameDetail.getZbjId();
return;
}
// 如果不为空,解析出
if (ObjectUtils.isNotEmpty(remark) && remark.contains("直播间id")) {
this.zbjId = extractByRegex(remark, "直播间id:([^;;]\\d+)");
}
}
/**
* 根据分销商和remark备注信息获取主播Id
*
* @param fenxiaoId
* @param remark
* @param sameDetail
* @return
*/
public void setZbjZbId(String fenxiaoId, String remark, FinanceOrderDetail sameDetail) {
if (ObjectUtils.isNotEmpty(fenxiaoId)) {
this.zbjZbId = fenxiaoId;
return;
}
if (ObjectUtils.isNotEmpty(sameDetail) && ObjectUtils.isNotEmpty(sameDetail.getZbjZbId())) {
this.zbjZbId = sameDetail.getZbjZbId();
return;
}
// 如果不为空,解析出
if (ObjectUtils.isNotEmpty(remark) && remark.contains("主播id")) {
this.zbjZbId = extractByRegex(remark, "主播id:([^;;]\\d+)");
this.fenxiaoId = this.zbjZbId;
return;
}
}
public void setZbjSaleType(String remark, FinanceOrderDetail sameDetail) {
if (ObjectUtils.isNotEmpty(sameDetail) && ObjectUtils.isNotEmpty(sameDetail.getZbjSaleType())) {
this.zbjSaleType = sameDetail.getZbjSaleType();
return;
}
// 如果不为空,解析出
if (ObjectUtils.isNotEmpty(remark) && remark.contains("销售类型:")) {
this.zbjSaleType = extractByRegex(remark, "销售类型:([^;;]*);");
}
}
public void setZbjQdType(String fenxiaoId, String zbjZbId, Map<String, String> baseZbjType) {
if (ObjectUtils.isNotEmpty(fenxiaoId)) {
zbjZbId = fenxiaoId;
}
this.zbjQdType = baseZbjType.get(zbjZbId);
if (ObjectUtils.isNotEmpty(zbjZbId) && ObjectUtils.isEmpty(this.zbjQdType)) {
this.zbjQdType = baseZbjType.get("其他分销名称");
}
}
}
package com.sfa.job.domain.order.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* 商品-管理表
* @TableName pro_info
*/
@TableName(value ="prd_info")
@Data
public class PrdInfo implements Serializable {
/**
* 主键id
*/
@TableId(type = IdType.AUTO)
private Integer prdId;
/**
* 商品编码
*/
private String prdCode;
/**
* 商品名称
*/
private String prdName;
/**
* 商品系列
*/
private Integer seriesId;
/**
* 商品系列
*/
private String series;
/**
* 商品规格-69码
*/
private String prdSpec;
/**
* 销售状态:1:在售,0:停售
*/
private Integer saleStatus;
/**
* 0:正常;1:删除
*/
private Integer status;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
package com.sfa.job.domain.order.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.math.BigDecimal;
/**
* 退换货订单数据
* @author lvbencai
* @date 2025-02-28 12:26:29
*/
@Data
@TableName(value = "wdt_refund_amount_detail")
public class WdtRefundAmountDetail {
/**
* 金额明细记录id
*/
private Integer recId;
/**
* 退换单id
*/
private Integer refundId;
/**
* 退换类型 1:货款 2:邮费 99:返现
*/
private Integer refundType;
/**
* 金额流向 0:商家->买家 1:买家->商家
*/
private Integer isReturn;
/**
* 退款金额
*/
private BigDecimal refundAmount;
/**
* 收款金额
*/
private BigDecimal receiveAmount;
/**
* 是否担保支付
*/
private Boolean isGuarantee;
/**
* 支付账户
*/
private Integer accountId;
/**
* 买家账号(仅自有平台及线下平台返回)
*/
private String payAccount;
/**
* 买家开户人姓名
*/
private String accountName;
/**
* 开户银行
*/
private String accountBank;
/**
* 是否系统自动生成
*/
private Boolean isAuto;
/**
* 备注
*/
private String remark;
}
package com.sfa.job.domain.order.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* 退换货订单数据
* @author lvbencai
* @date 2025-02-28 12:26:29
*/
@Data
@TableName(value = "wdt_refund_order")
public class WdtRefundOrder {
/**
* 退换单id
*/
private Integer refundId;
/**
* 原始单号(关联的销售单平台订单号)
*/
private String srcTids;
/**
* 退换单号
*/
private String refundNo;
/**
* 备注
*/
private String remark;
/**
* 退换单类型 1:售前退款;2:退货;3:换货;4:退款不退货;6:保价退款
*/
private Integer type;
/**
* 入库状态 0:无需入库;1:待入库;2:部分入库;3:全部入库;4:终止入库
*/
private Integer stockinStatus;
/**
* 标记名称
*/
private String flagName;
/**
* 退回货品数量
*/
private BigDecimal returnGoodsCount;
/**
* 退款订单中收件人电话(仅自有平台及线下平台返回)
*/
private String receiverTelno;
/**
* 退款订单中收件人姓名(仅自有平台及线下平台返回)
*/
private String receiverName;
/**
* 修改时间
*/
private String modified;
/**
* 便签数量
*/
private Integer noteCount;
/**
* 店铺编号
*/
private String shopNo;
/**
* 建单方式 0:API抓单;1:手工建单;2:Excel导入;3:分销商推送
*/
private Integer fromType;
/**
* 建单时间
*/
private String created;
/**
* 结算时间
*/
private String settleTime;
/**
* 审核时间
*/
private String checkTime;
/**
* 退货物流单号
*/
private String returnLogisticsNo;
/**
* 系统订单号列表
*/
private String tradeNoList;
/**
* 平台退款金额(担保退款金额)
*/
private BigDecimal guaranteeRefundAmount;
/**
* 退货金额
*/
private BigDecimal returnGoodsAmount;
/**
* 物流公司名称
*/
private String returnLogisticsName;
/**
* 退换说明
*/
private String reasonName;
/**
* 退款原因
*/
private String refundReason;
/**
* 客户网名(仅自有平台及线下平台返回)
*/
private String buyerNick;
/**
* 建单者
*/
private String operatorName;
/**
* 实际退款金额
*/
private BigDecimal actualRefundAmount;
/**
* 驳回原因
*/
private String revertReasonName;
/**
* 退回仓库编号
*/
private String returnWarehouseNo;
/**
* 线下退款金额(非担保退款金额)
*/
private BigDecimal directRefundAmount;
/**
* 收款金额
*/
private BigDecimal receiveAmount;
/**
* 客户姓名(仅自有平台及线下平台返回)
*/
private String customerName;
/**
* 分销商昵称
*/
private String fenxiaoNickName;
/**
* 退换单状态 10:已取消;20:待审核;30:已审核...
*/
private Integer status;
/**
* 店铺id
*/
private Integer shopId;
/**
* 订单id
*/
private Integer tradeId;
/**
* 原始退换单号
*/
private String rawRefundNos;
/**
* 支付订单号
*/
private String payId;
/**
* 分销退换单号
*/
private String providerRefundNo;
/**
* 店铺平台id
*/
private Integer shopPlatformId;
/**
* 原始单号
*/
private String tidList;
/**
* 子平台id
*/
private Integer subPlatformId;
/**
* 退回仓库id
*/
private Integer returnWarehouseId;
/**
* 平台id
*/
private Integer platformId;
/**
* 奇门货主编号
*/
private String wmsOwnerNo;
/**
* 退回仓库类型
*/
private Integer warehouseType;
/**
* 拦截原因
*/
private Integer badReason;
/**
* 最后修改时间
*/
private String modifiedDate;
/**
* 退换信息
*/
private String returnMaskInfo;
/**
* 处理状态
*/
private Integer processStatus;
/**
* 退款原因id
*/
private Integer reasonId;
/**
* 驳回原因id
*/
private Integer revertReason;
/**
* 客户id
*/
private Integer customerId;
/**
* 发货方式
*/
private Integer consignMode;
/**
* 退款创建时间
*/
private String refundTime;
/**
* 分销原始单号
*/
private String fenxiaoTid;
/**
* 分销商编码
*/
private String fenxiaoNickNo;
/**
* wms单号
*/
private String wmsCode;
/**
* 平台状态
*/
private Integer rrStatus;
/**
* 退款成功时间
*/
private String currentPhaseTimeout;
/**
* 退换单详情
*/
private List<WdtRefundOrderDetail> detailList;
/**
* 金额明细
*/
private List<WdtRefundAmountDetail> amountDetailList;
/**
* 换出订单
*/
private WdtSwapOrder swapOrder;
}
package com.sfa.job.domain.order.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.math.BigDecimal;
/**
* 退换货订单明细数据
* @author lvbencai
* @date 2025-02-28 12:26:23
*/
@Data
@TableName(value = "wdt_refund_order_detail")
public class WdtRefundOrderDetail {
/**
* 退换单明细Id
*/
private Integer recId;
/**
* 退换单id
*/
private Integer refundId;
/**
* 原始子单号
*/
private String oid;
/**
* 订单明细id
*/
private Integer tradeOrderId;
/**
* 平台id
*/
private Integer platformId;
/**
* 原始单号
*/
private String tid;
/**
* 系统订单编号
*/
private String tradeNo;
/**
* 数量
*/
private BigDecimal num;
/**
* 价格
*/
private BigDecimal price;
/**
* 原价
*/
private BigDecimal originalPrice;
/**
* 成本价
*/
private BigDecimal checkedCostPrice;
/**
* 退款数量
*/
private BigDecimal refundNum;
/**
* 退款总额
*/
private BigDecimal totalAmount;
/**
* 已退款金额
*/
private BigDecimal refundAmount;
/**
* 是否担保退款
*/
private Boolean isGuarantee;
/**
* 货品编号
*/
private String goodsNo;
/**
* 货品名称
*/
private String goodsName;
/**
* 规格名
*/
private String specName;
/**
* 商家编码
*/
private String specNo;
/**
* 平台货品id
*/
private String goodsId;
/**
* 平台规格id
*/
private String specId;
/**
* 系统货品id
*/
private Integer sysGoodsId;
/**
* 系统规格id
*/
private Integer sysSpecId;
/**
* 规格码
*/
private String specCode;
/**
* 条码
*/
private String barcode;
/**
* 入库数量
*/
private BigDecimal stockinNum;
/**
* 备注
*/
private String remark;
/**
* 平台规格名称
*/
private String apiSpecName;
/**
* 平台货品名称
*/
private String apiGoodsName;
/**
* 最后修改时间
*/
private String modified;
/**
* 组合装编号
*/
private String suiteNo;
/**
* 组合装名称
*/
private String suiteName;
/**
* 原始退款单号
*/
private String rawRefundNos;
/**
* 原始退款单号
*/
private String rawRefundNo;
/**
* 订单id
*/
private Integer salesTradeId;
/**
* 总折扣金额
*/
private BigDecimal discount;
/**
* 已支付金额
*/
private BigDecimal paid;
/**
* 组合装id
*/
private Integer suiteId;
/**
* 组合装数量
*/
private BigDecimal suiteNum;
/**
* 创建时间
*/
private String created;
/**
* 最后修改时间
*/
private String modifiedDate;
/**
* 赠品类型
*/
private Integer giftType;
}
package com.sfa.job.domain.order.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* 退换货订单数据
* @author lvbencai
* @date 2025-02-28 12:26:29
*/
@Data
@TableName(value = "wdt_swap_order")
public class WdtSwapOrder {
/**
* 换出订单原始单号
*/
private String tid;
/**
* 店铺编号
*/
private String shopNo;
/**
* 店铺名称
*/
private String shopName;
/**
* 仓库名称
*/
private String warehouseNo;
/**
* 店铺id
*/
private Integer shopId;
/**
* 仓库id
*/
private Integer warehouseId;
/**
* 省份id
*/
private Integer swapProvince;
/**
* 城市id
*/
private Integer swapCity;
/**
* 地区
*/
private String swapArea;
/**
* 地区id
*/
private Integer swapDistrict;
/**
* 换货新订单物流公司id
*/
private Integer swapLogisticsId;
/**
* 换货邮费
*/
private BigDecimal postAmount;
/**
* 其他金额
*/
private BigDecimal otherAmount;
/**
* 换出订单明细
*/
private List<WdtSwapOrderDetail> swapOrderDetailList;
}
package com.sfa.job.domain.order.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.math.BigDecimal;
/**
* 退换货订单数据
* @author lvbencai
* @date 2025-02-28 12:26:29
*/
@Data
@TableName(value = "wdt_swap_order_detail")
public class WdtSwapOrderDetail {
/**
* 原始子单号
*/
private String oid;
/**
* 货品类型(1 单品,2 组合装)
*/
private Byte targetType;
/**
* 换出货品id
*/
private Integer targetId;
/**
* 是否残次品
*/
private Boolean defect;
/**
* 货品名称
*/
private String goodsName;
/**
* 货品编号
*/
private String goodsNo;
/**
* 规格名称
*/
private String specName;
/**
* 规格码
*/
private String specCode;
/**
* 商家编码
*/
private String merchantNo;
/**
* 零售价
*/
private BigDecimal price;
/**
* 总价
*/
private BigDecimal totalAmount;
/**
* 数量
*/
private BigDecimal num;
/**
* 备注
*/
private String remark;
}
package com.sfa.job.domain.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sfa.job.domain.order.entity.CollectErrorLog;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CollectErrorLogMapper extends BaseMapper<CollectErrorLog> {
}
package com.sfa.job.domain.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sfa.job.domain.order.entity.CollectOrderLog;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CollectOrderLogMapper extends BaseMapper<CollectOrderLog> {
}
package com.sfa.job.domain.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sfa.job.domain.order.entity.FinanceBaseProduct;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface FinanceBaseProductMapper extends BaseMapper<FinanceBaseProduct> {
}
package com.sfa.job.domain.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sfa.job.domain.order.entity.FinanceBaseZbjType;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface FinanceBaseZbjTypeMapper extends BaseMapper<FinanceBaseZbjType> {
}
package com.sfa.job.domain.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sfa.job.domain.order.entity.FinanceOrderDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface FinanceOrderDetailMapper extends BaseMapper<FinanceOrderDetail> {
void saveOrUpdateBatch(@Param(value = "list") List<FinanceOrderDetail> mergeList);
}
package com.sfa.job.domain.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sfa.job.domain.order.entity.FinanceOrder;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface FinanceOrderMapper extends BaseMapper<FinanceOrder> {
void saveOrUpdateBatch(List<FinanceOrder> batchLists);
}
package com.sfa.job.domain.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sfa.job.domain.order.entity.PrdInfo;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
/**
* @author a02200059
* @description 针对表【prd_info(商品-管理表)】的数据库操作Mapper
* @createDate 2024-11-22 16:48:35
* @Entity com.link.bi.domain.entity.PrdInfo
*/
@Repository
@Mapper
public interface PrdInfoMapper extends BaseMapper<PrdInfo> {
}
package com.sfa.job.domain.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sfa.job.domain.order.entity.WdtRefundAmountDetail;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface WdtRefundAmountDetailMapper extends BaseMapper<WdtRefundAmountDetail> {
void saveOrUpdateBatch(List<WdtRefundAmountDetail> batchLists);
}
package com.sfa.job.domain.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sfa.job.domain.order.entity.WdtRefundOrderDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface WdtRefundOrderDetailMapper extends BaseMapper<WdtRefundOrderDetail> {
void saveOrUpdateBatch(@Param(value = "list") List<WdtRefundOrderDetail> mergeList);
}
package com.sfa.job.domain.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sfa.job.domain.order.entity.WdtRefundOrder;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface WdtRefundOrderMapper extends BaseMapper<WdtRefundOrder> {
void saveOrUpdateBatch(List<WdtRefundOrder> batchLists);
}
package com.sfa.job.domain.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sfa.job.domain.order.entity.WdtSwapOrderDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface WdtSwapOrderDetailMapper extends BaseMapper<WdtSwapOrderDetail> {
void saveOrUpdateBatch(@Param(value = "list") List<WdtSwapOrderDetail> mergeList);
}
package com.sfa.job.domain.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sfa.job.domain.order.entity.WdtSwapOrder;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface WdtSwapOrderMapper extends BaseMapper<WdtSwapOrder> {
void saveOrUpdateBatch(List<WdtSwapOrder> batchLists);
}
package com.sfa.job.pojo.request;
import lombok.Data;
/**
* @author lvbencai
* @date 2025-01-22 21:15:39
* @Description: 旺店通查询订单请求参数,可以按照旺店通的来定义
*/
@Data
public class WdtOrderQueryVO {
private String start_time;
private String end_time;
}
package com.sfa.job.pojo.request;
import lombok.Data;
/**
* @author lvbencai
* @date 2025-01-22 21:15:39
* @Description: 旺店通查询订单请求参数,可以按照旺店通的来定义
*/
@Data
public class WdtRefundQueryVO {
private String settle_from;
private String settle_to;
}
package com.sfa.job.pojo.response;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 采集订单日志信息
*
* @author lvbencai
* @date 2025-02-24 14:24:39
* @description
*/
@Data
public class CollectOrderLogDto implements Serializable {
/**
* 唯一键,用于唯一标识采集订单日志信息记录
*/
@TableId(value = "cli_id",type= IdType.AUTO)
private Long cliId;
/**
* 采集订单的数量,存储为字符串,长度不超过 20 个字符
*/
private Date endTime;
/**
* 采集订单的详细数量,存储为字符串,长度不超过 20 个字符
*/
private Date startTime;
/**
* 采集批次信息,可存储长度不超过 30 个字符,使用 utf8mb4 字符集和 utf8mb4_0900_ai_ci 校对规则
*/
private String batchNo;
/**
* 采集的最新时间,代表上一次采集的结束时间,存储为日期时间类型
*/
private Date latestTime;
// 2025年01月22日17:24:37增加,用于分批次查询
private Integer pageNo;
/**
* 是否删除的标志,'0' 表示未删除,'1' 表示已删除,使用 utf8mb3 字符集和 utf8mb3_general_ci 校对规则
*/
private String delFlag;
/**
* 创建者信息,存储为长度不超过 20 个字符的字符串
*/
private String createBy;
/**
* 创建人的用户 ID,存储为长整型
*/
private Long createUserId;
/**
* 创建时间,存储为日期时间类型,使用数据库的当前时间作为默认值
*/
private Date createTime;
/**
* 更新者信息,存储为长度不超过 20 个字符的字符串
*/
private String updateBy;
/**
* 修改人的用户 ID,存储为长整型
*/
private Long updateUserId;
/**
* 更新时间,存储为日期时间类型,更新时自动更新为当前时间
*/
private Date updateTime;
private Integer syncType;
private Integer totalCount;
}
package com.sfa.job.pojo.response;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
/**
* 财务同步旺店通接口-返回数据Dto
*/
@Data
public class FinanceSyncRefundOrderDetailDto {
/**
* 订单数量
*/
private Integer orderCount;
private Integer orderDetailCount;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
private Integer syncType;
private String batchNo;
private Integer pageNo;
private Integer totalCount;
/**
* 错误信息
*/
private String message;
private Integer code = 200;
}
package com.sfa.job.pojo.response;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import java.io.Serializable;
/**
* 商品-dto
*/
@Data
public class PrdInfoDto implements Serializable {
/**
* 主键id
*/
@TableId(type = IdType.AUTO)
private Integer prdId;
/**
* 商品编码
*/
private String prdCode;
/**
* 商品名称
*/
private String prdName;
/**
* 商品系列
*/
private Integer seriesId;
/**
* 商品系列
*/
private String series;
/**
* 商品规格-69码
*/
private String prdSpec;
/**
* 销售状态:1:在售,0:停售
*/
private Integer saleStatus;
/**
* 0:正常;1:删除
*/
private Integer status;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
package com.sfa.job.pojo.response;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
/**
* 财务同步旺店通接口-返回数据Dto
*/
@Data
public class SyncOrderDetailDto {
private String method;
private String remark;
/**
* 订单数量
*/
private Integer orderCount;
private Integer orderDetailCount;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
private Date latestTime;
private Integer syncType;
private String batchNo;
private Integer pageNo;
private Integer totalCount;
/**
* 错误信息
*/
private String message;
private Integer code = 200;
public SyncOrderDetailDto setDetailInfo(String method, String remark, int syncType, int size, int mergerListSize, Integer totalCount, String batchNo, Date endTime, Date startTime) {
// 接口测试使用
this.setOrderCount(size);
this.setOrderDetailCount(mergerListSize);
this.setStartTime(startTime);
this.setEndTime(endTime);
this.setLatestTime(endTime);
this.setTotalCount(totalCount);
this.setBatchNo(batchNo);
this.setMethod(method);
this.setSyncType(syncType);
this.setRemark(remark);
return this;
}
}
package com.sfa.job.pojo.response;
import com.alibaba.fastjson2.JSONArray;
import lombok.Data;
/**
* @author lvbencai
* @date 2025-01-22 21:15:39
* @Description: 旺店通查询订单请求参数, 可以按照旺店通的来定义
*/
@Data
public class WangdiantongQueryDto {
private JSONArray result;
private Integer totalCount;
private Integer nextBeginPageNo;
}
package com.sfa.job.service.order;
import com.sfa.job.pojo.response.SyncOrderDetailDto;
import java.util.Date;
public interface FinanceOrderSyncService {
SyncOrderDetailDto syncWdtOrder(Date startTime, Date endTime, Integer syncType);
SyncOrderDetailDto syncWdtRefundOrder(Date startTime, Date endTime, Integer syncType);
SyncOrderDetailDto updateZbjType(Date startTime, Date endTime);
}
package com.sfa.job.service.order.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.HttpStatus;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONReader;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.sfa.common.core.exception.ServiceException;
import com.sfa.common.core.utils.DateUtils;
import com.sfa.job.domain.order.dao.*;
import com.sfa.job.domain.order.entity.*;
import com.sfa.job.pojo.request.WdtOrderQueryVO;
import com.sfa.job.pojo.request.WdtRefundQueryVO;
import com.sfa.job.pojo.response.CollectOrderLogDto;
import com.sfa.job.pojo.response.SyncOrderDetailDto;
import com.sfa.job.pojo.response.WangdiantongQueryDto;
import com.sfa.job.service.order.FinanceOrderSyncService;
import com.sfa.job.util.WangdiantongUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*;
/**
* 旺店通订单Service业务层处理
*
* @author lvbencai
* @date 2025年01月07日17:00:16
*/
@DS("bi")
@Slf4j
@Service
public class FinanceOrderSyncServiceImpl implements FinanceOrderSyncService {
@Autowired
WangdiantongUtil wangdiantongUtil;
@Autowired
FinanceOrderDetailDao orderDetailDao;
@Autowired
FinanceOrderDao orderDao;
@Autowired
WdtRefundOrderDao wdtRefundOrderDao;
@Autowired
WdtRefundOrderDetailDao wdtRefundOrderDetailDao;
@Autowired
WdtSwapOrderDao wdtSwapOrderDao;
@Autowired
WdtSwapOrderDetailDao wdtSwapOrderDetailDao;
@Autowired
WdtRefundAmountDetailDao amountDetailDao;
@Autowired
FinianceBaseProductDao baseProductDao;
@Autowired
FinanceBaseZbjTypeDao baseZbjTypeDao;
@Autowired
CollectOrderLogDao orderLogInfoDao;
@Autowired
CollectErrorLogDao errorInfoDao;
@Autowired
IProductDao productDao;
/**
* 多线程调用此方法
*
* @param startTime
* @param endTime
*/
@Transactional(rollbackFor = Exception.class)
@Override
public SyncOrderDetailDto syncWdtOrder(Date startTime, Date endTime, Integer syncType) {
SyncOrderDetailDto detailDto = new SyncOrderDetailDto();
String batchNo = syncType + DateUtils.dateTimeNow() + Thread.currentThread().getId();
String method = "sales.TradeQuery.queryWithDetail";
try {
detailDto.setBatchNo(batchNo);
detailDto.setStartTime(startTime);
detailDto.setEndTime(endTime);
detailDto.setPageNo(0);
// 调用新方法设置时间范围
setupTimeRange(detailDto, syncType,60, method);
startTime = detailDto.getStartTime();
endTime = detailDto.getEndTime();
// 调用查询旺店通接口api 获取最新日期前的2小时
Date currentLatest = DateUtils.addHours(new Date(), -2);
if (currentLatest.compareTo(startTime) < 0) {
detailDto.setMessage(String.format("开始时间%s不能大于当前时间%s", DateUtil.formatDateTime(startTime), DateUtil.formatDateTime(currentLatest)));
log.warn(String.format("开始时间%s不能大于当前时间%s", DateUtil.formatDateTime(startTime), DateUtil.formatDateTime(currentLatest)));
return detailDto;
}
if (!validateStartTime(detailDto )) {
return detailDto;
}
log.info("查询订单参数:开始时间{},结束时间{},当前页:{}", DateUtil.formatDateTime(startTime), DateUtil.formatDateTime(endTime), detailDto.getPageNo());
WdtOrderQueryVO wdtOrderQueryVO = new WdtOrderQueryVO();
wdtOrderQueryVO.setStart_time(com.alibaba.fastjson2.util.DateUtils.format(startTime));
wdtOrderQueryVO.setEnd_time(com.alibaba.fastjson2.util.DateUtils.format(endTime));
HashMap<String, Object> params = new HashMap<>();
params.putAll(BeanUtil.beanToMap(wdtOrderQueryVO));
// 旺店通入参 和其他入参分开传入 旺店通入参bean转map
WangdiantongQueryDto wangdiantongQueryDto = wangdiantongUtil.queryWithDetail(params,detailDto.getPageNo(), method);
JSONArray orderAllArray = wangdiantongQueryDto.getResult();
if (ObjectUtils.isEmpty(orderAllArray)) {
throw new ServiceException("旺店通没有查询到订单数据");
}
detailDto.setPageNo(wangdiantongQueryDto.getNextBeginPageNo());
//转化成orderList
List<FinanceOrder> orders = JSONArray.parseArray(orderAllArray.toString(), FinanceOrder.class, JSONReader.Feature.SupportSmartMatch);
// 基础数据 直播间分类数据+成本、规格、口味
Map<String, FinanceBaseProduct> baseProductMap = baseProductDao.selectBaseProduct();
Map<String, String> baseZbjType = baseZbjTypeDao.selectBaseZbjType();
// 系列
Map<String, String> prodSeriesMap = productDao.selectProdSeries();
// 入库订单表
log.info("开始插入订单数据,数量:{}", orderAllArray.size());
Date finalStartTime = startTime;
Date finalEndTime = endTime;
orders.forEach(order -> {
order.setDelFlag(0);
order.setBatchNo(batchNo);
order.setStartTime(finalStartTime);
order.setEndTime(finalEndTime);
order.setSyncType(syncType);
order.setCreateTime(new Date());
order.setUpdateTime(new Date());
});
orderDao.saveOrUpdateBatch(orders);
List<FinanceOrderDetail> mergeList = new ArrayList<>();
// 用于同一个订单号,来赋值直播间信息
Map<String, FinanceOrderDetail> orderZbjMap = new HashMap<>();
// 入库订单明细表
for (FinanceOrder order : orders) {
List<FinanceOrderDetail> orderDetails = order.getDetailList();
for (FinanceOrderDetail orderDetail : orderDetails) {
orderDetail.setSeries(prodSeriesMap.get(orderDetail.getGoodsNo()));
orderDetail.setTradeStatus(order.getTradeStatus());
orderDetail.setShopNo(order.getShopNo());
orderDetail.setShopName(order.getShopName());
orderDetail.setShopRemark(order.getShopRemark());
orderDetail.setReceivable(order.getReceivable());
orderDetail.setReceiverArea(order.getReceiverArea());
orderDetail.setConsignTime(order.getConsignTime());
orderDetail.setTradeTime(order.getTradeTime());
orderDetail.setBatchNo(batchNo);
orderDetail.setTradeNo(order.getTradeNo());
// 计算分销信息
orderDetail.setFenxiaoNick(orderDetail.getFenxiaoNick(order));
orderDetail.setFenxiaoId(orderDetail.getFenxiaoId(order, orderDetail.getTradeId()));
orderDetail.setFenxiaoName(orderDetail.getFenxiaoName(order, orderDetail.getTradeId()));
orderDetail.setStartTime(finalStartTime);
orderDetail.setEndTime(finalEndTime);
orderDetail.setSyncType(syncType);
// 如果存在相同的
FinanceOrderDetail sameDetail = orderZbjMap.get(orderDetail.getSrcTid());
orderDetail.setZbjName(orderDetail.getFenxiaoName(), orderDetail.getRemark(), sameDetail);
orderDetail.setZbjId(orderDetail.getRemark(), sameDetail);
orderDetail.setZbjZbId(orderDetail.getFenxiaoId(), orderDetail.getRemark(), sameDetail);
orderDetail.setZbjSaleType(orderDetail.getRemark(), sameDetail);
// 确定分销商类型
orderDetail.setZbjQdType(orderDetail.getFenxiaoId(), orderDetail.getZbjZbId(), baseZbjType);
// 同一个订单id的,设置直播间类型信息也相同
if (ObjectUtils.isNotEmpty(orderDetail.getZbjName())) {
orderZbjMap.put(orderDetail.getSrcTid(), orderDetail);
}
orderDetail.setFlavorErp(ObjectUtils.isNotEmpty(baseProductMap.get(orderDetail.getGoodsNo())) ? baseProductMap.get(orderDetail.getGoodsNo()).getFlavor() : "");
orderDetail.setSpecNameErp(ObjectUtils.isNotEmpty(baseProductMap.get(orderDetail.getGoodsNo())) ? baseProductMap.get(orderDetail.getGoodsNo()).getSpec() : "");
// 将退款成功的数据分摊后总价置为0 2025年02月06日16:25:30
if (ObjectUtils.isNotEmpty(orderDetail.getRefundStatus()) && orderDetail.getRefundStatus().equals(5)) {
orderDetail.setShareAmount(new BigDecimal(0));
orderDetail.setActualCost(new BigDecimal(0));
orderDetail.setStandardCost(new BigDecimal(0));
orderDetail.setSumActualCost(new BigDecimal(0));
orderDetail.setSumStandardCost(new BigDecimal(0));
} else {
orderDetail.setActualCost(ObjectUtils.isNotEmpty(baseProductMap.get(orderDetail.getGoodsNo())) ?
baseProductMap.get(orderDetail.getGoodsNo()).getActualCost() :
new BigDecimal(0)
);
orderDetail.setStandardCost(ObjectUtils.isNotEmpty(baseProductMap.get(orderDetail.getGoodsNo())) ?
baseProductMap.get(orderDetail.getGoodsNo()).getStandardCost() :
new BigDecimal(0)
);
orderDetail.setSumActualCost(orderDetail.getActualCost().multiply(orderDetail.getNum()));
orderDetail.setSumStandardCost(orderDetail.getStandardCost().multiply(orderDetail.getNum()));
}
}
mergeList.addAll(orderDetails);
}
log.info("开始插入订单详情数据,数量:{}", mergeList.size());
// 批量插入
orderDetailDao.saveOrUpdateBatch(mergeList);
String remark = String.format("订单数量:%s,详情数量:%s", orders.size(), mergeList.size());
log.info("插入订单和订单详情完成,批次{}开始时间{},结束时间{},订单数量:{},详情数量:{},下一次开始页数:{}", batchNo, DateUtil.formatDateTime(startTime),
DateUtil.formatDateTime(endTime), orders.size(), mergeList.size(), detailDto.getPageNo());
detailDto.setDetailInfo(method, remark,syncType, orders.size(), mergeList.size(), wangdiantongQueryDto.getTotalCount(), batchNo, endTime, startTime);
orderLogInfoDao.insert(detailDto);
} catch (Exception e) {
detailDto.setCode(HttpStatus.HTTP_INTERNAL_ERROR);
detailDto.setMessage(e.toString());
log.error(e.getMessage(), e);
// 记录错误日志表 collect_error_info
errorInfoDao.insert(detailDto);
}
return detailDto;
}
/**
* 同步退换货数据
*
* @param startTime
* @param endTime
* @param syncType
* @return
*/
@Override
public SyncOrderDetailDto syncWdtRefundOrder(Date startTime, Date endTime, Integer syncType) {
SyncOrderDetailDto detailDto = new SyncOrderDetailDto();
String batchNo = syncType + DateUtils.dateTimeNow() + Thread.currentThread().getId();
String method = "aftersales.refund.Refund.search";
try {
detailDto.setBatchNo(batchNo);
detailDto.setStartTime(startTime);
detailDto.setEndTime(endTime);
detailDto.setPageNo(0);
// 调用新方法设置时间范围
setupTimeRange(detailDto, syncType, 60*24*1, method);
startTime = detailDto.getStartTime();
endTime = detailDto.getEndTime();
if (!validateStartTime(detailDto)) {
return detailDto;
}
log.info("查询订单参数:开始时间{},结束时间{},当前页:{}", DateUtil.formatDateTime(startTime), DateUtil.formatDateTime(endTime), detailDto.getPageNo());
// 旺店通入参 和其他入参分开传入 旺店通入参bean转map
WdtRefundQueryVO wdtOrderQueryVO = new WdtRefundQueryVO();
wdtOrderQueryVO.setSettle_from(com.alibaba.fastjson2.util.DateUtils.format(startTime));
wdtOrderQueryVO.setSettle_to(com.alibaba.fastjson2.util.DateUtils.format(endTime));
HashMap<String, Object> params = new HashMap<>();
Map<String, Object> stringObjectMap = BeanUtil.beanToMap(wdtOrderQueryVO);
params.putAll(stringObjectMap);
// 退换单查询
WangdiantongQueryDto wangdiantongQueryDto = wangdiantongUtil.queryWithDetail(params, detailDto.getPageNo(), method);
JSONArray orderAllArray = wangdiantongQueryDto.getResult();
if (ObjectUtils.isEmpty(orderAllArray)) {
throw new ServiceException("旺店通没有查询到订单数据");
}
detailDto.setPageNo(wangdiantongQueryDto.getNextBeginPageNo());
// 保存数据
List<WdtRefundOrder> refundOrders = JSONArray.parseArray(orderAllArray.toString(), WdtRefundOrder.class, JSONReader.Feature.SupportSmartMatch);
wdtRefundOrderDao.saveOrUpdateBatch(refundOrders);
List<WdtRefundOrderDetail> refundOrderDetails = new ArrayList<>();
refundOrders.forEach(order -> {
refundOrderDetails.addAll(order.getDetailList());
});
wdtRefundOrderDetailDao.saveOrUpdateBatch(refundOrderDetails);
// 换货信息
List<WdtSwapOrder> swapOrders = new ArrayList<>();
List<WdtSwapOrderDetail> swapOrderDetail = new ArrayList<>();
refundOrders.forEach(order -> {
if (ObjectUtils.isNotEmpty(order.getSwapOrder())) {
swapOrders.add(order.getSwapOrder());
swapOrderDetail.addAll(order.getSwapOrder().getSwapOrderDetailList());
}
});
wdtSwapOrderDao.saveOrUpdateBatch(swapOrders);
wdtSwapOrderDetailDao.saveOrUpdateBatch(swapOrderDetail);
// 金额明细
List<WdtRefundAmountDetail> amountDetailList = new ArrayList<>();
refundOrders.forEach(order -> {
if (ObjectUtils.isNotEmpty(order.getAmountDetailList())) {
amountDetailList.addAll(order.getAmountDetailList());
}
});
amountDetailDao.saveOrUpdateBatch(amountDetailList);
log.info("插入订单和订单详情完成,批次{}开始时间{},结束时间{},退货订单数量:{},详情数量:{},下一次开始页数:{}", batchNo, DateUtil.formatDateTime(startTime),
DateUtil.formatDateTime(endTime), refundOrders.size(), refundOrderDetails.size(), detailDto.getPageNo());
String remark = String.format("退货订单数量:%s,详情数量:%s,换货订单数量%s,换货详情数量%s,金额明细数量%s",
refundOrders.size(), refundOrderDetails.size(), swapOrders.size(), swapOrderDetail.size(), amountDetailList.size());
detailDto.setDetailInfo(method, remark, syncType,refundOrders.size(), refundOrderDetails.size(), wangdiantongQueryDto.getTotalCount(), batchNo, endTime, startTime);
orderLogInfoDao.insert(detailDto);
} catch (Exception e) {
detailDto.setCode(HttpStatus.HTTP_INTERNAL_ERROR);
detailDto.setMessage(e.toString());
log.error(e.getMessage(), e);
errorInfoDao.insert(detailDto);
}
return detailDto;
}
/**
* 修改直播间类型
*
* @param startTime
* @param endTime
* @return
*/
@Override
public SyncOrderDetailDto updateZbjType(Date startTime, Date endTime) {
// 循环查询订单
return null;
}
/**
* 设置开始时间和结束时间
* @param detailDto
* @param syncType
* @param interval
* @param method
*/
private void setupTimeRange(SyncOrderDetailDto detailDto, Integer syncType, Integer interval, String method) {
Date latestTime = null;
// startTime 为空,默认是定时任务调用
if (ObjectUtils.isEmpty(detailDto.getStartTime())) {
// 继续下一页的标识 pageNo =-1 标识终止分页 pageNo >0 标识继续分页
boolean nextPageFlag = true;
// 查询最新的采集时间
CollectOrderLogDto collectOrderLog = orderLogInfoDao.selectOrderSyncLatest(syncType, method);
if (ObjectUtils.isNotEmpty(collectOrderLog)) {
latestTime = collectOrderLog.getLatestTime();
Integer pageNoExist = collectOrderLog.getPageNo();
detailDto.setPageNo(ObjectUtil.isNotEmpty(pageNoExist) && pageNoExist > 0 ? collectOrderLog.getPageNo() : 0);
nextPageFlag = detailDto.getPageNo() > 0;
if (nextPageFlag) {
detailDto.setStartTime(collectOrderLog.getStartTime());
detailDto.setEndTime(collectOrderLog.getEndTime());
} else {
// 调用查询旺店通接口api 获取最新日期前的一个小时
detailDto.setStartTime(DateUtils.addMinutes(latestTime, -5));
detailDto.setEndTime(DateUtils.addMinutes(detailDto.getStartTime(), interval));
}
} else {
// 默认上个月的第一天 00:00:00
detailDto.setStartTime(DateUtil.beginOfDay(DateUtil.beginOfMonth(DateUtil.lastMonth())));
detailDto.setEndTime(DateUtils.addMinutes(detailDto.getStartTime(), interval));
}
}
latestTime = detailDto.getEndTime();
detailDto.setLatestTime(latestTime);
}
private boolean validateStartTime(SyncOrderDetailDto detailDto) {
Date currentLatest = DateUtils.addHours(new Date(), -2);
if (currentLatest.compareTo(detailDto.getEndTime()) < 0) {
// SyncOrderDetailDto detailDto = new SyncOrderDetailDto();
detailDto.setTotalCount(0);
// detailDto.setBatchNo(batchNo);
// detailDto.setStartTime(startTime);
// detailDto.setEndTime(endTime);
String message = String.format("结束时间%s不能大于当前时间%s", DateUtil.formatDateTime(detailDto.getEndTime()), DateUtil.formatDateTime(currentLatest));
detailDto.setMessage(message);
log.warn(message);
return false;
}
return true;
}
}
......@@ -67,7 +67,7 @@ public class FeiShuUtil {
.build();
FindByDepartmentUserResp resp = client.contact().user().findByDepartment(req);
if(!resp.success()) {
System.out.println(String.format("code:%s,msg:%s,reqId:%s, resp:%s",
log.warn(String.format("code:%s,msg:%s,reqId:%s, resp:%s",
resp.getCode(), resp.getMsg(), resp.getRequestId(), Jsons.createGSON(true, false).toJson(JsonParser.parseString(new String(resp.getRawResponse().getBody(), "UTF-8")))));
return null;
}
......
package com.sfa.job.util;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.lark.oapi.okhttp.*;
import com.sfa.common.core.exception.ServiceException;
import com.sfa.job.config.WangdiantongConfig;
import com.sfa.job.pojo.response.WangdiantongQueryDto;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.DigestUtils;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@Slf4j
@Component
public class WangdiantongUtil {
// @Value("${wangdiantong.url}")
// private String url;
// @Value("${wangdiantong.sid}")
// private String sid ;
// @Value("${wangdiantong.key}")
// private String key ;
// @Value("${wangdiantong.salt}")
// private String salt ;
// @Value("${wangdiantong.appsecret}")
// private String appsecret;
private final WangdiantongConfig wangdiantongConfig;
@Autowired
public WangdiantongUtil(WangdiantongConfig wangdiantongConfig) {
this.wangdiantongConfig = wangdiantongConfig;
}
/**
* 卖家账号/接口账号/盐/接口名称
*/
public WangdiantongQueryDto queryWithDetail(HashMap<String, Object> params, Integer beginPageNo, String method) {
WangdiantongQueryDto wangdiantongQueryDto = new WangdiantongQueryDto();
JSONArray allArray = new JSONArray();
Integer totalCount = 0;
try {
// 最大处理量,超过了,不再查询
int maxDealCount = 1000;
int size = 0;
int pageNo = beginPageNo.intValue();
// 出现了查询的分页数量不足的情况
int maxPage = 0;
do {
// 使用配置类中的属性
String url = wangdiantongConfig.getUrl();
String sid = wangdiantongConfig.getSid();
String key = wangdiantongConfig.getKey();
String salt = wangdiantongConfig.getSalt();
String appsecret = wangdiantongConfig.getAppsecret();
String v = "1.0";
List<HashMap<String, Object>> paramsList = Arrays.asList(params);
String signParams = appsecret + "body" + JSONObject.toJSONString(paramsList) + "calc_total1" + "key" + key
+ "method" + method + "page_no" + pageNo + "page_size200" + "salt" + salt + "sid" + sid +
"timestamp" + (System.currentTimeMillis() / 1000 - 1325347200) + "v" + v + appsecret;
String sign = DigestUtils.md5DigestAsHex(signParams.toString().getBytes());
log.debug(signParams);
log.debug(sign);
StringBuilder urlParams = new StringBuilder()
.append("sid=").append(sid)
.append("&key=").append(key)
.append("&salt=").append(salt)
.append("&method=").append(method)
.append("&v=").append(v)
.append("&timestamp=").append(System.currentTimeMillis() / 1000 - 1325347200)
.append("&sign=").append(sign)
.append("&page_size=").append(200)
.append("&page_no=").append(pageNo)
.append("&calc_total=").append(1);
log.info("查询订单数据url:" + url + "?" + urlParams);
RequestBody body = RequestBody.create(MediaType.get("application/json"), JSONObject.toJSONString(paramsList));
Request urlRequestBuild = new Request.Builder().url(url + "?" + urlParams).post(body).build();
OkHttpClient client = new OkHttpClient();
Response execute = client.newCall(urlRequestBuild).execute();
JSONObject responseJson = JSONObject.parseObject(execute.body().string());
JSONObject dataR = responseJson.getJSONObject("data");
JSONObject messageJson = responseJson.getJSONObject("message");
if (ObjectUtils.isNotEmpty(messageJson)) {
log.error("访问旺店通接口错误" + messageJson.toString());
throw new ServiceException("访问旺店通接口错误" + messageJson.toString());
}
totalCount = dataR.getInteger("total_count");
maxPage = (totalCount + 199) / 200;
JSONArray orderJsonArray = dataR.getJSONArray("order");
allArray.addAll(orderJsonArray);
size = allArray.size();
log.info("当前入参{},查询返回的order条数:{},总条数totalCount:{},page_no:{}", JSONObject.toJSONString(params), orderJsonArray.size(), totalCount, pageNo);
// 计算下一次分页的页码
pageNo++;
} while (size < maxDealCount && pageNo <= maxPage);
if (pageNo >= maxPage) {
// 已经到最后一页了,设置成-1,表示已经处理完了,不再查询
beginPageNo = -1;
} else {
beginPageNo = pageNo;
}
wangdiantongQueryDto.setNextBeginPageNo(beginPageNo);
wangdiantongQueryDto.setResult(allArray);
wangdiantongQueryDto.setTotalCount(totalCount);
} catch (Exception e) {
// 记录异常日志
log.error("异常信息:{}" + e.getMessage(), e);
throw new ServiceException("旺店通接口获取数据错误" + e.getMessage());
}
return wangdiantongQueryDto;
}
}
package com.sfa.job.xxljob.order;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.HttpStatus;
import com.alibaba.fastjson2.JSONObject;
import com.sfa.job.pojo.response.SyncOrderDetailDto;
import com.sfa.job.service.order.FinanceOrderSyncService;
import com.xxl.job.core.context.XxlJobContext;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* @author : 吕本才
* @date : 2025-01-15 13:03:51
* @describe : 财务订单数据
*/
@Component
@Slf4j
public class FinanceOrderTask {
@Autowired
FinanceOrderSyncService financeOrderSyncService;
/**
* 同步部门数据
*/
@XxlJob("syncWangdiantongOrderDetail")
public SyncOrderDetailDto syncWangdiantongOrderDetail() {
Long st = System.currentTimeMillis();
// 暂不考虑分片
XxlJobContext xxlJobContext = XxlJobContext.getXxlJobContext();
int shardingTotalCount = xxlJobContext.getShardTotal();
int shardingItem = xxlJobContext.getShardIndex();
XxlJobHelper.log(">>>>>>>>>>syncWangdiantongOrderDetail Job start<<<<<<<<<<");
// 简单模拟分片处理,这里输出每个分片的信息
XxlJobHelper.log("分片总数: " + shardingTotalCount + ", 当前分片: " + shardingItem);
XxlJobHelper.log("xxl-job开始同步-旺店通订单明细api接口数据");
// 定时任务不设定开始时间和结束时间
SyncOrderDetailDto detailDto = financeOrderSyncService.syncWdtOrder(null, null,0);
XxlJobHelper.log("xxl-job结束同步-旺店通订单明细api接口数据, 共同步订单{}条数据,订单明细{}条,订单批次号:{},订单的开始时间{}和结束时间{}",
detailDto.getOrderCount(),detailDto.getOrderDetailCount(),detailDto.getBatchNo(),
DateUtil.formatDateTime(detailDto.getStartTime()),DateUtil.formatDateTime(detailDto.getEndTime()) );
if(ObjectUtil.equals(HttpStatus.HTTP_OK,detailDto.getCode()) ){
XxlJobHelper.handleSuccess(JSONObject.toJSONString(detailDto));
}else{
XxlJobHelper.handleFail(detailDto.getMessage());
}
return detailDto;
}
/**
* 同步部门数据
*/
@XxlJob("syncWdtRefundOrder")
public SyncOrderDetailDto syncWdtRefundOrder() {
Long startTime = System.currentTimeMillis();
// 暂不考虑分片
XxlJobContext xxlJobContext = XxlJobContext.getXxlJobContext();
int shardingTotalCount = xxlJobContext.getShardTotal();
int shardingItem = xxlJobContext.getShardIndex();
XxlJobHelper.log(">>>>>>>>>>syncWangdiantongOrderDetail Job start<<<<<<<<<<");
// 简单模拟分片处理,这里输出每个分片的信息
XxlJobHelper.log("分片总数: " + shardingTotalCount + ", 当前分片: " + shardingItem);
XxlJobHelper.log("xxl-job开始同步-旺店通订单明细api接口数据");
// 定时任务不设定开始时间和结束时间
SyncOrderDetailDto detailDto = financeOrderSyncService.syncWdtRefundOrder(null, null,0);
Long endTime = System.currentTimeMillis();
XxlJobHelper.log("xxl-job结束同步-旺店通订单明细api接口数据, 共同步订单{}条数据,订单明细{}条,订单批次号:{},订单的开始时间{}和结束时间{},时长:{}",
detailDto.getOrderCount(),detailDto.getOrderDetailCount(),detailDto.getBatchNo(),
DateUtil.formatDateTime(detailDto.getStartTime()),DateUtil.formatDateTime(detailDto.getEndTime()),
endTime-startTime);
if(ObjectUtil.equals(HttpStatus.HTTP_OK,detailDto.getCode()) ){
XxlJobHelper.handleSuccess(JSONObject.toJSONString(detailDto));
}else{
XxlJobHelper.handleFail(detailDto.getMessage());
}
return detailDto;
}
}
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sfa.job.domain.order.mapper.FinanceOrderDetailMapper">
<insert id="saveOrUpdateBatch" parameterType="java.util.List">
insert into finance_order_detail( <include refid="Base_Column_List"></include>)
values
<foreach collection="list" item="item" separator=",">
(
#{item.tradeId}, #{item.recId}, #{item.platformId}, #{item.srcOid}, #{item.srcTid},
#{item.payStatus}, #{item.refundStatus}, #{item.platformStatus}, #{item.deliveryTerm},
#{item.num}, #{item.price}, #{item.refundNum}, #{item.orderPrice}, #{item.sharePrice},
#{item.adjust}, #{item.discount}, #{item.shareAmount}, #{item.taxRate}, #{item.goodsName},
#{item.goodsNo}, #{item.specName}, #{item.specNo}, #{item.specCode}, #{item.suiteNo},
#{item.suiteName}, #{item.suiteNum}, #{item.suiteAmount}, #{item.suiteDiscount},
#{item.apiGoodsName}, #{item.apiSpecName}, #{item.apiGoodsId}, #{item.apiSpecId},
#{item.goodsId}, #{item.specId}, #{item.commission}, #{item.goodsType}, #{item.fromMask},
#{item.remark}, #{item.modified}, #{item.created}, #{item.prop1}, #{item.prop2},
#{item.weight}, #{item.imgUrl}, #{item.actualNum}, #{item.barcode}, #{item.paid},
#{item.suiteId}, #{item.bindOid}, #{item.printSuiteMode}, #{item.flag}, #{item.stockState},
#{item.isConsigned}, #{item.isReceived}, #{item.cid}, #{item.modifiedDate}, #{item.createdDate},
#{item.sharePostPrice}, #{item.invoiceContent}, #{item.payTime}, #{item.shortName},
#{item.fenxiaoNick}, #{item.fenxiaoId}, #{item.fenxiaoName}, #{item.batchNo},
#{item.startTime}, #{item.endTime}, #{item.tradeNo}, #{item.shopNo}, #{item.shopName},
#{item.shopRemark}, #{item.tradeStatus}, #{item.tradeTime}, #{item.consignTime},
#{item.receiverArea}, #{item.zbjName}, #{item.zbjId}, #{item.zbjZbId}, #{item.zbjSaleType},
#{item.zbjQdType}, #{item.receivable}, #{item.specNameErp}, #{item.flavorErp},
#{item.syncType}, #{item.actualCost}, #{item.standardCost}, #{item.sumActualCost}, #{item.sumStandardCost},
#{item.series}, #{item.delFlag}
)
</foreach>
ON DUPLICATE KEY UPDATE
trade_id = VALUES(trade_id),
platform_id = VALUES(platform_id),
src_oid = VALUES(src_oid),
src_tid = VALUES(src_tid),
pay_status = VALUES(pay_status),
refund_status = VALUES(refund_status),
platform_status = VALUES(platform_status),
delivery_term = VALUES(delivery_term),
num = VALUES(num),
price = VALUES(price),
refund_num = VALUES(refund_num),
order_price = VALUES(order_price),
share_price = VALUES(share_price),
adjust = VALUES(adjust),
discount = VALUES(discount),
share_amount = VALUES(share_amount),
tax_rate = VALUES(tax_rate),
goods_name = VALUES(goods_name),
goods_no = VALUES(goods_no),
spec_name = VALUES(spec_name),
spec_no = VALUES(spec_no),
spec_code = VALUES(spec_code),
suite_no = VALUES(suite_no),
suite_name = VALUES(suite_name),
suite_num = VALUES(suite_num),
suite_amount = VALUES(suite_amount),
suite_discount = VALUES(suite_discount),
api_goods_name = VALUES(api_goods_name),
api_spec_name = VALUES(api_spec_name),
api_goods_id = VALUES(api_goods_id),
api_spec_id = VALUES(api_spec_id),
goods_id = VALUES(goods_id),
spec_id = VALUES(spec_id),
commission = VALUES(commission),
goods_type = VALUES(goods_type),
from_mask = VALUES(from_mask),
remark = VALUES(remark),
modified = VALUES(modified),
created = VALUES(created),
prop1 = VALUES(prop1),
prop2 = VALUES(prop2),
weight = VALUES(weight),
img_url = VALUES(img_url),
actual_num = VALUES(actual_num),
barcode = VALUES(barcode),
paid = VALUES(paid),
suite_id = VALUES(suite_id),
bind_oid = VALUES(bind_oid),
print_suite_mode = VALUES(print_suite_mode),
flag = VALUES(flag),
stock_state = VALUES(stock_state),
is_consigned = VALUES(is_consigned),
is_received = VALUES(is_received),
cid = VALUES(cid),
modified_date = VALUES(modified_date),
created_date = VALUES(created_date),
share_post_price = VALUES(share_post_price),
invoice_content = VALUES(invoice_content),
pay_time = VALUES(pay_time),
short_name = VALUES(short_name),
fenxiao_nick = VALUES(fenxiao_nick),
fenxiao_id = VALUES(fenxiao_id),
fenxiao_name = VALUES(fenxiao_name),
batch_no = VALUES(batch_no),
start_time = VALUES(start_time),
end_time = VALUES(end_time),
trade_no = VALUES(trade_no),
shop_no = VALUES(shop_no),
shop_name = VALUES(shop_name),
shop_remark = VALUES(shop_remark),
trade_status = VALUES(trade_status),
trade_time = VALUES(trade_time),
consign_time = VALUES(consign_time),
receiver_area = VALUES(receiver_area),
zbj_name = VALUES(zbj_name),
zbj_id = VALUES(zbj_id),
zbj_zb_id = VALUES(zbj_zb_id),
zbj_sale_type = VALUES(zbj_sale_type),
zbj_qd_type = VALUES(zbj_qd_type),
receivable = VALUES(receivable),
spec_name_erp = VALUES(spec_name_erp),
flavor_erp = VALUES(flavor_erp),
sync_type = VALUES(sync_type),
actual_cost = VALUES(actual_cost),
standard_cost = VALUES(standard_cost),
sum_actual_cost = VALUES(sum_actual_cost),
sum_standard_cost = VALUES(sum_standard_cost),
series = VALUES(series),
del_flag = VALUES(del_flag)
</insert>
<!-- 根据 rec_id 查询单条记录 -->
<select id="selectByRecId" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
from finance_order_detail
where rec_id = #{recId}
</select>
<!-- 根据 rec_id 删除记录 -->
<delete id="deleteByRecId" parameterType="java.lang.Long">
delete
from finance_order_detail
where rec_id = #{recId}
</delete>
<sql id="Base_Column_List">
trade_id, rec_id, platform_id, src_oid, src_tid, pay_status, refund_status, platform_status, delivery_term,
num, price, refund_num, order_price, share_price, adjust, discount, share_amount, tax_rate,
goods_name, goods_no, spec_name, spec_no, spec_code, suite_no, suite_name, suite_num, suite_amount,
suite_discount, api_goods_name, api_spec_name, api_goods_id, api_spec_id, goods_id, spec_id,
commission, goods_type, from_mask, remark, modified, created, prop1, prop2, weight, img_url,
actual_num, barcode, paid, suite_id, bind_oid, print_suite_mode, flag, stock_state, is_consigned,
is_received, cid, modified_date, created_date, share_post_price, invoice_content, pay_time, short_name,
fenxiao_nick, fenxiao_id, fenxiao_name, batch_no, start_time, end_time, trade_no, shop_no, shop_name,
shop_remark, trade_status, trade_time, consign_time, receiver_area, zbj_name, zbj_id, zbj_zb_id,
zbj_sale_type, zbj_qd_type, receivable, spec_name_erp, flavor_erp, sync_type, actual_cost,
standard_cost, sum_actual_cost, sum_standard_cost, series, del_flag
</sql>
<!-- 通用查询结果映射 -->
<resultMap id="BaseResultMap" type="com.sfa.job.domain.order.entity.FinanceOrderDetail">
<id column="rec_id" property="recId" jdbcType="BIGINT"/>
<result column="trade_no" property="tradeNo" jdbcType="VARCHAR"/>
<result column="trade_id" property="tradeId" jdbcType="BIGINT"/>
<result column="platform_id" property="platformId" jdbcType="INTEGER"/>
<result column="src_oid" property="srcOid" jdbcType="VARCHAR"/>
<result column="src_tid" property="srcTid" jdbcType="VARCHAR"/>
<result column="pay_status" property="payStatus" jdbcType="INTEGER"/>
<result column="refund_status" property="refundStatus" jdbcType="INTEGER"/>
<result column="platform_status" property="platformStatus" jdbcType="INTEGER"/>
<result column="delivery_term" property="deliveryTerm" jdbcType="INTEGER"/>
<result column="num" property="num" jdbcType="DECIMAL"/>
<result column="price" property="price" jdbcType="DECIMAL"/>
<result column="refund_num" property="refundNum" jdbcType="DECIMAL"/>
<result column="order_price" property="orderPrice" jdbcType="DECIMAL"/>
<result column="share_price" property="sharePrice" jdbcType="DECIMAL"/>
<result column="adjust" property="adjust" jdbcType="DECIMAL"/>
<result column="discount" property="discount" jdbcType="DECIMAL"/>
<result column="share_amount" property="shareAmount" jdbcType="DECIMAL"/>
<result column="tax_rate" property="taxRate" jdbcType="DECIMAL"/>
<result column="goods_name" property="goodsName" jdbcType="VARCHAR"/>
<result column="goods_no" property="goodsNo" jdbcType="VARCHAR"/>
<result column="spec_name" property="specName" jdbcType="VARCHAR"/>
<result column="spec_no" property="specNo" jdbcType="VARCHAR"/>
<result column="spec_code" property="specCode" jdbcType="VARCHAR"/>
<result column="suite_no" property="suiteNo" jdbcType="VARCHAR"/>
<result column="suite_name" property="suiteName" jdbcType="VARCHAR"/>
<result column="suite_num" property="suiteNum" jdbcType="DECIMAL"/>
<result column="suite_amount" property="suiteAmount" jdbcType="DECIMAL"/>
<result column="suite_discount" property="suiteDiscount" jdbcType="DECIMAL"/>
<result column="api_goods_name" property="apiGoodsName" jdbcType="VARCHAR"/>
<result column="api_spec_name" property="apiSpecName" jdbcType="VARCHAR"/>
<result column="api_goods_id" property="apiGoodsId" jdbcType="VARCHAR"/>
<result column="api_spec_id" property="apiSpecId" jdbcType="VARCHAR"/>
<result column="goods_id" property="goodsId" jdbcType="INTEGER"/>
<result column="spec_id" property="specId" jdbcType="INTEGER"/>
<result column="commission" property="commission" jdbcType="DECIMAL"/>
<result column="goods_type" property="goodsType" jdbcType="INTEGER"/>
<result column="from_mask" property="fromMask" jdbcType="INTEGER"/>
<result column="remark" property="remark" jdbcType="VARCHAR"/>
<result column="modified" property="modified" jdbcType="VARCHAR"/>
<result column="created" property="created" jdbcType="VARCHAR"/>
<result column="prop1" property="prop1" jdbcType="VARCHAR"/>
<result column="prop2" property="prop2" jdbcType="VARCHAR"/>
<result column="weight" property="weight" jdbcType="DECIMAL"/>
<result column="actual_num" property="actualNum" jdbcType="DECIMAL"/>
<result column="barcode" property="barcode" jdbcType="VARCHAR"/>
<result column="paid" property="paid" jdbcType="DECIMAL"/>
<result column="suite_id" property="suiteId" jdbcType="INTEGER"/>
<result column="bind_oid" property="bindOid" jdbcType="VARCHAR"/>
<result column="print_suite_mode" property="printSuiteMode" jdbcType="INTEGER"/>
<result column="flag" property="flag" jdbcType="INTEGER"/>
<result column="stock_state" property="stockState" jdbcType="INTEGER"/>
<result column="is_consigned" property="isConsigned" jdbcType="TINYINT"/>
<result column="is_received" property="isReceived" jdbcType="INTEGER"/>
<result column="cid" property="cid" jdbcType="INTEGER"/>
<result column="modified_date" property="modifiedDate" jdbcType="VARCHAR"/>
<result column="created_date" property="createdDate" jdbcType="VARCHAR"/>
<result column="share_post_price" property="sharePostPrice" jdbcType="DECIMAL"/>
<result column="invoice_content" property="invoiceContent" jdbcType="VARCHAR"/>
<result column="pay_time" property="payTime" jdbcType="VARCHAR"/>
<result column="short_name" property="shortName" jdbcType="VARCHAR"/>
<result column="fenxiao_nick" property="fenxiaoNick" jdbcType="VARCHAR"/>
<result column="fenxiao_id" property="fenxiaoId" jdbcType="VARCHAR"/>
<result column="fenxiao_name" property="fenxiaoName" jdbcType="VARCHAR"/>
<result column="batch_no" property="batchNo" jdbcType="VARCHAR"/>
<result column="del_flag" property="delFlag" jdbcType="CHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
<result column="start_time" property="startTime" jdbcType="TIMESTAMP"/>
<result column="end_time" property="endTime" jdbcType="TIMESTAMP"/>
<result column="shop_no" property="shopNo" jdbcType="VARCHAR"/>
<result column="shop_name" property="shopName" jdbcType="VARCHAR"/>
<result column="shop_remark" property="shopRemark" jdbcType="VARCHAR"/>
<result column="trade_status" property="tradeStatus" jdbcType="INTEGER"/>
<result column="trade_time" property="tradeTime" jdbcType="VARCHAR"/>
<result column="consign_time" property="consignTime" jdbcType="TIMESTAMP"/>
<result column="receiver_area" property="receiverArea" jdbcType="VARCHAR"/>
<result column="zbj_name" property="zbjName" jdbcType="VARCHAR"/>
<result column="zbj_id" property="zbjId" jdbcType="VARCHAR"/>
<result column="zbj_zb_id" property="zbjZbId" jdbcType="VARCHAR"/>
<result column="zbj_sale_type" property="zbjSaleType" jdbcType="VARCHAR"/>
<result column="zbj_qd_type" property="zbjQdType" jdbcType="VARCHAR"/>
<result column="receivable" property="receivable" jdbcType="DECIMAL"/>
<result column="spec_name_erp" property="specNameErp" jdbcType="VARCHAR"/>
<result column="flavor_erp" property="flavorErp" jdbcType="VARCHAR"/>
<result column="sync_type" property="syncType" jdbcType="TINYINT"/>
<result column="actual_cost" property="actualCost" jdbcType="DECIMAL"/>
<result column="standard_cost" property="standardCost" jdbcType="DECIMAL"/>
<result column="sum_actual_cost" property="sumActualCost" jdbcType="DECIMAL"/>
<result column="sum_standard_cost" property="sumStandardCost" jdbcType="DECIMAL"/>
</resultMap>
</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.sfa.job.domain.order.mapper.FinanceOrderMapper">
<insert id="saveOrUpdateBatch" parameterType="java.util.List">
insert into finance_order ( <include refid="Order_Base_Column_List"></include>)
values
<foreach collection="list" item="item" separator=",">
(
#{item.tradeId}, #{item.tradeNo}, #{item.platformId}, #{item.warehouseType}, #{item.srcTids}, #{item.payAccount}, #{item.tradeStatus}, #{item.tradeType},
#{item.deliveryTerm}, #{item.receiverRing}, #{item.freezeReason}, #{item.refundStatus}, #{item.fenxiaoType}, #{item.fenxiaoNick}, #{item.tradeTime},
#{item.payTime}, #{item.consignTime}, #{item.buyerNick}, #{item.receiverName}, #{item.receiverProvince}, #{item.receiverCity}, #{item.receiverDistrict},
#{item.receiverAddress}, #{item.receiverMobile}, #{item.receiverTelno}, #{item.receiverZip}, #{item.receiverArea}, #{item.receiverDtb}, #{item.badReason},
#{item.logisticsNo}, #{item.buyerMessage}, #{item.csRemark}, #{item.remarkFlag}, #{item.printRemark}, #{item.goodsTypeCount}, #{item.goodsCount},
#{item.goodsAmount}, #{item.postAmount}, #{item.otherAmount}, #{item.discount}, #{item.receivable}, #{item.codAmount}, #{item.extCodFee}, #{item.goodsCost},
#{item.postCost}, #{item.weight}, #{item.profit}, #{item.tax}, #{item.taxRate}, #{item.commission}, #{item.invoiceType}, #{item.invoiceTitle}, #{item.invoiceContent},
#{item.salesmanName}, #{item.checkerName}, #{item.fcheckerName}, #{item.checkouterName}, #{item.stockoutNo}, #{item.flagName}, #{item.tradeFrom},
#{item.singleSpecNo}, #{item.rawGoodsCount}, #{item.rawGoodsTypeCount}, #{item.currency}, #{item.invoiceId}, #{item.versionId}, #{item.modified},
#{item.created}, #{item.checkTime}, #{item.idCardType}, #{item.shopNo}, #{item.shopName}, #{item.shopRemark}, #{item.warehouseNo}, #{item.customerName},
#{item.customerNo}, #{item.logisticsName}, #{item.logisticsCode}, #{item.logisticsTypeName}, #{item.toDeliverTime}, #{item.delayToTime},
#{item.estimateConsignTime}, #{item.shopId}, #{item.warehouseId}, #{item.volume}, #{item.tradeLabel}, #{item.tradeMask}, #{item.shopPlatformId},
#{item.subPlatformId}, #{item.packageName}, #{item.packageId}, #{item.packageCost}, #{item.paid}, #{item.largeType}, #{item.giftMask}, #{item.customerId},
#{item.otherCost}, #{item.isSealed}, #{item.customerType}, #{item.logisticsId}, #{item.cancelReason}, #{item.revertReason}, #{item.newTradeLabel},
#{item.fenxiaoTid}, #{item.delFlag}, #{item.createBy}, #{item.createUserId}, #{item.createTime}, #{item.updateBy}, #{item.updateUserId}, #{item.updateTime},
#{item.batchNo}, #{item.startTime}, #{item.endTime}, #{item.syncType}
)
</foreach>
ON DUPLICATE KEY UPDATE
trade_id = VALUES(trade_id),
trade_no = VALUES(trade_no),
platform_id = VALUES(platform_id),
warehouse_type = VALUES(warehouse_type),
src_tids = VALUES(src_tids),
pay_account = VALUES(pay_account),
trade_status = VALUES(trade_status),
trade_type = VALUES(trade_type),
delivery_term = VALUES(delivery_term),
receiver_ring = VALUES(receiver_ring),
freeze_reason = VALUES(freeze_reason),
refund_status = VALUES(refund_status),
fenxiao_type = VALUES(fenxiao_type),
fenxiao_nick = VALUES(fenxiao_nick),
trade_time = VALUES(trade_time),
pay_time = VALUES(pay_time),
consign_time = VALUES(consign_time),
buyer_nick = VALUES(buyer_nick),
receiver_name = VALUES(receiver_name),
receiver_province = VALUES(receiver_province),
receiver_city = VALUES(receiver_city),
receiver_district = VALUES(receiver_district),
receiver_address = VALUES(receiver_address),
receiver_mobile = VALUES(receiver_mobile),
receiver_telno = VALUES(receiver_telno),
receiver_zip = VALUES(receiver_zip),
receiver_area = VALUES(receiver_area),
receiver_dtb = VALUES(receiver_dtb),
bad_reason = VALUES(bad_reason),
logistics_no = VALUES(logistics_no),
buyer_message = VALUES(buyer_message),
cs_remark = VALUES(cs_remark),
remark_flag = VALUES(remark_flag),
print_remark = VALUES(print_remark),
goods_type_count = VALUES(goods_type_count),
goods_count = VALUES(goods_count),
goods_amount = VALUES(goods_amount),
post_amount = VALUES(post_amount),
other_amount = VALUES(other_amount),
discount = VALUES(discount),
receivable = VALUES(receivable),
cod_amount = VALUES(cod_amount),
ext_cod_fee = VALUES(ext_cod_fee),
goods_cost = VALUES(goods_cost),
post_cost = VALUES(post_cost),
weight = VALUES(weight),
profit = VALUES(profit),
tax = VALUES(tax),
tax_rate = VALUES(tax_rate),
commission = VALUES(commission),
invoice_type = VALUES(invoice_type),
invoice_title = VALUES(invoice_title),
invoice_content = VALUES(invoice_content),
salesman_name = VALUES(salesman_name),
checker_name = VALUES(checker_name),
fchecker_name = VALUES(fchecker_name),
checkouter_name = VALUES(checkouter_name),
stockout_no = VALUES(stockout_no),
flag_name = VALUES(flag_name),
trade_from = VALUES(trade_from),
single_spec_no = VALUES(single_spec_no),
raw_goods_count = VALUES(raw_goods_count),
raw_goods_type_count = VALUES(raw_goods_type_count),
currency = VALUES(currency),
invoice_id = VALUES(invoice_id),
version_id = VALUES(version_id),
modified = VALUES(modified),
created = VALUES(created),
check_time = VALUES(check_time),
id_card_type = VALUES(id_card_type),
shop_no = VALUES(shop_no),
shop_name = VALUES(shop_name),
shop_remark = VALUES(shop_remark),
warehouse_no = VALUES(warehouse_no),
customer_name = VALUES(customer_name),
customer_no = VALUES(customer_no),
logistics_name = VALUES(logistics_name),
logistics_code = VALUES(logistics_code),
logistics_type_name = VALUES(logistics_type_name),
to_deliver_time = VALUES(to_deliver_time),
delay_to_time = VALUES(delay_to_time),
estimate_consign_time = VALUES(estimate_consign_time),
shop_id = VALUES(shop_id),
warehouse_id = VALUES(warehouse_id),
volume = VALUES(volume),
trade_label = VALUES(trade_label),
trade_mask = VALUES(trade_mask),
shop_platform_id = VALUES(shop_platform_id),
sub_platform_id = VALUES(sub_platform_id),
package_name = VALUES(package_name),
package_id = VALUES(package_id),
package_cost = VALUES(package_cost),
paid = VALUES(paid),
large_type = VALUES(large_type),
gift_mask = VALUES(gift_mask),
customer_id = VALUES(customer_id),
other_cost = VALUES(other_cost),
is_sealed = VALUES(is_sealed),
customer_type = VALUES(customer_type),
logistics_id = VALUES(logistics_id),
cancel_reason = VALUES(cancel_reason),
revert_reason = VALUES(revert_reason),
new_trade_label = VALUES(new_trade_label),
fenxiao_tid = VALUES(fenxiao_tid),
del_flag = VALUES(del_flag),
create_by = VALUES(create_by),
create_user_id = VALUES(create_user_id),
create_time = VALUES(create_time),
update_by = VALUES(update_by),
update_user_id = VALUES(update_user_id),
update_time = VALUES(update_time),
batch_no = VALUES(batch_no),
start_time = VALUES(start_time),
end_time = VALUES(end_time),
sync_type = VALUES(sync_type)
</insert>
<!-- 定义 FinanceOrder 表的字段 -->
<sql id="Order_Base_Column_List">
trade_id, trade_no, platform_id, warehouse_type, src_tids, pay_account, trade_status, trade_type,
delivery_term, receiver_ring, freeze_reason, refund_status, fenxiao_type, fenxiao_nick, trade_time,
pay_time, consign_time, buyer_nick, receiver_name, receiver_province, receiver_city, receiver_district,
receiver_address, receiver_mobile, receiver_telno, receiver_zip, receiver_area, receiver_dtb, bad_reason,
logistics_no, buyer_message, cs_remark, remark_flag, print_remark, goods_type_count, goods_count,
goods_amount, post_amount, other_amount, discount, receivable, cod_amount, ext_cod_fee, goods_cost,
post_cost, weight, profit, tax, tax_rate, commission, invoice_type, invoice_title, invoice_content,
salesman_name, checker_name, fchecker_name, checkouter_name, stockout_no, flag_name, trade_from,
single_spec_no, raw_goods_count, raw_goods_type_count, currency, invoice_id, version_id, modified,
created, check_time, id_card_type, shop_no, shop_name, shop_remark, warehouse_no, customer_name,
customer_no, logistics_name, logistics_code, logistics_type_name, to_deliver_time, delay_to_time,
estimate_consign_time, shop_id, warehouse_id, volume, trade_label, trade_mask, shop_platform_id,
sub_platform_id, package_name, package_id, package_cost, paid, large_type, gift_mask, customer_id,
other_cost, is_sealed, customer_type, logistics_id, cancel_reason, revert_reason, new_trade_label,
fenxiao_tid, del_flag, create_by, create_user_id, create_time, update_by, update_user_id, update_time,
batch_no, start_time, end_time, sync_type
</sql>
<!-- 根据 trade_id 查询订单 -->
<select id="selectFinanceOrderById" resultType="com.sfa.job.domain.order.entity.FinanceOrder">
SELECT
<include refid="Order_Base_Column_List"/>
FROM
finance_order
WHERE
trade_id = #{tradeId}
</select>
<!-- 查询所有订单 -->
<select id="selectAllFinanceOrders" resultType="com.sfa.job.domain.order.entity.FinanceOrder">
SELECT
<include refid="Order_Base_Column_List"/>
FROM
finance_order
</select>
<!-- 插入订单 -->
<insert id="insertFinanceOrder" parameterType="com.sfa.job.domain.order.entity.FinanceOrder">
INSERT INTO finance_order (
trade_id, trade_no, platform_id, warehouse_type, src_tids, pay_account, trade_status, trade_type,
delivery_term, receiver_ring, freeze_reason, refund_status, fenxiao_type, fenxiao_nick, trade_time,
pay_time, consign_time, buyer_nick, receiver_name, receiver_province, receiver_city, receiver_district,
receiver_address, receiver_mobile, receiver_telno, receiver_zip, receiver_area, receiver_dtb, bad_reason,
logistics_no, buyer_message, cs_remark, remark_flag, print_remark, goods_type_count, goods_count,
goods_amount, post_amount, other_amount, discount, receivable, cod_amount, ext_cod_fee, goods_cost,
post_cost, weight, profit, tax, tax_rate, commission, invoice_type, invoice_title, invoice_content,
salesman_name, checker_name, fchecker_name, checkouter_name, stockout_no, flag_name, trade_from,
single_spec_no, raw_goods_count, raw_goods_type_count, currency, invoice_id, version_id, modified,
created, check_time, id_card_type, shop_no, shop_name, shop_remark, warehouse_no, customer_name,
customer_no, logistics_name, logistics_code, logistics_type_name, to_deliver_time, delay_to_time,
estimate_consign_time, shop_id, warehouse_id, volume, trade_label, trade_mask, shop_platform_id,
sub_platform_id, package_name, package_id, package_cost, paid, large_type, gift_mask, customer_id,
other_cost, is_sealed, customer_type, logistics_id, cancel_reason, revert_reason, new_trade_label,
fenxiao_tid, del_flag, create_by, create_user_id, create_time, update_by, update_user_id, update_time,
batch_no, start_time, end_time, sync_type
) VALUES (
#{tradeId}, #{tradeNo}, #{platformId}, #{warehouseType}, #{srcTids}, #{payAccount}, #{tradeStatus}, #{tradeType},
#{deliveryTerm}, #{receiverRing}, #{freezeReason}, #{refundStatus}, #{fenxiaoType}, #{fenxiaoNick}, #{tradeTime},
#{payTime}, #{consignTime}, #{buyerNick}, #{receiverName}, #{receiverProvince}, #{receiverCity}, #{receiverDistrict},
#{receiverAddress}, #{receiverMobile}, #{receiverTelno}, #{receiverZip}, #{receiverArea}, #{receiverDtb}, #{badReason},
#{logisticsNo}, #{buyerMessage}, #{csRemark}, #{remarkFlag}, #{printRemark}, #{goodsTypeCount}, #{goodsCount},
#{goodsAmount}, #{postAmount}, #{otherAmount}, #{discount}, #{receivable}, #{codAmount}, #{extCodFee}, #{goodsCost},
#{postCost}, #{weight}, #{profit}, #{tax}, #{taxRate}, #{commission}, #{invoiceType}, #{invoiceTitle}, #{invoiceContent},
#{salesmanName}, #{checkerName}, #{fcheckerName}, #{checkouterName}, #{stockoutNo}, #{flagName}, #{tradeFrom},
#{singleSpecNo}, #{rawGoodsCount}, #{rawGoodsTypeCount}, #{currency}, #{invoiceId}, #{versionId}, #{modified},
#{created}, #{checkTime}, #{idCardType}, #{shopNo}, #{shopName}, #{shopRemark}, #{warehouseNo}, #{customerName},
#{customerNo}, #{logisticsName}, #{logisticsCode}, #{logisticsTypeName}, #{toDeliverTime}, #{delayToTime},
#{estimateConsignTime}, #{shopId}, #{warehouseId}, #{volume}, #{tradeLabel}, #{tradeMask}, #{shopPlatformId},
#{subPlatformId}, #{packageName}, #{packageId}, #{packageCost}, #{paid}, #{largeType}, #{giftMask}, #{customerId},
#{otherCost}, #{isSealed}, #{customerType}, #{logisticsId}, #{cancelReason}, #{revertReason}, #{newTradeLabel},
#{fenxiaoTid}, #{delFlag}, #{createBy}, #{createUserId}, #{createTime}, #{updateBy}, #{updateUserId}, #{updateTime},
#{batchNo}, #{startTime}, #{endTime}, #{syncType}
)
</insert>
<!-- 根据 trade_id 更新订单 -->
<update id="updateFinanceOrderById" parameterType="com.sfa.job.domain.order.entity.FinanceOrder">
UPDATE finance_order
SET
trade_no = #{tradeNo},
platform_id = #{platformId},
warehouse_type = #{warehouseType},
src_tids = #{srcTids},
pay_account = #{payAccount},
trade_status = #{tradeStatus},
trade_type = #{tradeType},
delivery_term = #{deliveryTerm},
receiver_ring = #{receiverRing},
freeze_reason = #{freezeReason},
refund_status = #{refundStatus},
fenxiao_type = #{fenxiaoType},
fenxiao_nick = #{fenxiaoNick},
trade_time = #{tradeTime},
pay_time = #{payTime},
consign_time = #{consignTime},
buyer_nick = #{buyerNick},
receiver_name = #{receiverName},
receiver_province = #{receiverProvince},
receiver_city = #{receiverCity},
receiver_district = #{receiverDistrict},
receiver_address = #{receiverAddress},
receiver_mobile = #{receiverMobile},
receiver_telno = #{receiverTelno},
receiver_zip = #{receiverZip},
receiver_area = #{receiverArea},
receiver_dtb = #{receiverDtb},
bad_reason = #{badReason},
logistics_no = #{logisticsNo},
buyer_message = #{buyerMessage},
cs_remark = #{csRemark},
remark_flag = #{remarkFlag},
print_remark = #{printRemark},
goods_type_count = #{goodsTypeCount},
goods_count = #{goodsCount},
goods_amount = #{goodsAmount},
post_amount = #{postAmount},
other_amount = #{otherAmount},
discount = #{discount},
receivable = #{receivable},
cod_amount = #{codAmount},
ext_cod_fee = #{extCodFee},
goods_cost = #{goodsCost},
post_cost = #{postCost},
weight = #{weight},
profit = #{profit},
tax = #{tax},
tax_rate = #{taxRate},
commission = #{commission},
invoice_type = #{invoiceType},
invoice_title = #{invoiceTitle},
invoice_content = #{invoiceContent},
salesman_name = #{salesmanName},
checker_name = #{checkerName},
fchecker_name = #{fcheckerName},
checkouter_name = #{checkouterName},
stockout_no = #{stockoutNo},
flag_name = #{flagName},
trade_from = #{tradeFrom},
single_spec_no = #{singleSpecNo},
raw_goods_count = #{rawGoodsCount},
raw_goods_type_count = #{rawGoodsTypeCount},
currency = #{currency},
invoice_id = #{invoiceId},
version_id = #{versionId},
modified = #{modified},
created = #{created},
check_time = #{checkTime},
id_card_type = #{idCardType},
shop_no = #{shopNo},
shop_name = #{shopName},
shop_remark = #{shopRemark},
warehouse_no = #{warehouseNo},
customer_name = #{customerName},
customer_no = #{customerNo},
logistics_name = #{logisticsName},
logistics_code = #{logisticsCode},
logistics_type_name = #{logisticsTypeName},
to_deliver_time = #{toDeliverTime},
delay_to_time = #{delayToTime},
estimate_consign_time = #{estimateConsignTime},
shop_id = #{shopId},
warehouse_id = #{warehouseId},
volume = #{volume},
trade_label = #{tradeLabel},
trade_mask = #{tradeMask},
shop_platform_id = #{shopPlatformId},
sub_platform_id = #{subPlatformId},
package_name = #{packageName},
package_id = #{packageId},
package_cost = #{packageCost},
paid = #{paid},
large_type = #{largeType},
gift_mask = #{giftMask},
customer_id = #{customerId},
other_cost = #{otherCost},
is_sealed = #{isSealed},
customer_type = #{customerType},
logistics_id = #{logisticsId},
cancel_reason = #{cancelReason},
revert_reason = #{revertReason},
new_trade_label = #{newTradeLabel},
fenxiao_tid = #{fenxiaoTid},
del_flag = #{delFlag},
create_by = #{createBy},
create_user_id = #{createUserId},
create_time = #{createTime},
update_by = #{updateBy},
update_user_id = #{updateUserId},
update_time = #{updateTime},
batch_no = #{batchNo},
start_time = #{startTime},
end_time = #{endTime},
sync_type = #{syncType}
WHERE
trade_id = #{tradeId}
</update>
<!-- 根据 trade_id 删除订单 -->
<delete id="deleteFinanceOrderById" parameterType="java.lang.Long">
DELETE FROM finance_order
WHERE
trade_id = #{tradeId}
</delete>
</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.sfa.job.domain.order.mapper.WdtRefundAmountDetailMapper">
<insert id="saveOrUpdateBatch" parameterType="java.util.List">
INSERT INTO wdt_refund_amount_detail (
rec_id,
refund_id,
refund_type,
is_return,
refund_amount,
receive_amount,
is_guarantee,
account_id,
pay_account,
account_name,
account_bank,
is_auto,
remark
)
VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.recId},
#{item.refundId},
#{item.refundType},
#{item.isReturn},
#{item.refundAmount},
#{item.receiveAmount},
#{item.isGuarantee},
#{item.accountId},
#{item.payAccount},
#{item.accountName},
#{item.accountBank},
#{item.isAuto},
#{item.remark}
)
</foreach>
ON DUPLICATE KEY UPDATE
refund_id = VALUES(refund_id),
refund_type = VALUES(refund_type),
is_return = VALUES(is_return),
refund_amount = VALUES(refund_amount),
receive_amount = VALUES(receive_amount),
is_guarantee = VALUES(is_guarantee),
account_id = VALUES(account_id),
pay_account = VALUES(pay_account),
account_name = VALUES(account_name),
account_bank = VALUES(account_bank),
is_auto = VALUES(is_auto),
remark = VALUES(remark)
</insert>
</mapper>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sfa.job.domain.order.mapper.WdtRefundOrderDetailMapper">
<insert id="saveOrUpdateBatch" parameterType="java.util.List">
INSERT INTO wdt_refund_order_detail (
rec_id, refund_id, oid, trade_order_id, platform_id, tid, trade_no,
num, price, original_price, checked_cost_price, refund_num, total_amount,
refund_amount, is_guarantee, goods_no, goods_name, spec_name, spec_no,
goods_id, spec_id, sys_goods_id, sys_spec_id, spec_code, barcode,
stockin_num, remark, api_spec_name, api_goods_name, modified, suite_no,
suite_name, raw_refund_nos, raw_refund_no, sales_trade_id, discount, paid,
suite_id, suite_num, created, modified_date, gift_type
)
VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.recId},
#{item.refundId},
#{item.oid},
#{item.tradeOrderId},
#{item.platformId},
#{item.tid},
#{item.tradeNo},
#{item.num},
#{item.price},
#{item.originalPrice},
#{item.checkedCostPrice},
#{item.refundNum},
#{item.totalAmount},
#{item.refundAmount},
#{item.isGuarantee},
#{item.goodsNo},
#{item.goodsName},
#{item.specName},
#{item.specNo},
#{item.goodsId},
#{item.specId},
#{item.sysGoodsId},
#{item.sysSpecId},
#{item.specCode},
#{item.barcode},
#{item.stockinNum},
#{item.remark},
#{item.apiSpecName},
#{item.apiGoodsName},
#{item.modified},
#{item.suiteNo},
#{item.suiteName},
#{item.rawRefundNos},
#{item.rawRefundNo},
#{item.salesTradeId},
#{item.discount},
#{item.paid},
#{item.suiteId},
#{item.suiteNum},
#{item.created},
#{item.modifiedDate},
#{item.giftType}
)
</foreach>
ON DUPLICATE KEY UPDATE
refund_id = VALUES(refund_id),
oid = VALUES(oid),
trade_order_id = VALUES(trade_order_id),
platform_id = VALUES(platform_id),
tid = VALUES(tid),
trade_no = VALUES(trade_no),
num = VALUES(num),
price = VALUES(price),
original_price = VALUES(original_price),
checked_cost_price = VALUES(checked_cost_price),
refund_num = VALUES(refund_num),
total_amount = VALUES(total_amount),
refund_amount = VALUES(refund_amount),
is_guarantee = VALUES(is_guarantee),
goods_no = VALUES(goods_no),
goods_name = VALUES(goods_name),
spec_name = VALUES(spec_name),
spec_no = VALUES(spec_no),
goods_id = VALUES(goods_id),
spec_id = VALUES(spec_id),
sys_goods_id = VALUES(sys_goods_id),
sys_spec_id = VALUES(sys_spec_id),
spec_code = VALUES(spec_code),
barcode = VALUES(barcode),
stockin_num = VALUES(stockin_num),
remark = VALUES(remark),
api_spec_name = VALUES(api_spec_name),
api_goods_name = VALUES(api_goods_name),
modified = VALUES(modified),
suite_no = VALUES(suite_no),
suite_name = VALUES(suite_name),
raw_refund_nos = VALUES(raw_refund_nos),
raw_refund_no = VALUES(raw_refund_no),
sales_trade_id = VALUES(sales_trade_id),
discount = VALUES(discount),
paid = VALUES(paid),
suite_id = VALUES(suite_id),
suite_num = VALUES(suite_num),
created = VALUES(created),
modified_date = VALUES(modified_date),
gift_type = VALUES(gift_type)
</insert>
</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.sfa.job.domain.order.mapper.WdtRefundOrderMapper">
<insert id="saveOrUpdateBatch" parameterType="java.util.List">
INSERT INTO wdt_refund_order (
refund_id, src_tids, refund_no, remark, type,
stockin_status, flag_name, return_goods_count,
receiver_telno, receiver_name, modified, note_count,
shop_no, from_type, created, settle_time, check_time,
return_logistics_no, trade_no_list, guarantee_refund_amount,
return_goods_amount, return_logistics_name, reason_name,
refund_reason, buyer_nick, operator_name, actual_refund_amount,
revert_reason_name, return_warehouse_no, direct_refund_amount,
receive_amount, customer_name, fenxiao_nick_name, status,
shop_id, trade_id, raw_refund_nos, pay_id, provider_refund_no,
shop_platform_id, tid_list, sub_platform_id, return_warehouse_id,
platform_id, wms_owner_no, warehouse_type, bad_reason, modified_date,
return_mask_info, process_status, reason_id, revert_reason,
customer_id, consign_mode, refund_time, fenxiao_tid, fenxiao_nick_no,
wms_code, rr_status, current_phase_timeout
)
values
<foreach collection="list" item="item" separator=",">
(
#{item.refundId},
#{item.srcTids},
#{item.refundNo},
#{item.remark},
#{item.type},
#{item.stockinStatus},
#{item.flagName},
#{item.returnGoodsCount},
#{item.receiverTelno},
#{item.receiverName},
#{item.modified},
#{item.noteCount},
#{item.shopNo},
#{item.fromType},
#{item.created},
#{item.settleTime},
#{item.checkTime},
#{item.returnLogisticsNo},
#{item.tradeNoList},
#{item.guaranteeRefundAmount},
#{item.returnGoodsAmount},
#{item.returnLogisticsName},
#{item.reasonName},
#{item.refundReason},
#{item.buyerNick},
#{item.operatorName},
#{item.actualRefundAmount},
#{item.revertReasonName},
#{item.returnWarehouseNo},
#{item.directRefundAmount},
#{item.receiveAmount},
#{item.customerName},
#{item.fenxiaoNickName},
#{item.status},
#{item.shopId},
#{item.tradeId},
#{item.rawRefundNos},
#{item.payId},
#{item.providerRefundNo},
#{item.shopPlatformId},
#{item.tidList},
#{item.subPlatformId},
#{item.returnWarehouseId},
#{item.platformId},
#{item.wmsOwnerNo},
#{item.warehouseType},
#{item.badReason},
#{item.modifiedDate},
#{item.returnMaskInfo},
#{item.processStatus},
#{item.reasonId},
#{item.revertReason},
#{item.customerId},
#{item.consignMode},
#{item.refundTime},
#{item.fenxiaoTid},
#{item.fenxiaoNickNo},
#{item.wmsCode},
#{item.rrStatus},
#{item.currentPhaseTimeout}
)
</foreach>
ON DUPLICATE KEY UPDATE
src_tids = VALUES(src_tids),
refund_no = VALUES(refund_no),
remark = VALUES(remark),
type = VALUES(type),
stockin_status = VALUES(stockin_status),
flag_name = VALUES(flag_name),
return_goods_count = VALUES(return_goods_count),
receiver_telno = VALUES(receiver_telno),
receiver_name = VALUES(receiver_name),
modified = VALUES(modified),
note_count = VALUES(note_count),
shop_no = VALUES(shop_no),
from_type = VALUES(from_type),
created = VALUES(created),
settle_time = VALUES(settle_time),
check_time = VALUES(check_time),
return_logistics_no = VALUES(return_logistics_no),
trade_no_list = VALUES(trade_no_list),
guarantee_refund_amount = VALUES(guarantee_refund_amount),
return_goods_amount = VALUES(return_goods_amount),
return_logistics_name = VALUES(return_logistics_name),
reason_name = VALUES(reason_name),
refund_reason = VALUES(refund_reason),
buyer_nick = VALUES(buyer_nick),
operator_name = VALUES(operator_name),
actual_refund_amount = VALUES(actual_refund_amount),
revert_reason_name = VALUES(revert_reason_name),
return_warehouse_no = VALUES(return_warehouse_no),
direct_refund_amount = VALUES(direct_refund_amount),
receive_amount = VALUES(receive_amount),
customer_name = VALUES(customer_name),
fenxiao_nick_name = VALUES(fenxiao_nick_name),
status = VALUES(status),
shop_id = VALUES(shop_id),
trade_id = VALUES(trade_id),
raw_refund_nos = VALUES(raw_refund_nos),
pay_id = VALUES(pay_id),
provider_refund_no = VALUES(provider_refund_no),
shop_platform_id = VALUES(shop_platform_id),
tid_list = VALUES(tid_list),
sub_platform_id = VALUES(sub_platform_id),
return_warehouse_id = VALUES(return_warehouse_id),
platform_id = VALUES(platform_id),
wms_owner_no = VALUES(wms_owner_no),
warehouse_type = VALUES(warehouse_type),
bad_reason = VALUES(bad_reason),
modified_date = VALUES(modified_date),
return_mask_info = VALUES(return_mask_info),
process_status = VALUES(process_status),
reason_id = VALUES(reason_id),
revert_reason = VALUES(revert_reason),
customer_id = VALUES(customer_id),
consign_mode = VALUES(consign_mode),
refund_time = VALUES(refund_time),
fenxiao_tid = VALUES(fenxiao_tid),
fenxiao_nick_no = VALUES(fenxiao_nick_no),
wms_code = VALUES(wms_code),
rr_status = VALUES(rr_status),
current_phase_timeout = VALUES(current_phase_timeout)
</insert>
</mapper>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sfa.job.domain.order.mapper.WdtSwapOrderDetailMapper">
<insert id="saveOrUpdateBatch" parameterType="java.util.List">
INSERT INTO wdt_swap_order_detail (
oid,
target_type,
target_id,
defect,
goods_name,
goods_no,
spec_name,
spec_code,
merchant_no,
price,
total_amount,
num,
remark
)
VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.oid},
#{item.targetType},
#{item.targetId},
#{item.defect},
#{item.goodsName},
#{item.goodsNo},
#{item.specName},
#{item.specCode},
#{item.merchantNo},
#{item.price},
#{item.totalAmount},
#{item.num},
#{item.remark}
)
</foreach>
ON DUPLICATE KEY UPDATE
oid = VALUES(oid),
target_type = VALUES(target_type),
target_id = VALUES(target_id),
defect = VALUES(defect),
goods_name = VALUES(goods_name),
goods_no = VALUES(goods_no),
spec_name = VALUES(spec_name),
spec_code = VALUES(spec_code),
merchant_no = VALUES(merchant_no),
price = VALUES(price),
total_amount = VALUES(total_amount),
num = VALUES(num),
remark = VALUES(remark)
</insert>
</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.sfa.job.domain.order.mapper.WdtSwapOrderMapper">
<insert id="saveOrUpdateBatch" parameterType="java.util.List">
INSERT INTO wdt_swap_order (
tid,
shop_no,
shop_name,
warehouse_no,
shop_id,
warehouse_id,
swap_province,
swap_city,
swap_area,
swap_district,
swap_logistics_id,
post_amount,
other_amount
)
VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.tid},
#{item.shopNo},
#{item.shopName},
#{item.warehouseNo},
#{item.shopId},
#{item.warehouseId},
#{item.swapProvince},
#{item.swapCity},
#{item.swapArea},
#{item.swapDistrict},
#{item.swapLogisticsId},
#{item.postAmount},
#{item.otherAmount}
)
</foreach>
ON DUPLICATE KEY UPDATE
tid = VALUES(tid),
shop_no = VALUES(shop_no),
shop_name = VALUES(shop_name),
warehouse_no = VALUES(warehouse_no),
shop_id = VALUES(shop_id),
warehouse_id = VALUES(warehouse_id),
swap_province = VALUES(swap_province),
swap_city = VALUES(swap_city),
swap_area = VALUES(swap_area),
swap_district = VALUES(swap_district),
swap_logistics_id = VALUES(swap_logistics_id),
post_amount = VALUES(post_amount),
other_amount = VALUES(other_amount)
</insert>
</mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论