对账管理

This commit is contained in:
wuchunlei
2025-12-19 17:50:57 +08:00
parent b3ce1e4add
commit 1d7b8a719c
37 changed files with 1825 additions and 90 deletions

View File

@@ -3,8 +3,10 @@ package com.zmzm.finance.common.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zmzm.finance.common.entity.Import;
import com.zmzm.finance.common.entity.Payment;
import com.zmzm.finance.common.entity.PaymentToOrder;
import com.zmzm.finance.common.service.IImportService;
import com.zmzm.finance.common.service.IPaymentService;
import com.zmzm.finance.common.service.IPaymentToOrderService;
import com.zmzm.finance.util.ExcelUtil;
import com.zmzm.finance.util.FileUtil;
import com.zmzm.finance.util.R;
@@ -20,7 +22,11 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.InputStream;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.YearMonth;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.Collectors;
/**
* <p>
@@ -38,10 +44,29 @@ public class ImportController {
private IImportService importService;
@Autowired
private IPaymentService paymentService;
@Autowired
private IPaymentToOrderService paymentToOrderService;
//导入文件列表
@RequestMapping("/getImportList")
public R getImportList(@RequestBody Map<String,Object> params){
Import alreadyImport = importService.getOne(new LambdaQueryWrapper<Import>()
.orderByDesc(Import::getYear,Import::getMonth).last("limit 1"));
// if(alreadyImport == null){
// alreadyImport = new Import();
// alreadyImport.setYear(2022);
// alreadyImport.setMonth(12);
// importService.save(alreadyImport);
// }
// YearMonth startMonth = YearMonth.of(alreadyImport.getYear(),alreadyImport.getMonth());
// YearMonth endMonth = YearMonth.now();
// long difference = ChronoUnit.MONTHS.between(startMonth, endMonth);
if(alreadyImport == null){
Import import1 = new Import();
import1.setYear(LocalDateTime.now().getYear());
import1.setMonth(LocalDateTime.now().getMonthValue());
importService.save(import1);
}
List<Import> importList = importService.list(new LambdaQueryWrapper<Import>()
.eq(StringUtils.isNotEmpty(params.get("year").toString()),Import::getYear,params.get("year"))
.eq(StringUtils.isNotEmpty(params.get("month").toString()),Import::getMonth,params.get("month")));
@@ -57,9 +82,15 @@ public class ImportController {
Import imp = importService.getOne(new LambdaQueryWrapper<Import>()
.eq(Import::getYear, year).eq(Import::getMonth, month));
if(imp != null){
List<Payment> oldPayments = paymentService.list(new LambdaQueryWrapper<Payment>()
.eq(Payment::getImportId,imp.getId()).eq(Payment::getType, type));
paymentService.removeBatchByIds(oldPayments);
List<Integer> oldPaymentIds = paymentService.list(new LambdaQueryWrapper<Payment>()
.eq(Payment::getImportId,imp.getId()).eq(Payment::getType, type))
.stream().map(Payment::getId).toList();
if (!oldPaymentIds.isEmpty()) {
List<PaymentToOrder> ptos = paymentToOrderService.list(new LambdaQueryWrapper<PaymentToOrder>()
.in(PaymentToOrder::getPaymentId,oldPaymentIds));
paymentService.removeBatchByIds(oldPaymentIds);
paymentToOrderService.removeByIds(ptos);
}
}else {
imp = new Import();
imp.setYear(year);
@@ -97,9 +128,9 @@ public class ImportController {
Payment payment = new Payment();
payment.setImportId(imp.getId());
payment.setType(map.containsKey("A"+i)?Integer.valueOf(map.get("A"+i)):0);
payment.setFinanceSn(map.getOrDefault("B" + i, ""));
payment.setTransactionSn(map.getOrDefault("C" + i, ""));
payment.setRelationSn(map.getOrDefault("D" + i, ""));
payment.setFinanceSn(map.getOrDefault("B" + i, "").replace("\t",""));
payment.setTransactionSn(map.getOrDefault("C" + i, "").replace("\t",""));
payment.setRelationSn(map.getOrDefault("D" + i, "").replace("\t",""));
payment.setFee(new BigDecimal(map.get("E" + i)));
payment.setCtime(DateUtils.parseDate(map.get("F"+i), new String[]{"yyyy-MM-dd HH:mm:ss"}));
payment.setPaymentName(map.getOrDefault("G" + i, ""));

View File

@@ -1,24 +1,26 @@
package com.zmzm.finance.common.controller;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zmzm.finance.common.entity.Import;
import com.zmzm.finance.common.entity.Payment;
import com.zmzm.finance.common.service.IImportService;
import com.zmzm.finance.common.service.IPaymentService;
import com.zmzm.finance.util.ExcelUtil;
import com.zmzm.finance.util.FileUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.zmzm.finance.common.dao.TCurriculumCatalogueMapper;
import com.zmzm.finance.common.entity.*;
import com.zmzm.finance.common.service.*;
import com.zmzm.finance.util.R;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.*;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* <p>
@@ -35,75 +37,134 @@ public class PaymentController {
@Autowired
private IPaymentService paymentService;
@Autowired
private IImportService importService;
private IPaymentToOrderService paymentToOrderService;
@Autowired
private IOrdersService ordersService;
@Autowired
private ITCustomerTaihuClassService customerTaihuClassService;
@Autowired
private ITCurriculumCatalogueService curriculumCatalogueService;
@Autowired
private ITCommodityService commodityService;
//导入数据
@RequestMapping("/importData")
@Transactional
public R importData(@RequestParam("file") MultipartFile file,@RequestParam("type") int type,
@RequestParam("year") int year,@RequestParam("month") int month) {
//删除之前上的的数据
Import imp = importService.getOne(new LambdaQueryWrapper<Import>()
.eq(Import::getYear, year).eq(Import::getMonth, month));
if(imp != null){
List<Payment> oldPayments = paymentService.list(new LambdaQueryWrapper<Payment>()
.eq(Payment::getImportId,imp.getId()).eq(Payment::getType, type));
paymentService.removeBatchByIds(oldPayments);
//账单列表
@RequestMapping("/getPaymentList")
public R getPaymentList(@RequestBody Map<String,Object> params){
Page<Payment> paymentList = paymentService.page(new Page<>(Long.parseLong(params.get("page").toString()),
Long.parseLong(params.get("limit").toString())),new LambdaQueryWrapper<Payment>()
.eq(params.containsKey("type")&&StringUtils.isNotEmpty(params.get("type").toString()),
Payment::getType,params.get("type").toString())
.eq(params.containsKey("checkoff")&&StringUtils.isNotEmpty(params.get("checkoff").toString()),
Payment::getCheckoff,params.get("checkoff").toString())
.apply(params.containsKey("year")&&StringUtils.isNotEmpty(params.get("year").toString()),
"DATE_FORMAT(ctime, '%Y') = '"+params.get("year").toString()+"'")
.apply(params.containsKey("month")&&StringUtils.isNotEmpty(params.get("month").toString()),
"DATE_FORMAT(ctime, '%m') = '"+params.get("month").toString()+"'")
.orderByDesc(Payment::getCtime));
return R.ok().put("data",paymentList);
}
//自动对账
@RequestMapping("/autoCheckoff")
@DSTransactional
public R autoCheckoff(@RequestBody Map<String,Object> params){
//先同步吴门医述订单
ordersService.importWumenOrder();
//查询自动核对失败的平台流水
List<Payment> paymentList = paymentService.list(new MPJLambdaWrapper<Payment>()
.leftJoin(Orders.class,on->on
.eq(Orders::getOrderSn,Payment::getRelationSn).eq(Orders::getState,0))
.disableSubLogicDel()
.selectAll(Payment.class)
.selectAs(Orders::getId,"ordersId")
.selectAs(Orders::getOrderSn,"ordersSn")
.ne(Payment::getCheckoff,2)
.apply(params.containsKey("year")&&StringUtils.isNotEmpty(params.get("year").toString()),
"DATE_FORMAT(t.ctime, '%Y') = '"+params.get("year").toString()+"'")
.apply(params.containsKey("month")&&StringUtils.isNotEmpty(params.get("month").toString()),
"DATE_FORMAT(t.ctime, '%m') = '"+params.get("month").toString()+"'"));
List<PaymentToOrder> ptos = new ArrayList<>();
List<Payment> ps = new ArrayList<>();
//自动绑定
for (Payment payment : paymentList) {
if (StringUtils.isNotEmpty(payment.getRelationSn())&&
payment.getRelationSn().equals(payment.getOrdersSn())) {
PaymentToOrder pto = new PaymentToOrder();
pto.setPaymentId(payment.getId());
pto.setOrderId(payment.getOrdersId());
ptos.add(pto);
payment.setCheckoff(2);
}else {
imp = new Import();
imp.setYear(year);
imp.setMonth(month);
payment.setCheckoff(1);
}
//上传文件
FileUtil fileUtil = new FileUtil();
String url = fileUtil.uploadFile(file);
if(0==type){
imp.setWechatFile(url);
}else if(1==type){
imp.setAlipayFile(url);
}else if(2==type){
imp.setBankFile(url);
ps.add(payment);
}
importService.saveOrUpdate(imp);
//导入新数据
int num = 0;
try (InputStream fis = file.getInputStream()) {
//解析数据
ExcelUtil example = new ExcelUtil();
example.processOneSheet(fis);
LinkedHashMap<String, String> map = example.getRowContents();
Iterator<Map.Entry<String, String>> it = map.entrySet().iterator();
//处理数据
int count = 0;
List<Payment> list = new ArrayList<>();
while (it.hasNext()) {
Map.Entry<String, String> entry = it.next();
String pos = entry.getKey();
String rowNo = pos.replaceAll("[a-zA-Z]", "");
count = Integer.parseInt(rowNo);
System.out.println(pos + ";" + entry.getValue());
paymentService.updateBatchById(ps);
paymentToOrderService.saveBatch(ptos);
return R.ok();
}
for (int i=2;i<=count;i++){
Payment payment = new Payment();
payment.setImportId(imp.getId());
payment.setType(map.containsKey("A"+i)?Integer.valueOf(map.get("A"+i)):0);
payment.setFinanceSn(map.getOrDefault("B" + i, ""));
payment.setTransactionSn(map.getOrDefault("C" + i, ""));
payment.setRelationSn(map.getOrDefault("D" + i, ""));
payment.setFee(new BigDecimal(map.get("E" + i)));
payment.setCtime(DateUtils.parseDate(map.get("F"+i), new String[]{"yyyy-MM-dd HH:mm:ss"}));
payment.setPaymentName(map.getOrDefault("G" + i, ""));
payment.setPaymentType(map.getOrDefault("H" + i, ""));
payment.setRemark(map.getOrDefault("I" + i, ""));
list.add(payment);
num++;
//手动对账订单列表
@RequestMapping("/manualList")
public R manualList(@RequestBody Map<String,Object> params){
Payment payment = paymentService.getById(params.get("paymentId").toString());
Page<Orders> ordersList = ordersService.page(new Page<>(Long.parseLong(params.get("page").toString()),
Long.parseLong(params.get("limit").toString())), new LambdaQueryWrapper<Orders>()
.notExists("select 1 from payment_to_order where order_id = orders.id and state = 0")
.eq(Orders::getFee, payment.getFee())
.ge(Orders::getOrderTime, DateUtils.addDays(payment.getCtime(),-1))
.le(Orders::getOrderTime, DateUtils.addDays(payment.getCtime(),3))
.orderByAsc(Orders::getOrderTime));
return R.ok().put("data",ordersList);
}
paymentService.saveBatch(list);
} catch (Exception e) {
e.printStackTrace();
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return R.error(e.getMessage());
//手动对账确认
@RequestMapping("/manualCheckoff")
public R manualCheckoff(@RequestBody PaymentToOrder pto){
Payment payment = paymentService.getById(pto.getPaymentId());
payment.setCheckoff(2);
paymentService.updateById(payment);
paymentToOrderService.save(pto);
return R.ok();
}
return R.ok("导入成功"+num+"");
//获取课程消费记录
@RequestMapping("/courseBuyList")
public R courseBuyList(@RequestBody Map<String,Object> params) {
Payment payment = paymentService.getById(params.get("paymentId").toString());
Page<Map<String,Object>> page = customerTaihuClassService.pageMaps(new Page<>(Long.parseLong(params.get("page").toString()),Long.parseLong(params.get("limit").toString())),
new MPJLambdaWrapper<TCustomerTaihuClass>()
.leftJoin(TCurriculumCatalogue.class,TCurriculumCatalogue::getOid,TCustomerTaihuClass::getTaihuclassoid)
.leftJoin(TCurriculumCatalogue.class,TCurriculumCatalogue::getOid,TCurriculumCatalogue::getPoid)
.select("t.oid,t.customerOid,t.createDate,t.studyDays,t1.courseFee,t1.title courseTitle,t2.title catalogueTitle")
.like(TCustomerTaihuClass::getDescription,"后台免费开通")
.ge(TCustomerTaihuClass::getCreatedate, payment.getCtime())
.le(TCustomerTaihuClass::getCreatedate, DateUtils.addDays(payment.getCtime(),3))
.orderByAsc(TCustomerTaihuClass::getCreatedate));
return R.ok().put("data",page);
}
//获取实物消费记录
@RequestMapping("/physicalBuyList")
public R physicalBuyList(@RequestBody Map<String,Object> params) {
Payment payment = paymentService.getById(params.get("paymentId").toString());
Page<Map<String,Object>> page = commodityService.pageMaps(new Page<>(Long.parseLong(params.get("page").toString()),Long.parseLong(params.get("limit").toString())),
new MPJLambdaWrapper<TCommodity>()
.select("t.oid,t.namecn,t.currentprice")
.eq(TCommodity::getStoreoid, "015ed7e15a9b4bcb961a8f9c4666265d")
.eq(TCommodity::getValid, 1)
.gt(TCommodity::getCurrentprice,0)
.orderByAsc(TCommodity::getCurrentprice));
return R.ok().put("data",page);
}
//通过添加订单核对
@RequestMapping("/checkoffByAddOrder")
@DSTransactional
public R checkoffByAddOrder(@RequestBody Map<String,Object> params) {
return R.ok();
}
}

View File

@@ -0,0 +1,20 @@
package com.zmzm.finance.common.dao;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zmzm.finance.common.entity.BuyOrder;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 订单表 Mapper 接口
* </p>
*
* @author baomidou
* @since 2025-12-16
*/
@Mapper
@DS("wumen")
public interface BuyOrderMapper extends BaseMapper<BuyOrder> {
}

View File

@@ -0,0 +1,20 @@
package com.zmzm.finance.common.dao;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zmzm.finance.common.entity.BuyOrderProduct;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author baomidou
* @since 2025-12-16
*/
@Mapper
@DS("wumen")
public interface BuyOrderProductMapper extends BaseMapper<BuyOrderProduct> {
}

View File

@@ -0,0 +1,18 @@
package com.zmzm.finance.common.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zmzm.finance.common.entity.Orders;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 订单表,从我们各个系统读取的数据 Mapper 接口
* </p>
*
* @author baomidou
* @since 2025-12-16
*/
@Mapper
public interface OrdersMapper extends BaseMapper<Orders> {
}

View File

@@ -0,0 +1,20 @@
package com.zmzm.finance.common.dao;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zmzm.finance.common.entity.PayZfbOrder;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 支付宝订单表 Mapper 接口
* </p>
*
* @author baomidou
* @since 2025-12-17
*/
@Mapper
@DS("wumen")
public interface PayZfbOrderMapper extends BaseMapper<PayZfbOrder> {
}

View File

@@ -0,0 +1,18 @@
package com.zmzm.finance.common.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zmzm.finance.common.entity.PaymentToOrder;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author baomidou
* @since 2025-12-16
*/
@Mapper
public interface PaymentToOrderMapper extends BaseMapper<PaymentToOrder> {
}

