交班 api/tbHandover/handoverData
This commit is contained in:
parent
05e1d5390c
commit
7d5ebbfb65
|
|
@ -1,9 +1,15 @@
|
||||||
package cn.ysk.cashier.cons.rest;
|
package cn.ysk.cashier.cons.rest;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.http.HttpResponse;
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
import cn.ysk.cashier.annotation.Log;
|
import cn.ysk.cashier.annotation.Log;
|
||||||
import cn.ysk.cashier.cons.domain.ViewHandover;
|
import cn.ysk.cashier.cons.domain.ViewHandover;
|
||||||
import cn.ysk.cashier.cons.service.ViewHandoverService;
|
import cn.ysk.cashier.cons.service.ViewHandoverService;
|
||||||
import cn.ysk.cashier.cons.service.dto.ViewHandoverQueryCriteria;
|
import cn.ysk.cashier.cons.service.dto.ViewHandoverQueryCriteria;
|
||||||
|
import cn.ysk.cashier.exception.BadRequestException;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
|
@ -12,20 +18,43 @@ import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Objects;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author admin
|
* @author admin
|
||||||
* @date 2024-08-05
|
* @date 2024-08-05
|
||||||
**/
|
**/
|
||||||
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Api(tags = "交班查询管理")
|
@Api(tags = "交班管理")
|
||||||
@RequestMapping("/api/tbHandover")
|
@RequestMapping("/api/tbHandover")
|
||||||
public class ViewHandoverController {
|
public class ViewHandoverController {
|
||||||
|
|
||||||
private final ViewHandoverService viewHandoverService;
|
private final ViewHandoverService viewHandoverService;
|
||||||
|
|
||||||
|
@Value("${cashier.server.wx}")
|
||||||
|
private String wxServiceHostname;
|
||||||
|
|
||||||
|
@PostMapping("handoverData")
|
||||||
|
@Log("提交交班")
|
||||||
|
@ApiOperation("提交交班")
|
||||||
|
public ResponseEntity<Object> handoverData(@RequestBody ViewHandover resources){
|
||||||
|
if(Objects.isNull(resources.getShopId())) throw new BadRequestException("店铺信息不可为空");
|
||||||
|
HttpResponse response = HttpUtil.createGet(StrUtil.format(wxServiceHostname,"/cashierService/common/handoverData?shopId={}", resources.getShopId())).execute();
|
||||||
|
if (response.getStatus() >= 200 && response.getStatus() < 300) {
|
||||||
|
String body = response.body();
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
} else {
|
||||||
|
// 请求失败,获取状态码和错误信息
|
||||||
|
int statusCode = response.getStatus();
|
||||||
|
String errorMessage = response.body(); // 可以获取错误信息
|
||||||
|
log.error("交班提交失败:{}",errorMessage);
|
||||||
|
throw new BadRequestException("请求失败,状态码:"+statusCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Log("导出数据")
|
@Log("导出数据")
|
||||||
@ApiOperation("导出数据")
|
@ApiOperation("导出数据")
|
||||||
@GetMapping(value = "/download")
|
@GetMapping(value = "/download")
|
||||||
|
|
|
||||||
|
|
@ -143,4 +143,7 @@ decorator:
|
||||||
logging: file
|
logging: file
|
||||||
log-file: spy.log
|
log-file: spy.log
|
||||||
log-format: executeTime:%(executionTime) ms | sql:%(sqlSingleLine)
|
log-format: executeTime:%(executionTime) ms | sql:%(sqlSingleLine)
|
||||||
multiline: false
|
multiline: false
|
||||||
|
cashier:
|
||||||
|
server:
|
||||||
|
wx: https://wxcashiertest.sxczgkj.cn/
|
||||||
|
|
@ -135,3 +135,6 @@ file:
|
||||||
# 文件大小 /M
|
# 文件大小 /M
|
||||||
maxSize: 100
|
maxSize: 100
|
||||||
avatarMaxSize: 5
|
avatarMaxSize: 5
|
||||||
|
cashier:
|
||||||
|
server:
|
||||||
|
wx: https://pre-cashier.sxczgkj.cn/
|
||||||
|
|
|
||||||
|
|
@ -140,3 +140,6 @@ file:
|
||||||
# 文件大小 /M
|
# 文件大小 /M
|
||||||
maxSize: 100
|
maxSize: 100
|
||||||
avatarMaxSize: 5
|
avatarMaxSize: 5
|
||||||
|
cashier:
|
||||||
|
server:
|
||||||
|
wx: https://cashier.sxczgkj.cn/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue