|
|
|
@ -29,7 +29,9 @@ import com.example.demo.domain.vo.cash.PerformanceVO; |
|
|
|
import com.example.demo.domain.vo.coin.*; |
|
|
|
|
|
|
|
import com.example.demo.mapper.coin.ExportMapper; |
|
|
|
import com.example.demo.mapper.coin.MarketMapper; |
|
|
|
import com.example.demo.service.coin.ExportExcelService; |
|
|
|
import com.example.demo.service.coin.MarketService; |
|
|
|
import com.fasterxml.jackson.databind.JsonNode; |
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
|
|
|
|
@ -43,6 +45,7 @@ import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.security.authentication.AuthenticationManager; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.ObjectUtils; |
|
|
|
|
|
|
|
import java.io.*; |
|
|
|
import java.util.*; |
|
|
|
@ -88,6 +91,8 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
private static final int PAGE_SIZE = 5000; |
|
|
|
@Autowired |
|
|
|
private ExportMapper exportMapper; |
|
|
|
@Autowired |
|
|
|
private MarketService marketService; |
|
|
|
|
|
|
|
@Transactional |
|
|
|
@Override |
|
|
|
@ -352,8 +357,36 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
JsonNode rootNode = objectMapper.readTree(message); |
|
|
|
JsonNode requestDataNode = rootNode.path("requestData"); |
|
|
|
JsonNode beanRechargeNode = requestDataNode.path("cashRecordDTO"); |
|
|
|
String token = rootNode.path("token").asText(); |
|
|
|
CashRecordDTO cashRecordDTO = objectMapper.treeToValue(beanRechargeNode, CashRecordDTO.class); |
|
|
|
page.setCashRecordDTO(cashRecordDTO); |
|
|
|
Admin admin = (Admin) JWTUtil.getUserDetailsList(String.valueOf(token), Admin.class); |
|
|
|
List<String> userMarkets = Arrays.asList(StringUtils.split(admin.getMarkets(), ",")); |
|
|
|
List<String> markets = marketService.getMarketIds(userMarkets); |
|
|
|
|
|
|
|
|
|
|
|
// 获取传入的市场列表 |
|
|
|
List<String> requestedMarkets = page.getCashRecordDTO() != null ? page.getCashRecordDTO().getMarkets() : null; |
|
|
|
|
|
|
|
// 权限校验逻辑 |
|
|
|
if (markets.contains("9") || markets.contains("9999")) { |
|
|
|
// 特权市场:9 或 9999,跳过权限校验,直接放行传入的 markets |
|
|
|
// 如果业务需要,也可以在这里做空值处理 |
|
|
|
if (page.getCashRecordDTO() != null) { |
|
|
|
// 保持 requestedMarkets 不变,原样接受 |
|
|
|
// 可选:如果 requestedMarkets 为 null,可设为默认值或保持 null |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 普通用户:必须校验权限 |
|
|
|
if (requestedMarkets == null || requestedMarkets.isEmpty()) { |
|
|
|
page.getCashRecordDTO().setMarkets(markets); |
|
|
|
} |
|
|
|
if (!markets.containsAll(requestedMarkets)) { |
|
|
|
String errorMsg = "无权限!请求的市场不在授权范围内。"; |
|
|
|
return Result.error(errorMsg); |
|
|
|
} |
|
|
|
// 校验通过,保持 requestedMarkets 不变 |
|
|
|
} |
|
|
|
// 从请求数据中获取语言设置,如果没有则使用默认值 |
|
|
|
String lang = "zh_CN"; |
|
|
|
JsonNode langNode = requestDataNode.path("lang"); |
|
|
|
@ -895,7 +928,7 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
} |
|
|
|
|
|
|
|
// 添加资金流水翻译支持 |
|
|
|
if ("fundsUser".equals(exportType) && list.get(0) instanceof FundsDTO) { |
|
|
|
if ("fundUser".equals(exportType) && list.get(0) instanceof FundsDTO) { |
|
|
|
fillUserStatusDescriptions((List<FundsDTO>) list); |
|
|
|
translateFundsList((List<FundsDTO>) list, lang); |
|
|
|
} |
|
|
|
@ -1304,6 +1337,34 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
default: return "其他"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据状态值获取状态描述 |
|
|
|
*/ |
|
|
|
private String getStatusDescription(Integer status) { |
|
|
|
if (status == null) return ""; |
|
|
|
|
|
|
|
switch (status) { |
|
|
|
case 0: return "线下财务待审核"; |
|
|
|
case 1: return "线下财务审核通过待填手续费"; |
|
|
|
case 2: return "线下财务审核驳回"; |
|
|
|
case 3: return "link线上财务复核待填手续费"; |
|
|
|
case 4: return "收款流程全部结束"; |
|
|
|
case 5: return "手动撤回待编辑提交"; |
|
|
|
case 6: return "退款"; |
|
|
|
case 10: return "地区财务待审核"; |
|
|
|
case 11: return "地区财务手动撤回待编辑提交"; |
|
|
|
case 12: return "地区财务驳回"; |
|
|
|
case 20: return "地区负责人待审核"; |
|
|
|
case 22: return "地区负责人驳回"; |
|
|
|
case 30: return "总部财务待审核"; |
|
|
|
case 32: return "总部财务驳回"; |
|
|
|
case 40: return "执行人待处理"; |
|
|
|
case 41: return "执行人已处理,退款结束"; |
|
|
|
default: return "未知状态(" + status + ")"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 各种实体类的翻译方法 |
|
|
|
|
|
|
|
/** |
|
|
|
@ -1603,6 +1664,18 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
|
if (item.getRefundModelDesc() != null && !item.getRefundModelDesc().isEmpty()) { |
|
|
|
item.setRefundModelDesc(languageTranslationUtil.translate(item.getRefundModelDesc(), lang)); |
|
|
|
} |
|
|
|
|
|
|
|
// 翻译所属地区名称 |
|
|
|
if (item.getMarketName() != null && !item.getMarketName().isEmpty()) { |
|
|
|
item.setMarketName(languageTranslationUtil.translate(item.getMarketName(), lang)); |
|
|
|
} |
|
|
|
|
|
|
|
// 翻译订单状态(首先获取状态的中文描述,然后进行多语言翻译) |
|
|
|
if (item.getStatus() != null) { |
|
|
|
String statusDesc = getStatusDescription(item.getStatus()); |
|
|
|
String translatedStatus = languageTranslationUtil.translate(statusDesc, lang); |
|
|
|
item.setStatusDesc(translatedStatus); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|