|
@ -5,10 +5,12 @@ import com.alibaba.excel.EasyExcel; |
|
|
import com.alibaba.excel.ExcelWriter; |
|
|
import com.alibaba.excel.ExcelWriter; |
|
|
import com.alibaba.excel.write.metadata.WriteSheet; |
|
|
import com.alibaba.excel.write.metadata.WriteSheet; |
|
|
import com.example.demo.Util.ExcelUploadUtil; |
|
|
import com.example.demo.Util.ExcelUploadUtil; |
|
|
|
|
|
import com.example.demo.Util.JWTUtil; |
|
|
import com.example.demo.controller.ConsumeController; |
|
|
import com.example.demo.controller.ConsumeController; |
|
|
import com.example.demo.controller.GoldDetailController; |
|
|
import com.example.demo.controller.GoldDetailController; |
|
|
import com.example.demo.controller.RechargeController; |
|
|
import com.example.demo.controller.RechargeController; |
|
|
import com.example.demo.controller.RefundController; |
|
|
import com.example.demo.controller.RefundController; |
|
|
|
|
|
import com.example.demo.domain.entity.Admin; |
|
|
import com.example.demo.domain.entity.Export; |
|
|
import com.example.demo.domain.entity.Export; |
|
|
import com.example.demo.domain.entity.User; |
|
|
import com.example.demo.domain.entity.User; |
|
|
import com.example.demo.domain.export.Goldmingxi; |
|
|
import com.example.demo.domain.export.Goldmingxi; |
|
@ -28,6 +30,11 @@ import lombok.extern.slf4j.Slf4j; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
|
|
import org.springframework.security.authentication.AuthenticationManager; |
|
|
|
|
|
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
|
|
|
|
|
import org.springframework.security.core.Authentication; |
|
|
|
|
|
import org.springframework.security.core.context.SecurityContextHolder; |
|
|
|
|
|
import org.springframework.security.core.userdetails.UserDetails; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
@ -58,7 +65,8 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
private RefundController refundController; |
|
|
private RefundController refundController; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private ConsumeController consumeController; |
|
|
private ConsumeController consumeController; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private AuthenticationManager authenticationManager; |
|
|
// 每页查询的数据量 |
|
|
// 每页查询的数据量 |
|
|
private static final int PAGE_SIZE = 1000; |
|
|
private static final int PAGE_SIZE = 1000; |
|
|
@Autowired |
|
|
@Autowired |
|
@ -507,6 +515,7 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
long startTime = System.currentTimeMillis(); |
|
|
long startTime = System.currentTimeMillis(); |
|
|
Long recordId = null; |
|
|
Long recordId = null; |
|
|
String fileName = null; |
|
|
String fileName = null; |
|
|
|
|
|
String token = null; |
|
|
File tempFile = null; |
|
|
File tempFile = null; |
|
|
OutputStream outputStream = null; |
|
|
OutputStream outputStream = null; |
|
|
ExcelWriter excelWriter = null; |
|
|
ExcelWriter excelWriter = null; |
|
@ -516,6 +525,7 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
JsonNode rootNode = objectMapper.readTree(message); |
|
|
JsonNode rootNode = objectMapper.readTree(message); |
|
|
// 2. 获取基本参数 |
|
|
// 2. 获取基本参数 |
|
|
recordId = rootNode.path("recordId").asLong(); |
|
|
recordId = rootNode.path("recordId").asLong(); |
|
|
|
|
|
token = rootNode.path("token").asText(); |
|
|
JsonNode requestDataNode = rootNode.path("requestData"); |
|
|
JsonNode requestDataNode = rootNode.path("requestData"); |
|
|
JsonNode rechargeNode = requestDataNode.path("rechargeUser"); |
|
|
JsonNode rechargeNode = requestDataNode.path("rechargeUser"); |
|
|
RechargeUser rechargeUser = objectMapper.treeToValue(rechargeNode, RechargeUser.class); |
|
|
RechargeUser rechargeUser = objectMapper.treeToValue(rechargeNode, RechargeUser.class); |
|
@ -552,7 +562,16 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
page.setRechargeUser(rechargeUser); |
|
|
page.setRechargeUser(rechargeUser); |
|
|
boolean hasMore = true; |
|
|
boolean hasMore = true; |
|
|
while (hasMore) { |
|
|
while (hasMore) { |
|
|
Result pageResult = rechargeController.selcetBy( page); |
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
Authentication authentication = JWTUtil.getAuthenticationFromToken(token, Admin.class); |
|
|
|
|
|
if (authentication != null) { |
|
|
|
|
|
System.out.println("Authentication: " + authentication); |
|
|
|
|
|
SecurityContextHolder.getContext().setAuthentication(authentication); // 存储认证信息 |
|
|
|
|
|
} |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
} |
|
|
|
|
|
Result pageResult = rechargeController.selcetBy(page); |
|
|
Integer code = pageResult.getCode(); |
|
|
Integer code = pageResult.getCode(); |
|
|
Object data = pageResult.getData(); |
|
|
Object data = pageResult.getData(); |
|
|
|
|
|
|
|
@ -715,6 +734,7 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
Long recordId = null; |
|
|
Long recordId = null; |
|
|
String fileName = null; |
|
|
String fileName = null; |
|
|
File tempFile = null; |
|
|
File tempFile = null; |
|
|
|
|
|
String token = null; |
|
|
OutputStream outputStream = null; |
|
|
OutputStream outputStream = null; |
|
|
ExcelWriter excelWriter = null; |
|
|
ExcelWriter excelWriter = null; |
|
|
|
|
|
|
|
@ -724,6 +744,7 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
// 2. 获取基本参数 |
|
|
// 2. 获取基本参数 |
|
|
recordId = rootNode.path("recordId").asLong(); |
|
|
recordId = rootNode.path("recordId").asLong(); |
|
|
JsonNode requestDataNode = rootNode.path("requestData"); |
|
|
JsonNode requestDataNode = rootNode.path("requestData"); |
|
|
|
|
|
token = rootNode.path("token").asText(); |
|
|
JsonNode consumeUserNode = requestDataNode.path("consumeUser"); |
|
|
JsonNode consumeUserNode = requestDataNode.path("consumeUser"); |
|
|
ConsumeUser consumeUser = objectMapper.treeToValue(consumeUserNode, ConsumeUser.class); |
|
|
ConsumeUser consumeUser = objectMapper.treeToValue(consumeUserNode, ConsumeUser.class); |
|
|
// 3. 验证导出记录 |
|
|
// 3. 验证导出记录 |
|
@ -752,6 +773,15 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
Integer totalCount = 0; |
|
|
Integer totalCount = 0; |
|
|
boolean hasMore = true; |
|
|
boolean hasMore = true; |
|
|
while (hasMore) { |
|
|
while (hasMore) { |
|
|
|
|
|
try { |
|
|
|
|
|
Authentication authentication = JWTUtil.getAuthenticationFromToken(token, Admin.class); |
|
|
|
|
|
if (authentication != null) { |
|
|
|
|
|
System.out.println("Authentication: " + authentication); |
|
|
|
|
|
SecurityContextHolder.getContext().setAuthentication(authentication); // 存储认证信息 |
|
|
|
|
|
} |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
} |
|
|
Result pageResult = consumeController.selcetBy(page); |
|
|
Result pageResult = consumeController.selcetBy(page); |
|
|
Integer code = pageResult.getCode(); |
|
|
Integer code = pageResult.getCode(); |
|
|
Object data = pageResult.getData(); |
|
|
Object data = pageResult.getData(); |
|
@ -914,6 +944,7 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
long startTime = System.currentTimeMillis(); |
|
|
long startTime = System.currentTimeMillis(); |
|
|
Long recordId = null; |
|
|
Long recordId = null; |
|
|
String fileName = null; |
|
|
String fileName = null; |
|
|
|
|
|
String token = null; |
|
|
File tempFile = null; |
|
|
File tempFile = null; |
|
|
OutputStream outputStream = null; |
|
|
OutputStream outputStream = null; |
|
|
ExcelWriter excelWriter = null; |
|
|
ExcelWriter excelWriter = null; |
|
@ -923,6 +954,7 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
JsonNode rootNode = objectMapper.readTree(message); |
|
|
JsonNode rootNode = objectMapper.readTree(message); |
|
|
// 2. 获取基本参数 |
|
|
// 2. 获取基本参数 |
|
|
recordId = rootNode.path("recordId").asLong(); |
|
|
recordId = rootNode.path("recordId").asLong(); |
|
|
|
|
|
token = rootNode.path("token").asText(); |
|
|
JsonNode requestDataNode = rootNode.path("requestData"); |
|
|
JsonNode requestDataNode = rootNode.path("requestData"); |
|
|
JsonNode refundUserNode = requestDataNode.path("refundUser"); |
|
|
JsonNode refundUserNode = requestDataNode.path("refundUser"); |
|
|
RefundUser refundUser = objectMapper.treeToValue(refundUserNode, RefundUser.class); |
|
|
RefundUser refundUser = objectMapper.treeToValue(refundUserNode, RefundUser.class); |
|
@ -954,6 +986,15 @@ public class ExportExcelServiceImpl implements ExportExcelService { |
|
|
Integer totalCount = 0; |
|
|
Integer totalCount = 0; |
|
|
boolean hasMore = true; |
|
|
boolean hasMore = true; |
|
|
while (hasMore) { |
|
|
while (hasMore) { |
|
|
|
|
|
try { |
|
|
|
|
|
Authentication authentication = JWTUtil.getAuthenticationFromToken(token, Admin.class); |
|
|
|
|
|
if (authentication != null) { |
|
|
|
|
|
System.out.println("Authentication: " + authentication); |
|
|
|
|
|
SecurityContextHolder.getContext().setAuthentication(authentication); // 存储认证信息 |
|
|
|
|
|
} |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
} |
|
|
Result pageResult = refundController.selcetBy(page); |
|
|
Result pageResult = refundController.selcetBy(page); |
|
|
Integer code = pageResult.getCode(); |
|
|
Integer code = pageResult.getCode(); |
|
|
Object data = pageResult.getData(); |
|
|
Object data = pageResult.getData(); |
|
|