|
|
|
@ -32,8 +32,6 @@ import com.example.demo.serviceImpl.cash.CashRefundServiceImpl; |
|
|
|
import com.fasterxml.jackson.databind.JsonNode; |
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.example.demo.service.coin.AiEmotionService; |
|
|
|
|
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
@ -57,7 +55,6 @@ import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
import java.util.function.Function; |
|
|
|
|
|
|
|
|
|
|
|
@Service |
|
|
|
@Slf4j |
|
|
|
public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
@ -93,8 +90,6 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
@Autowired |
|
|
|
private ExportMapper exportMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional |
|
|
|
@Override |
|
|
|
public Exception handleExcelExportData(String message) throws Exception { |
|
|
|
@ -150,6 +145,7 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional |
|
|
|
@Override |
|
|
|
public Exception consumeExcel(String message) throws Exception { |
|
|
|
@ -241,6 +237,7 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Exception BeanExcel(String message) throws Exception { |
|
|
|
return exportExcelGeneric(message, "beanUser", page -> { |
|
|
|
@ -256,6 +253,7 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Exception OnlineExcel(String message) throws Exception { |
|
|
|
return exportExcelGeneric(message, "onlineUser", page -> { |
|
|
|
@ -306,13 +304,11 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<Export> getExcel(Export export) { |
|
|
|
List<Export> list = exportMapper.getExportRecord(export.getAccount(),export.getType()); |
|
|
|
List<Export> list = exportMapper.getExportRecord(export.getAccount(),export.getType()); |
|
|
|
System.out.println(list+"-------------------------------"); |
|
|
|
return list; |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 验证导出记录 |
|
|
|
*/ |
|
|
|
@ -400,6 +396,11 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
fillGoldDetailTypeDescriptions((List<GoldDetail>) list); |
|
|
|
} |
|
|
|
|
|
|
|
// 添加退款方式转换逻辑 |
|
|
|
if ("refundUser".equals(exportType) && list.get(0) instanceof RefundUser) { |
|
|
|
fillRefundUserModelDescriptions((List<RefundUser>) list); |
|
|
|
} |
|
|
|
|
|
|
|
excelWriter.write(list, writeSheet); |
|
|
|
page.setPageNum(page.getPageNum() + 1); |
|
|
|
totalCount += list.size(); |
|
|
|
@ -412,7 +413,6 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 7. 完成Excel写入 |
|
|
|
if (excelWriter != null) { |
|
|
|
excelWriter.finish(); |
|
|
|
@ -523,9 +523,6 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Class<?> getExportClass(String exportType) { |
|
|
|
switch (exportType) { |
|
|
|
case "goldDetail": |
|
|
|
@ -556,6 +553,7 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
throw new IllegalArgumentException("不支持的导出类型: " + exportType); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 填充金币明细数据的类型描述 |
|
|
|
*/ |
|
|
|
@ -582,4 +580,29 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
/** |
|
|
|
* 填充退款用户数据的退款方式描述 |
|
|
|
*/ |
|
|
|
private void fillRefundUserModelDescriptions(List<RefundUser> refundUsers) { |
|
|
|
if (refundUsers != null && !refundUsers.isEmpty()) { |
|
|
|
for (RefundUser user : refundUsers) { |
|
|
|
if (user.getRefundModel() != null) { |
|
|
|
String modelDesc = convertRefundModelToString(user.getRefundModel()); |
|
|
|
user.setRefundModelDesc(modelDesc); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 将退款模型数字转换为中文描述 |
|
|
|
*/ |
|
|
|
private String convertRefundModelToString(Byte refundModel) { |
|
|
|
if (refundModel == null) return ""; |
|
|
|
switch (refundModel) { |
|
|
|
case 0: return "全部退款"; |
|
|
|
case 1: return "部分退款"; |
|
|
|
default: return "未知退款方式"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |