|
@@ -0,0 +1,230 @@
|
|
|
+package org.jeecg.modules.inventory.controller;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+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.apache.commons.lang3.StringUtils;
|
|
|
+import org.jeecg.common.api.vo.Result;
|
|
|
+import org.jeecg.common.system.query.QueryGenerator;
|
|
|
+import org.jeecg.common.util.oConvertUtils;
|
|
|
+import org.jeecg.modules.inventory.entity.ItdmSampleExpire;
|
|
|
+import org.jeecg.modules.inventory.entity.ItdmSampleExpireReal;
|
|
|
+import org.jeecg.modules.inventory.service.IItdmSampleExpireRealService;
|
|
|
+import org.jeecg.modules.inventory.service.IItdmSampleExpireService;
|
|
|
+
|
|
|
+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-06-26
|
|
|
+ * @Version: V1.0
|
|
|
+ */
|
|
|
+@Api(tags="样品过期表")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/inventory/itdmSampleExpire")
|
|
|
+@Slf4j
|
|
|
+public class ItdmSampleExpireController extends JeecgController<ItdmSampleExpire, IItdmSampleExpireService> {
|
|
|
+ @Autowired
|
|
|
+ private IItdmSampleExpireService itdmSampleExpireService;
|
|
|
+ @Autowired
|
|
|
+ private IItdmSampleExpireRealService realService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页列表查询
|
|
|
+ *
|
|
|
+ * @param itdmSampleExpire
|
|
|
+ * @param pageNo
|
|
|
+ * @param pageSize
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ //@AutoLog(value = "样品过期表-分页列表查询")
|
|
|
+ @ApiOperation(value="样品过期表-分页列表查询", notes="样品过期表-分页列表查询")
|
|
|
+ @GetMapping(value = "/list")
|
|
|
+ public Result<IPage<ItdmSampleExpire>> queryPageList(ItdmSampleExpire itdmSampleExpire,
|
|
|
+ @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
+ @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
+ HttpServletRequest req) {
|
|
|
+ QueryWrapper<ItdmSampleExpire> queryWrapper = QueryGenerator.initQueryWrapper(itdmSampleExpire, req.getParameterMap());
|
|
|
+ queryWrapper.like(StringUtils.isNotBlank(itdmSampleExpire.getBarCodes()), "bar_codes", itdmSampleExpire.getBarCodes());
|
|
|
+ Page<ItdmSampleExpire> page = new Page<ItdmSampleExpire>(pageNo, pageSize);
|
|
|
+ IPage<ItdmSampleExpire> pageList = itdmSampleExpireService.page(page, queryWrapper);
|
|
|
+ return Result.OK(pageList);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="分页列表查询待审核", notes="分页列表查询待审核")
|
|
|
+ @GetMapping(value = "/shenheList")
|
|
|
+ public Result<IPage<ItdmSampleExpire>> queryPageShenheList(ItdmSampleExpire itdmSampleExpire,
|
|
|
+ @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
+ @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
+ HttpServletRequest req) {
|
|
|
+ itdmSampleExpire.setAuditStatus("0");
|
|
|
+ QueryWrapper<ItdmSampleExpire> queryWrapper = QueryGenerator.initQueryWrapper(itdmSampleExpire, req.getParameterMap());
|
|
|
+ if(itdmSampleExpire.getBarCodes()!=null){
|
|
|
+ queryWrapper.like("bar_codes",itdmSampleExpire.getBarCodes());
|
|
|
+ }
|
|
|
+ Page<ItdmSampleExpire> page = new Page<ItdmSampleExpire>(pageNo, pageSize);
|
|
|
+ IPage<ItdmSampleExpire> pageList = itdmSampleExpireService.page(page, queryWrapper);
|
|
|
+ return Result.OK(pageList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加
|
|
|
+ *
|
|
|
+ * @param itdmSampleExpire
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "样品过期表-添加")
|
|
|
+ @ApiOperation(value="样品过期表-添加", notes="样品过期表-添加")
|
|
|
+ //@RequiresPermissions("org.jeecg.modules:itdm_sample_expire:add")
|
|
|
+ @PostMapping(value = "/add")
|
|
|
+ public Result<String> add(@RequestBody ItdmSampleExpire itdmSampleExpire) {
|
|
|
+ itdmSampleExpireService.save(itdmSampleExpire);
|
|
|
+ return Result.OK("添加成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 编辑
|
|
|
+ *
|
|
|
+ * @param itdmSampleExpire
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "样品过期表-编辑")
|
|
|
+ @ApiOperation(value="样品过期表-编辑", notes="样品过期表-编辑")
|
|
|
+ //@RequiresPermissions("org.jeecg.modules:itdm_sample_expire:edit")
|
|
|
+ @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
|
+ public Result<String> edit(@RequestBody ItdmSampleExpire itdmSampleExpire) {
|
|
|
+ if(itdmSampleExpire.getAuditStatus().equals("0")){ //0未审批1审批通过2审批拒绝
|
|
|
+ itdmSampleExpireService.updateById(itdmSampleExpire);
|
|
|
+ return Result.OK("编辑成功!");
|
|
|
+ }else return Result.error("已审批,不可修改!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 审核
|
|
|
+ *
|
|
|
+ * @param itdmSampleExpire
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "样品过期表-审核")
|
|
|
+ @ApiOperation(value="样品过期表-审核", notes="样品过期表-审核")
|
|
|
+ //@RequiresPermissions("org.jeecg.modules:itdm_sample_expire:edit")
|
|
|
+ @RequestMapping(value = "/shenhe", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
|
+ public Result<String> shenhe(@RequestBody ItdmSampleExpire itdmSampleExpire) {
|
|
|
+ if(itdmSampleExpire.getAuditStatus().equals("1")){ //审批通过
|
|
|
+ List<ItdmSampleExpireReal> reals = new ArrayList<>();
|
|
|
+ List<String> barcodeIdList = Arrays.asList(itdmSampleExpire.getBarCodes().split(","));
|
|
|
+ for(String barcode:barcodeIdList){
|
|
|
+ ItdmSampleExpireReal real = new ItdmSampleExpireReal();
|
|
|
+ real.setExpireId(itdmSampleExpire.getId());
|
|
|
+ real.setBarCode(barcode);
|
|
|
+ real.setHandlingMethod(itdmSampleExpire.getHandlingMethod());
|
|
|
+ reals.add(real);
|
|
|
+ }
|
|
|
+ realService.saveBatch(reals);
|
|
|
+ }
|
|
|
+ itdmSampleExpireService.updateById(itdmSampleExpire);
|
|
|
+ return Result.OK("审批成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id删除
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "样品过期表-通过id删除")
|
|
|
+ @ApiOperation(value="样品过期表-通过id删除", notes="样品过期表-通过id删除")
|
|
|
+ //@RequiresPermissions("org.jeecg.modules:itdm_sample_expire:delete")
|
|
|
+ @DeleteMapping(value = "/delete")
|
|
|
+ public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
|
|
+ itdmSampleExpireService.removeById(id);
|
|
|
+ return Result.OK("删除成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量删除
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "样品过期表-批量删除")
|
|
|
+ @ApiOperation(value="样品过期表-批量删除", notes="样品过期表-批量删除")
|
|
|
+ //@RequiresPermissions("org.jeecg.modules:itdm_sample_expire:deleteBatch")
|
|
|
+ @DeleteMapping(value = "/deleteBatch")
|
|
|
+ public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
|
|
+ this.itdmSampleExpireService.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<ItdmSampleExpire> queryById(@RequestParam(name="id",required=true) String id) {
|
|
|
+ ItdmSampleExpire itdmSampleExpire = itdmSampleExpireService.getById(id);
|
|
|
+ if(itdmSampleExpire==null) {
|
|
|
+ return Result.error("未找到对应数据");
|
|
|
+ }
|
|
|
+ return Result.OK(itdmSampleExpire);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出excel
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param itdmSampleExpire
|
|
|
+ */
|
|
|
+ //@RequiresPermissions("org.jeecg.modules:itdm_sample_expire:exportXls")
|
|
|
+ @RequestMapping(value = "/exportXls")
|
|
|
+ public ModelAndView exportXls(HttpServletRequest request, ItdmSampleExpire itdmSampleExpire) {
|
|
|
+ return super.exportXls(request, itdmSampleExpire, ItdmSampleExpire.class, "样品过期表");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过excel导入数据
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param response
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ //@RequiresPermissions("itdm_sample_expire:importExcel")
|
|
|
+ @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
|
|
+ public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ return super.importExcel(request, response, ItdmSampleExpire.class);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|