View File

@@ -0,0 +1,20 @@
package com.zmzm.finance.common.dao;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zmzm.finance.common.entity.ShopProduct;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 商品表 Mapper 接口
* </p>
*
* @author baomidou
* @since 2025-12-16
*/
@Mapper
@DS("wumen")
public interface ShopProductMapper extends BaseMapper<ShopProduct> {
}

View File

@@ -0,0 +1,20 @@
package com.zmzm.finance.common.dao;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zmzm.finance.common.entity.TCommodity;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author baomidou
* @since 2025-12-19
*/
@Mapper
@DS("yljk")
public interface TCommodityMapper extends BaseMapper<TCommodity> {
}

View File

@@ -0,0 +1,20 @@
package com.zmzm.finance.common.dao;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zmzm.finance.common.entity.TCurriculumCatalogue;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author baomidou
* @since 2025-12-19
*/
@Mapper
@DS("yljk")
public interface TCurriculumCatalogueMapper extends BaseMapper<TCurriculumCatalogue> {
}

View File

@@ -0,0 +1,20 @@
package com.zmzm.finance.common.dao;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zmzm.finance.common.entity.TCustomerTaihuClass;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author baomidou
* @since 2025-12-19
*/
@Mapper
@DS("yljk")
public interface TCustomerTaihuClassMapper extends BaseMapper<TCustomerTaihuClass> {
}

View File

@@ -0,0 +1,224 @@
package com.zmzm.finance.common.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
/**
* <p>
* 订单表
* </p>
*
* @author baomidou
* @since 2025-12-16
*/
@Getter
@Setter
@ToString
@TableName("buy_order")
public class BuyOrder implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "order_id", type = IdType.AUTO)
private Integer orderId;
@TableLogic
private Integer delFlag;
/**
* 订单编号 yyyymmddnnnnnnnn
*/
private String orderSn;
/**
* 下单人ID
*/
private Integer userId;
/**
* 收货人姓名
*/
private String shippingUser;
/**
* 省
*/
private String province;
/**
* 市
*/
private String city;
/**
* 区
*/
private String district;
/**
* 收货人手机号
*/
private String userPhone;
/**
* 地址
*/
private String address;
/**
* 订单来源0疯子读书1国学众妙之门2医学吴门医述3心灵空间4太湖云医
*/
private Integer come;
/**
* 支付方式 1微信2支付宝3ios内购4.疯币
*/
private String paymentMethod;
/**
* 订单金额
*/
private BigDecimal orderMoney;
/**
* 优惠金额
*/
private BigDecimal districtMoney;
/**
* vip折扣金额
*/
private BigDecimal vipDiscountAmount;
/**
* 实收金额
*/
private BigDecimal realMoney;
/**
* 运费
*/
private BigDecimal shippingMoney;
/**
* 积分抵扣
*/
private BigDecimal jfDeduction;
/**
* 物流公司名称
*/
private String shippingCompName;
/**
* 物流单号
*/
private String shippingSn;
/**
* 优惠券id
*/
private Integer couponId;
/**
* 优惠券名称
*/
private String couponName;
/**
* 下单时间
*/
private Date createTime;
/**
* 发货时间
*/
private Date shippingTime;
/**
* 订单状态 0-未付款 1-待发货 2-已发货 3-交易成功 4-交易失败 5-已过期
*/
private String orderStatus;
/**
* 交易成功时间
*/
private LocalDateTime successTime;
/**
* vip order point relearn trainingClass aiVip upgradeAiVip
*/
private String orderType;
/**
* 快递单号
*/
private String expNo;
/**
* 是否存在发货的商品 0不存在1已存在
*/
private String isSend;
/**
* 地址id
*/
private Integer addressId;
/**
* 备注
*/
private String remark;
/**
* 发送给快递鸟的订单编号
*/
private String orderCode;
/**
* 支付时间
*/
private LocalDateTime paymentDate;
/**
* 冲值配置表book_buy_config id
*/
private String productId;
/**
* 会员配置表vip_buy_config id
*/
private Integer vipBuyConfigId;
/**
* ai会员配置表ai_buy_config id
*/
private Integer aiBuyConfigId;
/**
* 培训班id
*/
private Integer trainingClassId;
/**
* 评价id,0 未评价1评价2追评
*/
private Integer recordId;
/**
* 是否修改过地址
*/
private Integer addressModified;
@TableField(exist = false)
private String tel;
@TableField(exist = false)
private String goodsType;
}

View File

@@ -0,0 +1,76 @@
package com.zmzm.finance.common.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* <p>
*
* </p>
*
* @author baomidou
* @since 2025-12-16
*/
@Getter
@Setter
@ToString
@TableName("buy_order_product")
public class BuyOrderProduct implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键 ID
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 订单号
*/
private Integer orderId;
/**
* 商品 ID
*/
private Integer productId;
/**
* 数量
*/
private Integer quantity;
/**
* 实际价格
*/
private BigDecimal realPrice;
/**
* 删除标识
*/
@TableLogic
private Integer delFlag;
/**
* 快递单号
*/
private Integer expressOrderId;
/**
* 评价 ID
*/
private Integer recordId;
/**
* 是否已发货0否1是
*/
private Integer shipped;
}

View File

@@ -56,5 +56,5 @@ public class Import implements Serializable {
* 状态
*/
@TableLogic
private Byte state;
private Integer state;
}

View File

@@ -0,0 +1,73 @@
package com.zmzm.finance.common.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
/**
* <p>
* 订单表,从我们各个系统读取的数据
* </p>
*
* @author baomidou
* @since 2025-12-16
*/
@Getter
@Setter
@ToString
public class Orders implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 0一路健康1吴门医述2手动添加
*/
private Integer source;
/**
* 原系统的订单号
*/
private String orderSn;
/**
* 原系统数据库表的主键id
*/
private String orderOldId;
/**
* 电话
*/
private String tel;
/**
* 金额
*/
private BigDecimal fee;
/**
* 订单类型0充值1vip2课3实物4培训班
*/
private Integer type;
/**
* 订单时间
*/
private Date orderTime;
/**
* 状态0初始1删除
*/
@TableLogic
private Integer state;
}

View File

@@ -0,0 +1,97 @@
package com.zmzm.finance.common.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 支付宝订单表
* </p>
*
* @author baomidou
* @since 2025-12-17
*/
@Getter
@Setter
@ToString
@TableName("pay_zfb_order")
public class PayZfbOrder implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
private String customerId;
private String outTradeNo;
private String tradeNo;
private LocalDateTime notifyTime;
private String notifyType;
private String notifyId;
private String appId;
private String authAppId;
private String charset;
private String version;
private String signType;
private String sign;
private String outBizNo;
private String buyerId;
private String buyerLogonId;
private String sellerId;
private String sellerEmail;
private String tradeStatus;
private String totalAmount;
private String receiptAmount;
private String invoiceAmount;
private String buyerPayAmount;
private String pointAmount;
private String refundFee;
private String subject;
private String body;
private LocalDateTime gmtCreate;
private LocalDateTime gmtPayment;
private LocalDateTime gmtRefund;
private LocalDateTime gmtClose;
private String fundBillList;
private String voucherDetailList;
private String relevanceoid;
}

View File

@@ -1,6 +1,7 @@
package com.zmzm.finance.common.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Getter;
@@ -78,9 +79,21 @@ public class Payment implements Serializable {
*/
private Date ctime;
/**
* 核对状态 0未核对 1自动核对失败 2已核对
*/
private Integer checkoff;
/**
* 状态0初始1删除
*/
@TableLogic
private Integer state;
@TableField(exist=false)
private Orders orders;
@TableField(exist=false)
private Integer ordersId;
@TableField(exist=false)
private String ordersSn;
}

View File

@@ -0,0 +1,47 @@
package com.zmzm.finance.common.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author baomidou
* @since 2025-12-16
*/
@Getter
@Setter
@ToString
@TableName("payment_to_order")
public class PaymentToOrder implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 支付表外键
*/
private Integer paymentId;
/**
* 订单表外键
*/
private Integer orderId;
/**
* 状态0初始1删除
*/
@TableLogic
private Integer state;
}

View File

@@ -0,0 +1,181 @@
package com.zmzm.finance.common.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* <p>
* 商品表
* </p>
*
* @author baomidou
* @since 2025-12-16
*/
@Getter
@Setter
@ToString
@TableName("shop_product")
public class ShopProduct implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "product_id", type = IdType.AUTO)
private Integer productId;
/**
* 商品名称
*/
private String productName;
/**
* 商品价格
*/
private BigDecimal price;
/**
* 商品重量
*/
private Double weight;
/**
* 上架状态
*/
private Integer publishStatus;
/**
* 商品介绍
*/
private String productDetails;
/**
* 商品分类id
*/
private Integer productPid;
/**
* 商品 类型 0 - 预售 1 - 在售
*/
private String productType;
/**
* 商品库存
*/
private Integer productStock;
/**
* 商品图首页
*/
private String productImages;
/**
* 商品 多图
*/
private String productImageList;
/**
* 商品销量
*/
private String productSalesVolume;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
/**
* 删除标记
*/
@TableLogic
private Integer delFlag;
/**
* 排序
*/
private Integer sort;
/**
* 作者
*/
private String author;
/**
* 出版方
*/
private String publisher;
/**
* 出版时间
*/
private String pubDate;
/**
* 开本
*/
private String format;
/**
* 页数
*/
private Integer pageNum;
/**
* 内文用纸材质
*/
private String quality;
/**
* 总销量
*/
private Integer sumSales;
/**
* 商品类型01挂图02书籍03预售书04仪器05课程06小店商品
*/
private String goodsType;
/**
* 商品类型
*/
private String goodsTypeCode;
/**
* 是否新书上市0否1
*/
private Integer isNew;
/**
* 活动价
*/
private Long activityPrice;
/**
* 是否有vip折扣0无1是
*/
private Integer isVipPrice;
/**
* 是否包邮 0包邮 1不包邮
*/
private Integer isFreeMail;
/**
* 关联book表id
*/
private String bookIds;
private String bookidsimages;
}

View File

@@ -0,0 +1,108 @@
package com.zmzm.finance.common.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author baomidou
* @since 2025-12-19
*/
@Getter
@Setter
@ToString
@TableName("t_commodity")
public class TCommodity implements Serializable {
private static final long serialVersionUID = 1L;
@TableId("oid")
private String oid;
private String description;
private Date invaliddate;
private Boolean valid;
private Integer version;
private Date createdate;
private Double currentprice;
private String explains;
private String namecn;
private Integer orderno;
private Double originalprice;
private String picurl;
private String saleflg;
private String type;
private String units;
private String rollimgs;
private String detailimgs;
private Integer quantity;
private BigDecimal freight;
private String storeoid;
private String images;
private String hotsaleflg;
private String classify;
private String choicenessflg;
private String seckillinfo;
private String groupbuyingflg;
private Double currentpricevip;
private Double originalpricevip;
private Integer backcoupon;
private Integer backcouponvip;
private String paymenttype;
private String auditflg;
private Integer salesnum;
private String curriculumoid;
/**
* 重量 单位kg
*/
private Double weight;
/**
* 预售标记
*/
private String presellflg;
}

View File

@@ -0,0 +1,128 @@
package com.zmzm.finance.common.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author baomidou
* @since 2025-12-19
*/
@Getter
@Setter
@ToString
@TableName("t_curriculum_catalogue")
public class TCurriculumCatalogue implements Serializable {
private static final long serialVersionUID = 1L;
@TableId("oid")
private String oid;
private String description;
private Date invalidDate;
private Boolean valid;
private Integer version;
private Date createDate;
private Date updateDate;
private String title;
private String type;
private String conditions;
private Integer payPointByVIP;
private Integer payPointByCommon;
private String explainsImg;
private String introduceTxt;
private String voices;
private String videos;
private Integer classNo;
private String releaseFlg;
private String curriculumFlg;
private Integer orderNo;
private String poid;
private String examFlg;
/**
* 01必修03选修
*/
private String bxType;
private String freeVoices;
private String freeVideos;
private String hotImg;
private Integer hotLevel;
private String adImg;
private String newFlg;
private String workGradeUser;
private String jcOid;
private String xdOid;
private String gxyType;
private String courseFee;
private String yjsyType;
private String classify;
private String elevatedOid;
private String correlatedOids;
private String bindingOids;
private String tags;
/**
* 0:基础1:提高
*/
private Integer imType;
private String thumbnail;
private String testFlg;
private String coursefeeOld;
/**
* 是否加精
*/
private String choicenessType;
}

View File

@@ -0,0 +1,67 @@
package com.zmzm.finance.common.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author baomidou
* @since 2025-12-19
*/
@Getter
@Setter
@ToString
@TableName("t_customer_taihu_class")
public class TCustomerTaihuClass implements Serializable {
private static final long serialVersionUID = 1L;
@TableId("oid")
private String oid;
private String description;
private Date invaliddate;
private Boolean valid;
private Integer version;
private Date createdate;
private String taihuclassoid;
private String classno;
private String studentno;
private String status;
private String customeroid;
private String useroid;
/**
* 当用户课程学完所有课程都点击看过更新为1
*/
private String finishflg;
/**
* 开始学习日期
*/
private Date startdate;
private Integer relearnnum;
private Integer studydays;
}

View File

@@ -49,7 +49,7 @@ public class User implements Serializable {
/**
* 0管理员1财务
*/
private Byte role;
private Integer role;
/**
* 最后登录时间
@@ -60,5 +60,5 @@ public class User implements Serializable {
* 状态0初始1删除
*/
@TableLogic
private Byte state;
private Integer state;
}

View File

@@ -0,0 +1,16 @@
package com.zmzm.finance.common.service;
import com.zmzm.finance.common.entity.BuyOrder;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 订单表 服务类
* </p>
*
* @author baomidou
* @since 2025-12-16
*/
public interface IBuyOrderService extends IService<BuyOrder> {
}

View File

@@ -0,0 +1,18 @@
package com.zmzm.finance.common.service;
import com.zmzm.finance.common.entity.Orders;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 订单表,从我们各个系统读取的数据 服务类
* </p>
*
* @author baomidou
* @since 2025-12-16
*/
public interface IOrdersService extends IService<Orders> {
void importWumenOrder();
}

View File

@@ -0,0 +1,16 @@
package com.zmzm.finance.common.service;
import com.zmzm.finance.common.entity.PaymentToOrder;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author baomidou
* @since 2025-12-16
*/
public interface IPaymentToOrderService extends IService<PaymentToOrder> {
}

View File

@@ -0,0 +1,16 @@
package com.zmzm.finance.common.service;
import com.zmzm.finance.common.entity.TCommodity;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author baomidou
* @since 2025-12-19
*/
public interface ITCommodityService extends IService<TCommodity> {
}

View File

@@ -0,0 +1,16 @@
package com.zmzm.finance.common.service;
import com.zmzm.finance.common.entity.TCurriculumCatalogue;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author baomidou
* @since 2025-12-19
*/
public interface ITCurriculumCatalogueService extends IService<TCurriculumCatalogue> {
}

View File

@@ -0,0 +1,16 @@
package com.zmzm.finance.common.service;
import com.zmzm.finance.common.entity.TCustomerTaihuClass;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author baomidou
* @since 2025-12-19
*/
public interface ITCustomerTaihuClassService extends IService<TCustomerTaihuClass> {
}

View File

@@ -0,0 +1,20 @@
package com.zmzm.finance.common.service.impl;
import com.zmzm.finance.common.entity.BuyOrder;
import com.zmzm.finance.common.dao.BuyOrderMapper;
import com.zmzm.finance.common.service.IBuyOrderService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 订单表 服务实现类
* </p>
*
* @author baomidou
* @since 2025-12-16
*/
@Service
public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderMapper, BuyOrder> implements IBuyOrderService {
}

View File

@@ -0,0 +1,87 @@
package com.zmzm.finance.common.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.zmzm.finance.common.dao.BuyOrderMapper;
import com.zmzm.finance.common.entity.*;
import com.zmzm.finance.common.dao.OrdersMapper;
import com.zmzm.finance.common.service.IOrdersService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 订单表,从我们各个系统读取的数据 服务实现类
* </p>
*
* @author baomidou
* @since 2025-12-16
*/
@Service
public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, Orders> implements IOrdersService {
@Autowired
private BuyOrderMapper buyOrderMapper;
@Override
public void importWumenOrder() {
String oldBuyOrderId = "0";
Orders orders = this.baseMapper.selectOne(new LambdaQueryWrapper<Orders>()
.eq(Orders::getSource,1)
.orderByDesc(Orders::getId).last("limit 1"));
if(orders!=null){
oldBuyOrderId = orders.getOrderOldId();
}
List<BuyOrder> bos = buyOrderMapper.selectList(new MPJLambdaWrapper<BuyOrder>()
.disableLogicDel()
.leftJoin(WumenUser.class,WumenUser::getId,BuyOrder::getUserId)
.leftJoin(BuyOrderProduct.class,BuyOrderProduct::getOrderId,BuyOrder::getOrderId)
.leftJoin(ShopProduct.class,ShopProduct::getProductId,BuyOrderProduct::getProductId)
//支付宝需要单独查询关联号,老数据有问题
.leftJoin(PayZfbOrder.class,PayZfbOrder::getRelevanceoid,BuyOrder::getOrderSn)
.disableSubLogicDel()
.groupBy(BuyOrder::getOrderId)
.selectAll(BuyOrder.class)
.select("if(t1.tel=''||t1.tel is null,t1.email,t1.tel) as tel")
.select("if(t4.trade_no is null,t.order_sn,t4.out_trade_no) as orderSn")
.selectAs(ShopProduct::getGoodsType,"goodsType")
.notIn(BuyOrder::getOrderStatus,0,5)
.gt(BuyOrder::getOrderId,oldBuyOrderId));
List<Orders> os = new ArrayList<>();
for (BuyOrder bo : bos) {
Orders o = new Orders();
o.setSource(1);
o.setOrderSn(bo.getOrderSn());
o.setOrderOldId(bo.getOrderId()+"");
o.setTel(bo.getTel());
o.setFee(bo.getRealMoney());
if ("point".equals(bo.getOrderType())){
o.setType(0);
}
if ("vip".equals(bo.getOrderType())){
o.setType(1);
}
if ("relearn".equals(bo.getOrderType())){
o.setType(2);
}
if ("order".equals(bo.getOrderType())){
if ("05".equals(bo.getGoodsType())){
o.setType(2);
}else{
o.setType(3);
}
}
if ("trainingClass".equals(bo.getOrderType())){
o.setType(4);
}
o.setOrderTime(bo.getCreateTime());
os.add(o);
}
this.baseMapper.insert(os);
}
}

View File

@@ -0,0 +1,20 @@
package com.zmzm.finance.common.service.impl;
import com.zmzm.finance.common.entity.PaymentToOrder;
import com.zmzm.finance.common.dao.PaymentToOrderMapper;
import com.zmzm.finance.common.service.IPaymentToOrderService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author baomidou
* @since 2025-12-16
*/
@Service
public class PaymentToOrderServiceImpl extends ServiceImpl<PaymentToOrderMapper, PaymentToOrder> implements IPaymentToOrderService {
}

View File

@@ -0,0 +1,20 @@
package com.zmzm.finance.common.service.impl;
import com.zmzm.finance.common.entity.TCommodity;
import com.zmzm.finance.common.dao.TCommodityMapper;
import com.zmzm.finance.common.service.ITCommodityService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author baomidou
* @since 2025-12-19
*/
@Service
public class TCommodityServiceImpl extends ServiceImpl<TCommodityMapper, TCommodity> implements ITCommodityService {
}

View File

@@ -0,0 +1,20 @@
package com.zmzm.finance.common.service.impl;
import com.zmzm.finance.common.entity.TCurriculumCatalogue;
import com.zmzm.finance.common.dao.TCurriculumCatalogueMapper;
import com.zmzm.finance.common.service.ITCurriculumCatalogueService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author baomidou
* @since 2025-12-19
*/
@Service
public class TCurriculumCatalogueServiceImpl extends ServiceImpl<TCurriculumCatalogueMapper, TCurriculumCatalogue> implements ITCurriculumCatalogueService {
}

View File

@@ -0,0 +1,20 @@
package com.zmzm.finance.common.service.impl;
import com.zmzm.finance.common.entity.TCustomerTaihuClass;
import com.zmzm.finance.common.dao.TCustomerTaihuClassMapper;
import com.zmzm.finance.common.service.ITCustomerTaihuClassService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author baomidou
* @since 2025-12-19
*/
@Service
public class TCustomerTaihuClassServiceImpl extends ServiceImpl<TCustomerTaihuClassMapper, TCustomerTaihuClass> implements ITCustomerTaihuClassService {
}

View File

