|
|
|
@ -13,20 +13,21 @@ import com.zhehekeji.web.pojo.stock.StockExportExcel;
|
|
|
|
import com.zhehekeji.web.service.StockService;
|
|
|
|
import com.zhehekeji.web.service.StockService;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
|
|
import org.springframework.core.io.ClassPathResource;
|
|
|
|
|
|
|
|
import org.springframework.util.ResourceUtils;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.*;
|
|
|
|
import java.io.OutputStream;
|
|
|
|
|
|
|
|
import java.net.URLEncoder;
|
|
|
|
import java.net.URLEncoder;
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
@Api(value = "Stock",tags = "库存管理")
|
|
|
|
@Api(value = "Stock", tags = "库存管理")
|
|
|
|
@RestController
|
|
|
|
@RestController
|
|
|
|
@RequestMapping("/stock")
|
|
|
|
@RequestMapping("/stock")
|
|
|
|
public class StockController {
|
|
|
|
public class StockController {
|
|
|
|
@ -38,20 +39,42 @@ public class StockController {
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/import")
|
|
|
|
@PostMapping("/import")
|
|
|
|
@ApiOperation(value = "库存导入")
|
|
|
|
@ApiOperation(value = "库存导入")
|
|
|
|
public Result upload(MultipartFile file){
|
|
|
|
public Result upload(MultipartFile file) {
|
|
|
|
stockService.importExcel(file);
|
|
|
|
stockService.importExcel(file);
|
|
|
|
return Result.success();
|
|
|
|
return Result.success();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/export/model")
|
|
|
|
|
|
|
|
@ApiOperation(value = "库存模板下载")
|
|
|
|
|
|
|
|
public void download(HttpServletResponse response) throws IOException {
|
|
|
|
|
|
|
|
OutputStream os = response.getOutputStream();
|
|
|
|
|
|
|
|
byte[] buffer = new byte[4096];
|
|
|
|
|
|
|
|
int n;
|
|
|
|
|
|
|
|
response.setContentType("application/vnd.ms-excel");
|
|
|
|
|
|
|
|
response.setCharacterEncoding("utf-8");
|
|
|
|
|
|
|
|
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
|
|
|
|
|
|
|
|
String fileName = URLEncoder.encode("库存模板", "UTF-8");
|
|
|
|
|
|
|
|
response.setHeader("Content-disposition", "attachment;filename="+fileName+".xlsx");
|
|
|
|
|
|
|
|
ClassPathResource classPathResource = new ClassPathResource("库存模板.xlsx");
|
|
|
|
|
|
|
|
InputStream in = classPathResource.getInputStream();
|
|
|
|
|
|
|
|
while ((n = in.read(buffer)) > 0) {
|
|
|
|
|
|
|
|
os.write(buffer, 0, n);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
os.flush();
|
|
|
|
|
|
|
|
os.close();
|
|
|
|
|
|
|
|
response.flushBuffer();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/list")
|
|
|
|
@GetMapping("/list")
|
|
|
|
@ApiOperation(value = "盘点页面 返回map key:货架号 value:库存信息")
|
|
|
|
@ApiOperation(value = "盘点页面 返回map key:货架号 value:库存信息")
|
|
|
|
public Result<Map<String,List<Stock>>> stockByStreet(@RequestParam(required = true) Integer streetId){
|
|
|
|
public Result<Map<String, List<Stock>>> stockByStreet(@RequestParam(required = true) Integer streetId) {
|
|
|
|
return Result.success(stockService.stocksByStreetId(streetId));
|
|
|
|
return Result.success(stockService.stocksByStreetId(streetId));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/page")
|
|
|
|
@PostMapping("/page")
|
|
|
|
@ApiOperation(value = "库存列表")
|
|
|
|
@ApiOperation(value = "库存列表")
|
|
|
|
public Result<PageInfo<Stock>> page(@RequestBody PageSearch pageSearch){
|
|
|
|
public Result<PageInfo<Stock>> page(@RequestBody PageSearch pageSearch) {
|
|
|
|
return Result.success(stockService.page(pageSearch));
|
|
|
|
return Result.success(stockService.page(pageSearch));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -70,29 +93,29 @@ public class StockController {
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "复核页面的核对信息")
|
|
|
|
@ApiOperation(value = "复核页面的核对信息")
|
|
|
|
@RequestMapping(value = "/info", method = RequestMethod.POST)
|
|
|
|
@RequestMapping(value = "/info", method = RequestMethod.POST)
|
|
|
|
public Result<Stock> stockInfo(@RequestBody StockCheck stockCheck){
|
|
|
|
public Result<Stock> stockInfo(@RequestBody StockCheck stockCheck) {
|
|
|
|
validatorUtil.validate(stockCheck);
|
|
|
|
validatorUtil.validate(stockCheck);
|
|
|
|
return Result.success(stockService.stockInfo(stockCheck));
|
|
|
|
return Result.success(stockService.stockInfo(stockCheck));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "复核正确")
|
|
|
|
@ApiOperation(value = "复核正确")
|
|
|
|
@RequestMapping(value = "/checkCorrect", method = RequestMethod.POST)
|
|
|
|
@RequestMapping(value = "/checkCorrect", method = RequestMethod.POST)
|
|
|
|
public Result<Stock> check(@RequestBody StockCheck stockCheck){
|
|
|
|
public Result<Stock> check(@RequestBody StockCheck stockCheck) {
|
|
|
|
validatorUtil.validate(stockCheck);
|
|
|
|
validatorUtil.validate(stockCheck);
|
|
|
|
return Result.success(stockService.checkCorrect(stockCheck));
|
|
|
|
return Result.success(stockService.checkCorrect(stockCheck));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "人工复核")
|
|
|
|
@ApiOperation(value = "人工复核")
|
|
|
|
@RequestMapping(value = "/checkByMan", method = RequestMethod.POST)
|
|
|
|
@RequestMapping(value = "/checkByMan", method = RequestMethod.POST)
|
|
|
|
public Result<Stock> checkByMan(@RequestBody CheckByMan checkByMan){
|
|
|
|
public Result<Stock> checkByMan(@RequestBody CheckByMan checkByMan) {
|
|
|
|
validatorUtil.validate(checkByMan);
|
|
|
|
validatorUtil.validate(checkByMan);
|
|
|
|
return Result.success(stockService.checkByMan(checkByMan));
|
|
|
|
return Result.success(stockService.checkByMan(checkByMan));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "slow")
|
|
|
|
@ApiOperation(value = "slow")
|
|
|
|
@RequestMapping(value = "/slow", method = RequestMethod.GET)
|
|
|
|
@RequestMapping(value = "/slow", method = RequestMethod.GET)
|
|
|
|
public Result slow(Integer ptzId,Integer cameraId){
|
|
|
|
public Result slow(Integer ptzId, Integer cameraId) {
|
|
|
|
PtzControlModule.toPtzSlow(ptzId,cameraId);
|
|
|
|
PtzControlModule.toPtzSlow(ptzId, cameraId);
|
|
|
|
return Result.success();
|
|
|
|
return Result.success();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|