|
|
@@ -1,5 +1,6 @@
|
|
|
package com.izouma.nineth.web;
|
|
|
|
|
|
+import cn.hutool.core.math.Money;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.github.kevinsawicki.http.HttpRequest;
|
|
|
@@ -14,21 +15,29 @@ import com.izouma.nineth.enums.PayMethod;
|
|
|
import com.izouma.nineth.exception.BusinessException;
|
|
|
import com.izouma.nineth.repo.*;
|
|
|
import com.izouma.nineth.service.UserBalanceService;
|
|
|
+import com.izouma.nineth.utils.DateTimeUtils;
|
|
|
import com.izouma.nineth.utils.JpaUtils;
|
|
|
import com.izouma.nineth.utils.SecurityUtils;
|
|
|
import com.izouma.nineth.utils.SnowflakeIdWorker;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.io.IOUtils;
|
|
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
|
+import org.springframework.core.io.InputStreamResource;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
+import org.springframework.http.MediaType;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import java.io.File;
|
|
|
+import java.io.FileInputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.time.Duration;
|
|
|
import java.time.LocalDate;
|
|
|
import java.util.concurrent.ExecutionException;
|
|
|
|
|
|
@@ -62,32 +71,32 @@ public class UserBalanceController extends BaseController {
|
|
|
}
|
|
|
|
|
|
@PostMapping("/settle")
|
|
|
- @PreAuthorize("hasAnyRole('ADMIN','ORDERINFO')")
|
|
|
+ @PreAuthorize("hasRole('ADMIN')")
|
|
|
public void settle(@RequestParam LocalDate start, @RequestParam LocalDate end) {
|
|
|
userBalanceService.settle(start, end);
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = "/exportWithdraw")
|
|
|
- @PreAuthorize("hasAnyRole('ADMIN','ORDERINFO')")
|
|
|
+ @PreAuthorize("hasRole('ADMIN')")
|
|
|
public void exportWithdraw(String remark) throws IOException, InvalidFormatException {
|
|
|
userBalanceService.exportWithdrawAsync(remark);
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = "/exportHistory")
|
|
|
- @PreAuthorize("hasAnyRole('ADMIN','ORDERINFO')")
|
|
|
+ @PreAuthorize("hasRole('ADMIN')")
|
|
|
public Page<ExportWithdraw> exportHistory(Pageable pageable) {
|
|
|
return exportWithdrawRepo.findAll(pageable);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/importFail")
|
|
|
- @PreAuthorize("hasAnyRole('ADMIN','ORDERINFO')")
|
|
|
+ @PreAuthorize("hasRole('ADMIN')")
|
|
|
public void importFail(@RequestPart("withdrawList") MultipartFile withdrawFile,
|
|
|
@RequestPart("failList") MultipartFile failFile) throws IOException {
|
|
|
userBalanceService.importFail(withdrawFile, failFile);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/autoWithdraw")
|
|
|
- @PreAuthorize("hasAnyRole('ADMIN','ORDERINFO')")
|
|
|
+ @PreAuthorize("hasRole('ADMIN')")
|
|
|
public void autoWithdraw() throws ExecutionException, InterruptedException {
|
|
|
|
|
|
LocalDate date = LocalDate.now();
|
|
|
@@ -141,7 +150,7 @@ public class UserBalanceController extends BaseController {
|
|
|
}
|
|
|
|
|
|
@PostMapping("/testRecharge")
|
|
|
- @PreAuthorize("hasAnyRole('ADMIN','ORDERINFO')")
|
|
|
+ @PreAuthorize("hasRole('ADMIN')")
|
|
|
public void testRecharge(Long userId, BigDecimal money) {
|
|
|
RechargeOrder rechargeOrder = RechargeOrder.builder()
|
|
|
.id(snowflakeIdWorker.nextId())
|