@@ -0,0 +1,168 @@
package com.zmzm.finance.util;
import java.math.BigDecimal;
import java.sql.*;
public class DataUtil {
public static void main(String[] args){
// insertOrder();
// goods();
// course();
// mtRegister();
}
public static void mtRegister(){
try {
Connection yljkConn = DriverManager.getConnection(
"jdbc:mysql://goldorchid.mysql.rds.aliyuncs.com:3309/everhealth?",
"yljkmaster", "Wu751019!@");
Connection financeConn = DriverManager.getConnection(
"jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/finance?rewriteBatchedStatements=true",
"nuttyreading", "Wu751019!");
PreparedStatement transactionDetailStatement = financeConn.prepareStatement(
"INSERT ignore INTO orders (source,order_sn,order_old_id,tel,fee,type,order_time) VALUES (?, ?, ?, ?, ?, ?, ?)");
PreparedStatement statement = yljkConn.prepareStatement("select m.*,IF(m.point>0,m.point,m.money) fee,c.cellPhone " +
"from t_customer_apply_mtregister m " +
"left join t_customer c on c.oid = m.customerOid " +
"where m.valid = 1 and m.status = 50 ");
ResultSet resultSet = statement.executeQuery();
int i=0;
while(resultSet.next()){
i++;
transactionDetailStatement.setInt(1,0);
transactionDetailStatement.setString(2,resultSet.getString("mtRegisterID"));
transactionDetailStatement.setString(3,resultSet.getString("oid"));
transactionDetailStatement.setString(4,resultSet.getString("cellPhone"));
transactionDetailStatement.setBigDecimal(5,resultSet.getBigDecimal("fee"));
transactionDetailStatement.setInt(6,4);
transactionDetailStatement.setTimestamp(7,resultSet.getTimestamp("createDate"));
transactionDetailStatement.addBatch();
if(i%3000==0){
System.out.println("----"+i+"完成");
transactionDetailStatement.executeBatch();
}
}
transactionDetailStatement.executeBatch();
yljkConn.close();
financeConn.close();
} catch (SQLException e) {
System.out.println("Error: " + e.getMessage());
}
}
public static void course(){
try {
Connection yljkConn = DriverManager.getConnection(
"jdbc:mysql://goldorchid.mysql.rds.aliyuncs.com:3309/everhealth?",
"yljkmaster", "Wu751019!@");
Connection financeConn = DriverManager.getConnection(
"jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/finance?rewriteBatchedStatements=true",
"nuttyreading", "Wu751019!");
PreparedStatement transactionDetailStatement = financeConn.prepareStatement(
"INSERT ignore INTO orders (source,order_sn,order_old_id,tel,fee,type,order_time) VALUES (?, ?, ?, ?, ?, ?, ?)");
PreparedStatement statement = yljkConn.prepareStatement("select ac.* ,IF(ac.point>0,ac.point,ac.money) fee,c.cellPhone " +
"from t_customer_apply_curriculum ac " +
"left join t_customer c on c.oid = ac.customerOid " +
"where ac.valid = 1 and ac.status = 50 and payMode != 999999999 ");
ResultSet resultSet = statement.executeQuery();
int i=0;
while(resultSet.next()){
i++;
transactionDetailStatement.setInt(1,0);
transactionDetailStatement.setString(2,resultSet.getString("curriculumID"));
transactionDetailStatement.setString(3,resultSet.getString("oid"));
transactionDetailStatement.setString(4,resultSet.getString("cellPhone"));
transactionDetailStatement.setBigDecimal(5,resultSet.getBigDecimal("fee"));
transactionDetailStatement.setInt(6,2);
transactionDetailStatement.setTimestamp(7,resultSet.getTimestamp("createDate"));
transactionDetailStatement.addBatch();
if(i%3000==0){
System.out.println("----"+i+"完成");
transactionDetailStatement.executeBatch();
}
}
transactionDetailStatement.executeBatch();
yljkConn.close();
financeConn.close();
} catch (SQLException e) {
System.out.println("Error: " + e.getMessage());
}
}
public static void goods(){
try {
Connection yljkConn = DriverManager.getConnection(
"jdbc:mysql://goldorchid.mysql.rds.aliyuncs.com:3309/everhealth?",
"yljkmaster", "Wu751019!@");
Connection financeConn = DriverManager.getConnection(
"jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/finance?rewriteBatchedStatements=true",
"nuttyreading", "Wu751019!");
PreparedStatement transactionDetailStatement = financeConn.prepareStatement(
"INSERT ignore INTO orders (source,order_sn,order_old_id,tel,fee,type,order_time) VALUES (?, ?, ?, ?, ?, ?, ?)");
PreparedStatement statement = yljkConn.prepareStatement("select co.*,IF(co.point>0,co.point,co.money) fee,c.cellPhone " +
"from t_customer_commodity_order co " +
"left join t_customer c on c.oid = co.customerOid " +
"where co.valid = 1 and co.status in (20,50) ");
ResultSet resultSet = statement.executeQuery();
int i=0;
while(resultSet.next()){
i++;
transactionDetailStatement.setInt(1,0);
transactionDetailStatement.setString(2,resultSet.getString("orderID"));
transactionDetailStatement.setString(3,resultSet.getString("oid"));
transactionDetailStatement.setString(4,resultSet.getString("cellPhone"));
transactionDetailStatement.setBigDecimal(5,resultSet.getBigDecimal("fee"));
transactionDetailStatement.setInt(6,3);
transactionDetailStatement.setTimestamp(7,resultSet.getTimestamp("createDate"));
transactionDetailStatement.addBatch();
if(i%3000==0){
System.out.println("----"+i+"完成");
transactionDetailStatement.executeBatch();
}
}
transactionDetailStatement.executeBatch();
yljkConn.close();
financeConn.close();
} catch (SQLException e) {
System.out.println("Error: " + e.getMessage());
}
}
public static void insertOrder(){
try {
Connection yljkConn = DriverManager.getConnection(
"jdbc:mysql://goldorchid.mysql.rds.aliyuncs.com:3309/everhealth?",
"yljkmaster", "Wu751019!@");
Connection financeConn = DriverManager.getConnection(
"jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/finance?rewriteBatchedStatements=true",
"nuttyreading", "Wu751019!");
PreparedStatement transactionDetailStatement = financeConn.prepareStatement(
"INSERT ignore INTO orders (source,order_sn,order_old_id,tel,fee,type,order_time) VALUES (?, ?, ?, ?, ?, ?, ?)");
PreparedStatement statement = yljkConn.prepareStatement("select ab.*,c.cellPhone " +
"from t_customer_apply_buy ab " +
"left join t_customer c on c.oid = ab.customerOid " +
"where ab.valid = 1 and ab.status = 50 and ab.payMode in ('1','5','01','05') and ab.money>0 ");
ResultSet resultSet = statement.executeQuery();
int i=0;
while(resultSet.next()){
i++;
transactionDetailStatement.setInt(1,0);
transactionDetailStatement.setString(2,resultSet.getString("buyID"));
transactionDetailStatement.setString(3,resultSet.getString("oid"));
transactionDetailStatement.setString(4,resultSet.getString("cellPhone"));
transactionDetailStatement.setBigDecimal(5,resultSet.getBigDecimal("money"));
transactionDetailStatement.setInt(6,0);
transactionDetailStatement.setTimestamp(7,resultSet.getTimestamp("createDate"));
transactionDetailStatement.addBatch();
if(i%3000==0){
System.out.println("----"+i+"完成");
transactionDetailStatement.executeBatch();
}
}
transactionDetailStatement.executeBatch();
yljkConn.close();
financeConn.close();
} catch (SQLException e) {
System.out.println("Error: " + e.getMessage());
}
}
}

View File

@@ -44,7 +44,7 @@ spring:
password: Wu751019!
wumen: #吴门医述数据库
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book_test?rewriteBatchedStatements=true
url: jdbc:mysql://rm-2zev4157t67trxuu3yo.mysql.rds.aliyuncs.com:3306/e_book?rewriteBatchedStatements=true
username: nuttyreading
password: Wu751019!
yljk: #一路健康数据库