添加了 采购审批功能及采购人员接收功能
This commit is contained in:
parent
66bbf61a99
commit
9700f1467b
|
@ -0,0 +1,218 @@
|
||||||
|
package org.jeecg.modules.demo.Try.controller;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLDecoder;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
|
import org.jeecg.common.util.oConvertUtils;
|
||||||
|
import org.jeecg.modules.demo.Try.entity.PurchaseOrderConfirmation;
|
||||||
|
import org.jeecg.modules.demo.Try.entity.PurchaseRequest;
|
||||||
|
import org.jeecg.modules.demo.Try.service.IPurchaseOrderConfirmationService;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import org.jeecg.modules.demo.Try.service.IPurchaseRequestService;
|
||||||
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||||
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||||
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||||
|
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||||
|
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||||
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 采购订单确认
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2023-08-13
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Api(tags = "采购订单确认")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/Try/purchaseOrderConfirmation")
|
||||||
|
@Slf4j
|
||||||
|
public class PurchaseOrderConfirmationController extends JeecgController<PurchaseOrderConfirmation, IPurchaseOrderConfirmationService> {
|
||||||
|
@Autowired
|
||||||
|
private IPurchaseOrderConfirmationService purchaseOrderConfirmationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IPurchaseRequestService purchaseRequestService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页列表查询
|
||||||
|
*
|
||||||
|
* @param purchaseOrderConfirmation
|
||||||
|
* @param pageNo
|
||||||
|
* @param pageSize
|
||||||
|
* @param req
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
//@AutoLog(value = "采购订单确认-分页列表查询")
|
||||||
|
@ApiOperation(value = "采购订单确认-分页列表查询", notes = "采购订单确认-分页列表查询")
|
||||||
|
@GetMapping(value = "/list")
|
||||||
|
public Result<IPage<PurchaseOrderConfirmation>> queryPageList(PurchaseOrderConfirmation purchaseOrderConfirmation,
|
||||||
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
|
HttpServletRequest req) {
|
||||||
|
QueryWrapper<PurchaseOrderConfirmation> queryWrapper = QueryGenerator.initQueryWrapper(purchaseOrderConfirmation, req.getParameterMap());
|
||||||
|
Page<PurchaseOrderConfirmation> page = new Page<PurchaseOrderConfirmation>(pageNo, pageSize);
|
||||||
|
IPage<PurchaseOrderConfirmation> pageList = purchaseOrderConfirmationService.page(page, queryWrapper);
|
||||||
|
return Result.OK(pageList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*
|
||||||
|
* @param purchaseOrderConfirmation
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "采购订单确认-添加")
|
||||||
|
@ApiOperation(value = "采购订单确认-添加", notes = "采购订单确认-添加")
|
||||||
|
@PostMapping(value = "/add")
|
||||||
|
public Result<String> add(@RequestBody PurchaseOrderConfirmation purchaseOrderConfirmation) {
|
||||||
|
purchaseOrderConfirmationService.save(purchaseOrderConfirmation);
|
||||||
|
return Result.OK("添加成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*
|
||||||
|
* @param purchaseOrderConfirmation
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "采购订单确认-编辑")
|
||||||
|
@ApiOperation(value = "采购订单确认-编辑", notes = "采购订单确认-编辑")
|
||||||
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||||
|
public Result<String> edit(@RequestBody PurchaseOrderConfirmation purchaseOrderConfirmation) {
|
||||||
|
purchaseOrderConfirmationService.updateById(purchaseOrderConfirmation);
|
||||||
|
return Result.OK("编辑成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被接收 备用代码
|
||||||
|
*
|
||||||
|
* @param purchaseOrderConfirmation
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "采购订单确认-接受")
|
||||||
|
@ApiOperation(value = "采购订单确认-接受", notes = "采购订单确认-接受")
|
||||||
|
@RequestMapping(value = "/acceptReceiving", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||||
|
public Result<String> acceptReceiving(@RequestBody PurchaseOrderConfirmation purchaseOrderConfirmation) {
|
||||||
|
String requireNo = purchaseOrderConfirmation.getAssociationNumber();
|
||||||
|
PurchaseRequest purchaseRequest = purchaseRequestService.queryByRequireNo(requireNo);
|
||||||
|
purchaseRequest.setIsReceiving("1");
|
||||||
|
purchaseRequestService.updateById(purchaseRequest);
|
||||||
|
purchaseOrderConfirmationService.save(purchaseOrderConfirmation);
|
||||||
|
return Result.OK("已确认接收!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被接收
|
||||||
|
*
|
||||||
|
* @param purchaseOrderConfirmation
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "采购订单确认-取消")
|
||||||
|
@ApiOperation(value = "采购订单确认-取消", notes = "采购订单确认-取消")
|
||||||
|
@RequestMapping(value = "/cancelReceiving", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||||
|
public Result<String> cancelReceiving(@RequestBody PurchaseOrderConfirmation purchaseOrderConfirmation) {
|
||||||
|
String requireNo = purchaseOrderConfirmation.getAssociationNumber();
|
||||||
|
PurchaseRequest purchaseRequest = purchaseRequestService.queryByRequireNo(requireNo);
|
||||||
|
purchaseRequest.setIsReceiving("0");
|
||||||
|
purchaseRequestService.updateById(purchaseRequest);
|
||||||
|
purchaseOrderConfirmationService.removeById(purchaseOrderConfirmationService.queryByRequireNo(requireNo).getId());
|
||||||
|
return Result.OK("已取消接收!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||||
|
// purchaseOrderConfirmationService.removeById(id);
|
||||||
|
// return Result.OK("删除成功!");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id删除
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "采购订单确认-通过id删除")
|
||||||
|
@ApiOperation(value = "采购订单确认-通过id删除", notes = "采购订单确认-通过id删除")
|
||||||
|
@DeleteMapping(value = "/delete")
|
||||||
|
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||||
|
purchaseOrderConfirmationService.removeById(id);
|
||||||
|
return Result.OK("删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*
|
||||||
|
* @param ids
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "采购订单确认-批量删除")
|
||||||
|
@ApiOperation(value = "采购订单确认-批量删除", notes = "采购订单确认-批量删除")
|
||||||
|
@DeleteMapping(value = "/deleteBatch")
|
||||||
|
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||||
|
this.purchaseOrderConfirmationService.removeByIds(Arrays.asList(ids.split(",")));
|
||||||
|
return Result.OK("批量删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id查询
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
//@AutoLog(value = "采购订单确认-通过id查询")
|
||||||
|
@ApiOperation(value = "采购订单确认-通过id查询", notes = "采购订单确认-通过id查询")
|
||||||
|
@GetMapping(value = "/queryById")
|
||||||
|
public Result<PurchaseOrderConfirmation> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||||
|
PurchaseOrderConfirmation purchaseOrderConfirmation = purchaseOrderConfirmationService.getById(id);
|
||||||
|
if (purchaseOrderConfirmation == null) {
|
||||||
|
return Result.error("未找到对应数据");
|
||||||
|
}
|
||||||
|
return Result.OK(purchaseOrderConfirmation);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出excel
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @param purchaseOrderConfirmation
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/exportXls")
|
||||||
|
public ModelAndView exportXls(HttpServletRequest request, PurchaseOrderConfirmation purchaseOrderConfirmation) {
|
||||||
|
return super.exportXls(request, purchaseOrderConfirmation, PurchaseOrderConfirmation.class, "采购订单确认");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过excel导入数据
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||||
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
return super.importExcel(request, response, PurchaseOrderConfirmation.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,235 @@
|
||||||
|
package org.jeecg.modules.demo.Try.controller;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLDecoder;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.common.aspect.annotation.PermissionData;
|
||||||
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
|
import org.jeecg.common.util.oConvertUtils;
|
||||||
|
import org.jeecg.modules.demo.Try.entity.PurchaseRequest;
|
||||||
|
import org.jeecg.modules.demo.Try.service.IPurchaseOrderConfirmationService;
|
||||||
|
import org.jeecg.modules.demo.Try.service.IPurchaseRequestService;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||||
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||||
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||||
|
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||||
|
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||||
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 采购表
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2023-08-12
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Api(tags = "采购表")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/Try/purchaseRequest")
|
||||||
|
@Slf4j
|
||||||
|
public class PurchaseRequestController extends JeecgController<PurchaseRequest, IPurchaseRequestService> {
|
||||||
|
@Autowired
|
||||||
|
private IPurchaseRequestService purchaseRequestService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页列表查询
|
||||||
|
*
|
||||||
|
* @param purchaseRequest
|
||||||
|
* @param pageNo
|
||||||
|
* @param pageSize
|
||||||
|
* @param req
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
//@AutoLog(value = "采购表-分页列表查询")
|
||||||
|
@ApiOperation(value = "采购表-分页列表查询", notes = "采购表-分页列表查询")
|
||||||
|
@GetMapping(value = "/list")
|
||||||
|
public Result<IPage<PurchaseRequest>> queryPageList(PurchaseRequest purchaseRequest,
|
||||||
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
|
HttpServletRequest req) {
|
||||||
|
QueryWrapper<PurchaseRequest> queryWrapper = QueryGenerator.initQueryWrapper(purchaseRequest, req.getParameterMap());
|
||||||
|
Page<PurchaseRequest> page = new Page<PurchaseRequest>(pageNo, pageSize);
|
||||||
|
IPage<PurchaseRequest> pageList = purchaseRequestService.page(page, queryWrapper);
|
||||||
|
return Result.OK(pageList);
|
||||||
|
}
|
||||||
|
|
||||||
|
//@AutoLog(value = "采购表-分页列表查询")
|
||||||
|
@ApiOperation(value = "审核-采购表-分页列表查询", notes = "审核-采购表-分页列表查询")
|
||||||
|
@PermissionData(pageComponent = "purchase/request/PurchaseRequestList")
|
||||||
|
@GetMapping(value = "/selfList")
|
||||||
|
public Result<IPage<PurchaseRequest>> querySelfPageList(PurchaseRequest purchaseRequest,
|
||||||
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
|
HttpServletRequest req) {
|
||||||
|
QueryWrapper<PurchaseRequest> queryWrapper = QueryGenerator.initQueryWrapper(purchaseRequest, req.getParameterMap());
|
||||||
|
Page<PurchaseRequest> page = new Page<PurchaseRequest>(pageNo, pageSize);
|
||||||
|
IPage<PurchaseRequest> pageList = purchaseRequestService.page(page, queryWrapper);
|
||||||
|
return Result.OK(pageList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*
|
||||||
|
* @param purchaseRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "采购表-添加")
|
||||||
|
@ApiOperation(value = "采购表-添加", notes = "采购表-添加")
|
||||||
|
@PostMapping(value = "/add")
|
||||||
|
public Result<String> add(@RequestBody PurchaseRequest purchaseRequest) {
|
||||||
|
PurchaseRequest result = purchaseRequestService.getMaxRequestNo();
|
||||||
|
//套娃逻辑,从数据库获取最大的需求编号,然后加1
|
||||||
|
if (result != null) {
|
||||||
|
//转换成int类型,然后加1,再转换成String类型
|
||||||
|
purchaseRequest.setRequirementNumber(String.valueOf(Integer.parseInt(result.getRequirementNumber()) + 1));
|
||||||
|
} else {
|
||||||
|
//如果数据库没有数据,那么就从1001开始
|
||||||
|
purchaseRequest.setRequirementNumber(String.valueOf(1001));
|
||||||
|
}
|
||||||
|
purchaseRequestService.save(purchaseRequest);
|
||||||
|
return Result.OK("添加成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*
|
||||||
|
* @param purchaseRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "采购表-编辑")
|
||||||
|
@ApiOperation(value = "采购表-编辑", notes = "采购表-编辑")
|
||||||
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||||
|
public Result<String> edit(@RequestBody PurchaseRequest purchaseRequest) {
|
||||||
|
purchaseRequestService.updateById(purchaseRequest);
|
||||||
|
return Result.OK("编辑成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重新提交
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "采购表-重新提交")
|
||||||
|
@ApiOperation(value = "采购表-重新提交", notes = "采购表-重新提交")
|
||||||
|
@RequestMapping(value = "/reSubmit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||||
|
public Result<String> reSubmit(@RequestBody PurchaseRequest purchaseRequest) {
|
||||||
|
PurchaseRequest rePurchaseRequest = purchaseRequestService.queryByRequireNo(purchaseRequest);
|
||||||
|
rePurchaseRequest.setDemandStatus(1);
|
||||||
|
rePurchaseRequest.setCreateTime(new Date());
|
||||||
|
purchaseRequestService.updateById(rePurchaseRequest);
|
||||||
|
return Result.OK("提交成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id删除
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "采购表-通过id删除")
|
||||||
|
@ApiOperation(value = "采购表-通过id删除", notes = "采购表-通过id删除")
|
||||||
|
@DeleteMapping(value = "/delete")
|
||||||
|
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||||
|
purchaseRequestService.removeById(id);
|
||||||
|
return Result.OK("删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
*
|
||||||
|
* @param ids
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "采购表-批量删除")
|
||||||
|
@ApiOperation(value = "采购表-批量删除", notes = "采购表-批量删除")
|
||||||
|
@DeleteMapping(value = "/deleteBatch")
|
||||||
|
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||||
|
this.purchaseRequestService.removeByIds(Arrays.asList(ids.split(",")));
|
||||||
|
return Result.OK("批量删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id查询
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
//@AutoLog(value = "采购表-通过id查询")
|
||||||
|
@ApiOperation(value = "采购表-通过id查询", notes = "采购表-通过id查询")
|
||||||
|
@GetMapping(value = "/queryById")
|
||||||
|
public Result<PurchaseRequest> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||||
|
PurchaseRequest purchaseRequest = purchaseRequestService.getById(id);
|
||||||
|
if (purchaseRequest == null) {
|
||||||
|
return Result.error("未找到对应数据");
|
||||||
|
}
|
||||||
|
return Result.OK(purchaseRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出excel
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @param purchaseRequest
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/exportXls")
|
||||||
|
public ModelAndView exportXls(HttpServletRequest request, PurchaseRequest purchaseRequest) {
|
||||||
|
return super.exportXls(request, purchaseRequest, PurchaseRequest.class, "采购表");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过excel导入数据
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||||
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
return super.importExcel(request, response, PurchaseRequest.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未接单的采购需求展示(List)
|
||||||
|
*
|
||||||
|
* @param purchaseRequest
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "采购表-待接单", notes = "采购表-待接单")
|
||||||
|
@GetMapping(value = "/waitForReceiveList")
|
||||||
|
public Result<IPage<PurchaseRequest>> queryPageWaitForList(PurchaseRequest purchaseRequest,
|
||||||
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
|
HttpServletRequest req) {
|
||||||
|
QueryWrapper<PurchaseRequest> queryWrapper = QueryGenerator.initQueryWrapper(purchaseRequest, req.getParameterMap());
|
||||||
|
//is_receiving=0表示未接单,demand_status=1表示已审核通过
|
||||||
|
//添加条件查询,只查询已审核通过并且未接单的采购需求
|
||||||
|
queryWrapper.eq("demand_status", 2);
|
||||||
|
queryWrapper.eq("is_receiving", 0);
|
||||||
|
Page<PurchaseRequest> page = new Page<PurchaseRequest>(pageNo, pageSize);
|
||||||
|
IPage<PurchaseRequest> pageList = purchaseRequestService.page(page, queryWrapper);
|
||||||
|
return Result.OK(pageList);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,104 @@
|
||||||
|
package org.jeecg.modules.demo.Try.entity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import lombok.Data;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
import org.jeecg.common.aspect.annotation.Dict;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 采购订单确认
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2023-08-13
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("purchase_order_confirmation")
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value = "purchase_order_confirmation对象", description = "采购订单确认")
|
||||||
|
public class PurchaseOrderConfirmation implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
@ApiModelProperty(value = "主键")
|
||||||
|
private java.lang.String id;
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "创建人")
|
||||||
|
private java.lang.String createBy;
|
||||||
|
/**
|
||||||
|
* 创建日期
|
||||||
|
*/
|
||||||
|
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ApiModelProperty(value = "创建日期")
|
||||||
|
private java.util.Date createTime;
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "更新人")
|
||||||
|
private java.lang.String updateBy;
|
||||||
|
/**
|
||||||
|
* 更新日期
|
||||||
|
*/
|
||||||
|
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ApiModelProperty(value = "更新日期")
|
||||||
|
private java.util.Date updateTime;
|
||||||
|
/**
|
||||||
|
* 所属部门
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "所属部门")
|
||||||
|
private java.lang.String sysOrgCode;
|
||||||
|
/**
|
||||||
|
* 关联编号
|
||||||
|
*/
|
||||||
|
@Excel(name = "关联编号", width = 15)
|
||||||
|
@ApiModelProperty(value = "关联编号")
|
||||||
|
private java.lang.String associationNumber;
|
||||||
|
/**
|
||||||
|
* 供应商选择
|
||||||
|
*/
|
||||||
|
@Excel(name = "供应商选择", width = 15)
|
||||||
|
@ApiModelProperty(value = "供应商选择")
|
||||||
|
private java.lang.String supplierSelection;
|
||||||
|
/**
|
||||||
|
* 接单人
|
||||||
|
*/
|
||||||
|
@Excel(name = "接单人", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username")
|
||||||
|
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username")
|
||||||
|
@ApiModelProperty(value = "接单人")
|
||||||
|
private java.lang.String receiver;
|
||||||
|
/**
|
||||||
|
* 接单时间
|
||||||
|
*/
|
||||||
|
@Excel(name = "接单时间", width = 15, format = "yyyy-MM-dd")
|
||||||
|
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@ApiModelProperty(value = "接单时间")
|
||||||
|
private java.util.Date receivingTime;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@Excel(name = "备注", width = 15)
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private java.lang.String notes;
|
||||||
|
}
|
|
@ -0,0 +1,135 @@
|
||||||
|
package org.jeecg.modules.demo.Try.entity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import lombok.Data;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
import org.jeecg.common.aspect.annotation.Dict;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 采购表
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2023-08-12
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("purchase_request")
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value = "purchase_request对象", description = "采购表")
|
||||||
|
public class PurchaseRequest implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
@ApiModelProperty(value = "主键")
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
* 申请人
|
||||||
|
*/
|
||||||
|
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username")
|
||||||
|
@ApiModelProperty(value = "申请人")
|
||||||
|
private String createBy;
|
||||||
|
/**
|
||||||
|
* 申请日期
|
||||||
|
*/
|
||||||
|
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ApiModelProperty(value = "申请日期")
|
||||||
|
private Date createTime;
|
||||||
|
/**
|
||||||
|
* 需求编号
|
||||||
|
*/
|
||||||
|
@Excel(name = "需求编号", width = 15)
|
||||||
|
@ApiModelProperty(value = "需求编号")
|
||||||
|
private String requirementNumber;
|
||||||
|
/**
|
||||||
|
* 申请部门
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "申请部门")
|
||||||
|
private String sysOrgCode;
|
||||||
|
/**
|
||||||
|
* 需求状态
|
||||||
|
*/
|
||||||
|
@Excel(name = "需求状态", width = 15, dicCode = "procurement_approval_status")
|
||||||
|
@Dict(dicCode = "procurement_approval_status")
|
||||||
|
@ApiModelProperty(value = "需求状态")
|
||||||
|
private Integer demandStatus;
|
||||||
|
/**
|
||||||
|
* 更新人员
|
||||||
|
*/
|
||||||
|
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username")
|
||||||
|
@ApiModelProperty(value = "更新人员")
|
||||||
|
private String updateBy;
|
||||||
|
/**
|
||||||
|
* 审批人
|
||||||
|
*/
|
||||||
|
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username")
|
||||||
|
@ApiModelProperty(value = "审批人")
|
||||||
|
private String approvedBy;
|
||||||
|
/**
|
||||||
|
* 更新日期
|
||||||
|
*/
|
||||||
|
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ApiModelProperty(value = "更新日期")
|
||||||
|
private Date updateTime;
|
||||||
|
/**
|
||||||
|
* 采购类别
|
||||||
|
*/
|
||||||
|
@Excel(name = "采购类别", width = 15, dicCode = "purchasing_categories")
|
||||||
|
@Dict(dicCode = "purchasing_categories")
|
||||||
|
@ApiModelProperty(value = "采购类别")
|
||||||
|
private Integer procurementCategory;
|
||||||
|
/**
|
||||||
|
* 采购方向
|
||||||
|
*/
|
||||||
|
@Excel(name = "采购方向", width = 15)
|
||||||
|
@ApiModelProperty(value = "采购方向")
|
||||||
|
private String procurementDirection;
|
||||||
|
/**
|
||||||
|
* 采购内容
|
||||||
|
*/
|
||||||
|
@Excel(name = "采购内容", width = 15)
|
||||||
|
@ApiModelProperty(value = "采购内容")
|
||||||
|
private String procurementContent;
|
||||||
|
/**
|
||||||
|
* 采购预算
|
||||||
|
*/
|
||||||
|
@Excel(name = "采购预算", width = 15)
|
||||||
|
@ApiModelProperty(value = "采购预算")
|
||||||
|
private String procurementBudget;
|
||||||
|
/**
|
||||||
|
* 附件
|
||||||
|
*/
|
||||||
|
@Excel(name = "附件", width = 15)
|
||||||
|
@ApiModelProperty(value = "附件")
|
||||||
|
private String annex;
|
||||||
|
/**
|
||||||
|
* 审核结果
|
||||||
|
*/
|
||||||
|
@Excel(name = "审核结果", width = 15)
|
||||||
|
@ApiModelProperty(value = "审核结果")
|
||||||
|
private String auditResults;
|
||||||
|
/**
|
||||||
|
* 采购方向
|
||||||
|
*/
|
||||||
|
@Excel(name = "是否被接受", width = 15)
|
||||||
|
@ApiModelProperty(value = "是否被接受")
|
||||||
|
private String isReceiving;
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package org.jeecg.modules.demo.Try.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.jeecg.modules.demo.Try.entity.PurchaseOrderConfirmation;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 采购订单确认
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2023-08-13
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface PurchaseOrderConfirmationMapper extends BaseMapper<PurchaseOrderConfirmation> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package org.jeecg.modules.demo.Try.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.jeecg.modules.demo.Try.entity.PurchaseRequest;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 采购表
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2023-08-12
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface PurchaseRequestMapper extends BaseMapper<PurchaseRequest> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.jeecg.modules.demo.Try.mapper.PurchaseOrderConfirmationMapper">
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.jeecg.modules.demo.Try.mapper.PurchaseRequestMapper">
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,19 @@
|
||||||
|
package org.jeecg.modules.demo.Try.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import org.jeecg.modules.demo.Try.entity.PurchaseRequest;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 采购表
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2023-08-12
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface IPurchaseRequestService extends IService<PurchaseRequest> {
|
||||||
|
PurchaseRequest getMaxRequestNo();
|
||||||
|
|
||||||
|
PurchaseRequest queryByRequireNo(String requirementNumber);
|
||||||
|
|
||||||
|
PurchaseRequest queryByRequireNo(PurchaseRequest purchaseRequest);
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package org.jeecg.modules.demo.Try.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import org.jeecg.modules.demo.Try.entity.PurchaseOrderConfirmation;
|
||||||
|
import org.jeecg.modules.demo.Try.mapper.PurchaseOrderConfirmationMapper;
|
||||||
|
import org.jeecg.modules.demo.Try.service.IPurchaseOrderConfirmationService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 采购订单确认
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2023-08-13
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PurchaseOrderConfirmationServiceImpl extends ServiceImpl<PurchaseOrderConfirmationMapper, PurchaseOrderConfirmation> implements IPurchaseOrderConfirmationService {
|
||||||
|
@Autowired
|
||||||
|
private PurchaseOrderConfirmationMapper purchaseOrderConfirmationMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PurchaseOrderConfirmation queryByRequireNo(PurchaseOrderConfirmation queryByRequireNo) {
|
||||||
|
return queryByRequireNo(queryByRequireNo.getAssociationNumber());
|
||||||
|
}
|
||||||
|
|
||||||
|
public PurchaseOrderConfirmation queryByRequireNo(String queryByRequireNo) {
|
||||||
|
QueryWrapper<PurchaseOrderConfirmation> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("association_number", queryByRequireNo);
|
||||||
|
PurchaseOrderConfirmation purchaseOrderConfirmation = purchaseOrderConfirmationMapper.selectOne(queryWrapper);
|
||||||
|
return purchaseOrderConfirmation;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
package org.jeecg.modules.demo.Try.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import org.jeecg.modules.demo.Try.entity.PurchaseRequest;
|
||||||
|
import org.jeecg.modules.demo.Try.mapper.PurchaseRequestMapper;
|
||||||
|
import org.jeecg.modules.demo.Try.service.IPurchaseRequestService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 采购表
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2023-08-12
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PurchaseRequestServiceImpl extends ServiceImpl<PurchaseRequestMapper, PurchaseRequest> implements IPurchaseRequestService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PurchaseRequestMapper purchaseRequestMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PurchaseRequest getMaxRequestNo() {
|
||||||
|
List<PurchaseRequest> list = purchaseRequestMapper.selectList(null);
|
||||||
|
if (list.size() == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
PurchaseRequest max = list.get(0);
|
||||||
|
for (PurchaseRequest purchaseRequest : list) {
|
||||||
|
//转换成int类型
|
||||||
|
int maxNo = Integer.parseInt(max.getRequirementNumber());
|
||||||
|
int no = Integer.parseInt(purchaseRequest.getRequirementNumber());
|
||||||
|
if (no > maxNo) {
|
||||||
|
max = purchaseRequest;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
|
||||||
|
//根据PurchaseRequest对象的需求编号查询
|
||||||
|
@Override
|
||||||
|
public PurchaseRequest queryByRequireNo(PurchaseRequest purchaseRequest) {
|
||||||
|
PurchaseRequest one = queryByRequireNo(purchaseRequest.getRequirementNumber());
|
||||||
|
return one;
|
||||||
|
}
|
||||||
|
|
||||||
|
//根据需求编号查询
|
||||||
|
@Override
|
||||||
|
public PurchaseRequest queryByRequireNo(String requirementNumber) {
|
||||||
|
QueryWrapper<PurchaseRequest> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("requirement_number", requirementNumber);
|
||||||
|
PurchaseRequest one = purchaseRequestMapper.selectOne(queryWrapper);
|
||||||
|
return one;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue