package com.nuvole.util;
|
|
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.io.file.FileWriter;
|
|
import java.io.File;
|
import java.io.IOException;
|
import java.text.SimpleDateFormat;
|
import java.util.Date;
|
|
public class WriterUtil {
|
|
private static String path = "F:\\data\\";
|
|
|
/* @Test
|
public void test() {
|
login("nodata", 1122L, "男", "172.16.60.222", "https://www.baidu.com");
|
member(11222L, "nodata", Convert.toShort(1), "12121");
|
}*/
|
|
/**
|
* 写入商城登录数据
|
*
|
* @param code 机器码
|
* @param memberId 会员id
|
* @param sex 性别
|
* @param ip ip地址
|
* @param address 登录地址
|
* @Author: lc
|
* @Date: 2019/10/23 15:13
|
*/
|
public static void login(String code, Long memberId, String sex, String ip, String address) {
|
// String day = DateUtil.today();
|
// FileWriter writer = new FileWriter(path + "login\\" + day + ".txt");
|
// String time = CodeUtil.getTimeCode();
|
// writer.append(time + " " + code + " " + memberId + " " + sex + " " + ip + " " + address + "\n");
|
}
|
|
|
/**
|
* 写入会员注册/修改数据
|
*
|
* @param memberId 会员id
|
* @param area 地区
|
* @param type 操作类型【1.新增 2.完善】
|
* @param birthday 生日
|
* @Author: lc
|
* @Date: 2019/10/23 15:13
|
*/
|
public static void member(Long memberId, String area, Short type, String birthday) {
|
// String day = DateUtil.today();
|
// FileWriter writer = new FileWriter(path + "member\\" + day + ".txt");
|
// String time = CodeUtil.getTimeCode();
|
// writer.append(time + " " + memberId + " " + area + " " + type + " " + birthday + "\n");
|
}
|
|
|
/**
|
* 写入订单数据
|
*
|
* @param orderId 订单id
|
* @param orderType 订单类型【1.商城 2.商户】
|
* @param payMoney 支付金额
|
* @param memberId 会员id
|
* @param orderState 订单状态【1.待支付 2.已完成 3.已退款 4.支付失败】
|
* @param payType 支付渠道【1.支付宝 2.微信 3.云闪付】
|
* @param payWay 支付方式【1.扫码 2.线上 】
|
* @param useScore 使用积分
|
* @param couponId 使用优惠券id
|
* @param couponMoney 优惠券金额
|
* @param areaId 商户所属区域id
|
* @Author: lc
|
* @Date: 2019/10/23 15:13
|
*/
|
public static void order(Long orderId, String orderType, Long payMoney, Long memberId, Short orderState, Short payType, Short payWay, Long useScore, Long couponId, Long couponMoney, String areaId) {
|
// String day = DateUtil.today();
|
// FileWriter writer = new FileWriter(path + "order\\" + day + ".txt");
|
// String time = CodeUtil.getTimeCode();
|
// writer.append(time + " " + orderId + " " + orderType + " " + payMoney + " " + memberId + " " + orderState + " " +
|
// payType + " " + payWay + " " + useScore + " " + couponId + " " + couponMoney + " " + areaId + "\n");
|
}
|
|
|
/**
|
* 写入商品数据
|
*
|
* @param goodsSpuId 商品SpuId
|
* @param goodsSkuId 商品SkuId
|
* @param money 金额
|
* @param state 状态【1.新增 2.上架 3.下架 4.出售】
|
* @Author: lc
|
* @Date: 2019/10/23 15:13
|
*/
|
public static void goods(Long goodsSpuId, Long goodsSkuId, Long money, Short state) {
|
// String day = DateUtil.today();
|
// FileWriter writer = new FileWriter(path + "goods\\" + day + ".txt");
|
// String time = CodeUtil.getTimeCode();
|
// writer.append(time + " " + goodsSpuId + " " + goodsSkuId + " " + money + " " + state + "\n");
|
}
|
|
|
/**
|
* 写入商品销售
|
*
|
* @param goodsSpuId 商品SpuId(规格)
|
* @param goodsSkuId 商品SkuId(属性)
|
* @Author: lc
|
* @Date: 2019/10/23 15:13
|
*/
|
public static void goodsSell(Long goodsSpuId, Long goodsSkuId) {
|
// String day = DateUtil.today();
|
// FileWriter writer = new FileWriter(path + "goodsSell\\" + day + ".txt");
|
// String time = CodeUtil.getTimeCode();
|
// writer.append(time + " " + goodsSpuId + " " + goodsSkuId + "\n");
|
}
|
|
/**
|
* 执行手动回调的订单id
|
* @param builder
|
* @throws IOException
|
*/
|
public static void callBackGoodsInfo(StringBuilder builder) throws IOException {
|
String fileName = new SimpleDateFormat("yyyyMMdd").format(new Date()) + ".csv";
|
String day = DateUtil.today();
|
FileWriter writer = new FileWriter(path + "回调订单" +fileName );
|
writer.append(String.valueOf(builder));
|
}
|
|
}
|