You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
3.3 KiB

package com.nov.KgLowDurable.controller;
import com.nov.KgLowDurable.pojo.entity.LdOneOutStorageDetail;
import com.nov.KgLowDurable.pojo.vo.DepartmentVO;
import com.nov.KgLowDurable.pojo.vo.QuarterVO;
import com.nov.KgLowDurable.service.ILdDemandEndService;
import com.nov.KgLowDurable.util.Result;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
* @author liweidong
*/
@RestController
@AllArgsConstructor
@RequestMapping("/demandEnd")
public class LdDemandEndController {
private final ILdDemandEndService demandEndService;
@GetMapping("/list")
@ApiOperationSort(1)
@ApiOperation(value = "获取需求单列表", notes = "获取需求单列表,支持条件筛选", httpMethod = "GET", response = Result.class)
@ApiImplicitParams({
@ApiImplicitParam(name = "demandNo", value = "需求单号", dataType = "string", paramType = "query")
})
public Result list(@ApiParam(hidden = true)
@RequestParam(required = false) String demandNo,
@RequestParam(required = false ,defaultValue = "1") Integer pageNum,
@RequestParam(required = false ,defaultValue = "10") Integer pageSize) {
return Result.OK(demandEndService.getDemandEndList(demandNo,pageNum,pageSize));
}
@GetMapping("/getAllQuarter")
@ApiOperationSort(2)
@ApiOperation(value = "获取所有季度需求单", notes = "获取所有季度需求单", httpMethod = "GET", response = Result.class)
public Result getAllQuarter() {
try {
List<QuarterVO> quarters = demandEndService.getAllQuarter();
return Result.OK(quarters);
} catch (Exception e) {
return Result.error("获取季度列表失败");
}
}
@GetMapping("/getDepartment")
@ApiOperationSort(3)
@ApiOperation(value = "获取部门", notes = "根据年份和季度获取旗下部门", httpMethod = "GET", response = Result.class)
@ApiImplicitParams({
@ApiImplicitParam(name = "year", value = "年份", dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "quarter", value = "季度", dataType = "string", paramType = "query")
})
public Result getDepartment(@RequestParam String year, @RequestParam String quarter) {
try {
List<DepartmentVO> quarters = demandEndService.getDepartment(year,quarter);
return Result.OK(quarters);
} catch (Exception e) {
return Result.error("获取部门列表失败");
}
}
@GetMapping("/getDemandEndData")
@ApiOperationSort(4)
@ApiOperation(value = "获取需求单数据", notes = "根据年份,季度,部门查询", httpMethod = "GET", response = Result.class)
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", value = "采购单ID", dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "departmentId", value = "部门ID", dataType = "string", paramType = "query"),
})
public Result getDemandEndData(@RequestParam String ids,@RequestParam String departmentId) {
try {
Map<String, List<LdOneOutStorageDetail>> quarters = demandEndService.getDemandEndData(ids,departmentId);
return Result.OK(quarters);
} catch (Exception e) {
return Result.error("获取需求单数据失败");
}
}
}