|
@@ -51,317 +51,318 @@ import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
|
|
|
|
|
|
- /**
|
|
|
+/**
|
|
|
* @Description: 寄存代发入库主表
|
|
|
* @Author: jeecg-boot
|
|
|
- * @Date: 2025-05-14
|
|
|
+ * @Date: 2025-05-14
|
|
|
* @Version: V1.0
|
|
|
*/
|
|
|
-@Api(tags="寄存代发入库主表")
|
|
|
+@Api(tags = "寄存代发入库主表")
|
|
|
@RestController
|
|
|
@RequestMapping("/storeCode/storeConsignmentIn")
|
|
|
@Slf4j
|
|
|
public class StoreConsignmentInController {
|
|
|
- @Autowired
|
|
|
- private IStoreConsignmentInService storeConsignmentInService;
|
|
|
- @Autowired
|
|
|
- private IStoreConsignmentInDetailsService storeConsignmentInDetailsService;
|
|
|
- @Autowired
|
|
|
- private IStoreConsignmentInShipService storeConsignmentInShipService;
|
|
|
- @Autowired
|
|
|
- private ISerialPatternService serialPatternService;
|
|
|
-
|
|
|
- /**
|
|
|
- * 分页列表查询
|
|
|
- *
|
|
|
- * @param storeConsignmentIn
|
|
|
- * @param pageNo
|
|
|
- * @param pageSize
|
|
|
- * @param req
|
|
|
- * @return
|
|
|
- */
|
|
|
- //@AutoLog(value = "寄存代发入库主表-分页列表查询")
|
|
|
- @ApiOperation(value="寄存代发入库主表-分页列表查询", notes="寄存代发入库主表-分页列表查询")
|
|
|
- @GetMapping(value = "/list")
|
|
|
- public Result<IPage<StoreConsignmentIn>> queryPageList(StoreConsignmentIn storeConsignmentIn,
|
|
|
- @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
- @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
- HttpServletRequest req) {
|
|
|
+ @Autowired
|
|
|
+ private IStoreConsignmentInService storeConsignmentInService;
|
|
|
+ @Autowired
|
|
|
+ private IStoreConsignmentInDetailsService storeConsignmentInDetailsService;
|
|
|
+ @Autowired
|
|
|
+ private IStoreConsignmentInShipService storeConsignmentInShipService;
|
|
|
+ @Autowired
|
|
|
+ private ISerialPatternService serialPatternService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页列表查询
|
|
|
+ *
|
|
|
+ * @param storeConsignmentIn
|
|
|
+ * @param pageNo
|
|
|
+ * @param pageSize
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ //@AutoLog(value = "寄存代发入库主表-分页列表查询")
|
|
|
+ @ApiOperation(value = "寄存代发入库主表-分页列表查询", notes = "寄存代发入库主表-分页列表查询")
|
|
|
+ @GetMapping(value = "/list")
|
|
|
+ public Result<IPage<StoreConsignmentIn>> queryPageList(StoreConsignmentIn storeConsignmentIn,
|
|
|
+ @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
+ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
+ HttpServletRequest req) {
|
|
|
QueryWrapper<StoreConsignmentIn> queryWrapper = QueryGenerator.initQueryWrapper(storeConsignmentIn, req.getParameterMap());
|
|
|
- Page<StoreConsignmentIn> page = new Page<StoreConsignmentIn>(pageNo, pageSize);
|
|
|
- IPage<StoreConsignmentIn> pageList = storeConsignmentInService.page(page, queryWrapper);
|
|
|
- return Result.OK(pageList);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 添加
|
|
|
- *
|
|
|
- * @param storeConsignmentInPage
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "寄存代发入库主表-添加")
|
|
|
- @ApiOperation(value="寄存代发入库主表-添加", notes="寄存代发入库主表-添加")
|
|
|
+ Page<StoreConsignmentIn> page = new Page<StoreConsignmentIn>(pageNo, pageSize);
|
|
|
+ IPage<StoreConsignmentIn> pageList = storeConsignmentInService.page(page, queryWrapper);
|
|
|
+ return Result.OK(pageList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加
|
|
|
+ *
|
|
|
+ * @param storeConsignmentInPage
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "寄存代发入库主表-添加")
|
|
|
+ @ApiOperation(value = "寄存代发入库主表-添加", notes = "寄存代发入库主表-添加")
|
|
|
@RequiresPermissions("storeCode:store_consignment_in:add")
|
|
|
- @PostMapping(value = "/add")
|
|
|
- public Result<String> add(@RequestBody StoreConsignmentInPage storeConsignmentInPage) {
|
|
|
- StoreConsignmentIn storeConsignmentIn = new StoreConsignmentIn();
|
|
|
- BeanUtils.copyProperties(storeConsignmentInPage, storeConsignmentIn);
|
|
|
-
|
|
|
- String code = storeConsignmentIn.getBillCode();
|
|
|
- if (StringUtils.isNotBlank(code)) {
|
|
|
-
|
|
|
- QueryWrapper<StoreConsignmentIn> queryWrapper = new QueryWrapper();
|
|
|
- queryWrapper.eq("bill_code", code);
|
|
|
- queryWrapper.eq("del_flag", "0");
|
|
|
-
|
|
|
- List<StoreConsignmentIn> list = storeConsignmentInService.list(queryWrapper);
|
|
|
- if (list.size() != 0) {
|
|
|
- return Result.error("寄存代发入库编码重复,请修改!");
|
|
|
- }
|
|
|
- } else {
|
|
|
-
|
|
|
- Result<String> result = serialPatternService.getNextSerial("store_consignment_in", "bill_code");
|
|
|
- if (!result.isSuccess()) {
|
|
|
- return result;
|
|
|
- }
|
|
|
- storeConsignmentIn.setBillCode(result.getMessage());
|
|
|
- }
|
|
|
-
|
|
|
- storeConsignmentInService.saveMain(storeConsignmentIn, storeConsignmentInPage.getStoreConsignmentInDetailsList(),storeConsignmentInPage.getStoreConsignmentInShipList());
|
|
|
- return Result.OK("添加成功!");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 编辑
|
|
|
- *
|
|
|
- * @param storeConsignmentInPage
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "寄存代发入库主表-编辑")
|
|
|
- @ApiOperation(value="寄存代发入库主表-编辑", notes="寄存代发入库主表-编辑")
|
|
|
+ @PostMapping(value = "/add")
|
|
|
+ public Result<String> add(@RequestBody StoreConsignmentInPage storeConsignmentInPage) {
|
|
|
+ StoreConsignmentIn storeConsignmentIn = new StoreConsignmentIn();
|
|
|
+ BeanUtils.copyProperties(storeConsignmentInPage, storeConsignmentIn);
|
|
|
+
|
|
|
+ String code = storeConsignmentIn.getBillCode();
|
|
|
+ if (StringUtils.isNotBlank(code)) {
|
|
|
+
|
|
|
+ QueryWrapper<StoreConsignmentIn> queryWrapper = new QueryWrapper();
|
|
|
+ queryWrapper.eq("bill_code", code);
|
|
|
+ queryWrapper.eq("del_flag", "0");
|
|
|
+
|
|
|
+ List<StoreConsignmentIn> list = storeConsignmentInService.list(queryWrapper);
|
|
|
+ if (list.size() != 0) {
|
|
|
+ return Result.error("寄存代发入库编码重复,请修改!");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+
|
|
|
+ Result<String> result = serialPatternService.getNextSerial("store_consignment_in", "bill_code");
|
|
|
+ if (!result.isSuccess()) {
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ storeConsignmentIn.setBillCode(result.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ storeConsignmentInService.saveMain(storeConsignmentIn, storeConsignmentInPage.getStoreConsignmentInDetailsList(), storeConsignmentInPage.getStoreConsignmentInShipList());
|
|
|
+ return Result.OK("添加成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 编辑
|
|
|
+ *
|
|
|
+ * @param storeConsignmentInPage
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "寄存代发入库主表-编辑")
|
|
|
+ @ApiOperation(value = "寄存代发入库主表-编辑", notes = "寄存代发入库主表-编辑")
|
|
|
@RequiresPermissions("storeCode:store_consignment_in:edit")
|
|
|
- @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
|
- public Result<String> edit(@RequestBody StoreConsignmentInPage storeConsignmentInPage) {
|
|
|
- StoreConsignmentIn storeConsignmentIn = new StoreConsignmentIn();
|
|
|
- BeanUtils.copyProperties(storeConsignmentInPage, storeConsignmentIn);
|
|
|
- StoreConsignmentIn storeConsignmentInEntity = storeConsignmentInService.getById(storeConsignmentIn.getId());
|
|
|
- if(storeConsignmentInEntity==null) {
|
|
|
- return Result.error("未找到对应数据");
|
|
|
- }
|
|
|
- storeConsignmentInService.updateMain(storeConsignmentIn, storeConsignmentInPage.getStoreConsignmentInDetailsList(),storeConsignmentInPage.getStoreConsignmentInShipList());
|
|
|
- return Result.OK("编辑成功!");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 通过id删除
|
|
|
- *
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "寄存代发入库主表-通过id删除")
|
|
|
- @ApiOperation(value="寄存代发入库主表-通过id删除", notes="寄存代发入库主表-通过id删除")
|
|
|
+ @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
|
|
+ public Result<String> edit(@RequestBody StoreConsignmentInPage storeConsignmentInPage) {
|
|
|
+ StoreConsignmentIn storeConsignmentIn = new StoreConsignmentIn();
|
|
|
+ BeanUtils.copyProperties(storeConsignmentInPage, storeConsignmentIn);
|
|
|
+ StoreConsignmentIn storeConsignmentInEntity = storeConsignmentInService.getById(storeConsignmentIn.getId());
|
|
|
+ if (storeConsignmentInEntity == null) {
|
|
|
+ return Result.error("未找到对应数据");
|
|
|
+ }
|
|
|
+ storeConsignmentInService.updateMain(storeConsignmentIn, storeConsignmentInPage.getStoreConsignmentInDetailsList(), storeConsignmentInPage.getStoreConsignmentInShipList());
|
|
|
+ return Result.OK("编辑成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id删除
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "寄存代发入库主表-通过id删除")
|
|
|
+ @ApiOperation(value = "寄存代发入库主表-通过id删除", notes = "寄存代发入库主表-通过id删除")
|
|
|
@RequiresPermissions("storeCode:store_consignment_in:delete")
|
|
|
- @DeleteMapping(value = "/delete")
|
|
|
- public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
|
|
-
|
|
|
- StoreConsignmentIn storeConsignmentIn = storeConsignmentInService.getById(id);
|
|
|
- if(storeConsignmentIn==null) {
|
|
|
- return Result.error("未找到对应数据");
|
|
|
- }
|
|
|
-
|
|
|
- String submit = storeConsignmentIn.getSubmit();
|
|
|
- if (StringUtils.isNotBlank(submit) && submit.equals("1")) {
|
|
|
- return Result.error("已提交的数据无法删除");
|
|
|
- }
|
|
|
-
|
|
|
- storeConsignmentInService.delMain(id);
|
|
|
- return Result.OK("删除成功!");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 批量删除
|
|
|
- *
|
|
|
- * @param ids
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "寄存代发入库主表-批量删除")
|
|
|
- @ApiOperation(value="寄存代发入库主表-批量删除", notes="寄存代发入库主表-批量删除")
|
|
|
+ @DeleteMapping(value = "/delete")
|
|
|
+ public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
|
|
+
|
|
|
+ StoreConsignmentIn storeConsignmentIn = storeConsignmentInService.getById(id);
|
|
|
+ if (storeConsignmentIn == null) {
|
|
|
+ return Result.error("未找到对应数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ String submit = storeConsignmentIn.getSubmit();
|
|
|
+ if (StringUtils.isNotBlank(submit) && submit.equals("1")) {
|
|
|
+ return Result.error("已提交的数据无法删除");
|
|
|
+ }
|
|
|
+
|
|
|
+ storeConsignmentInService.delMain(id);
|
|
|
+ return Result.OK("删除成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量删除
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "寄存代发入库主表-批量删除")
|
|
|
+ @ApiOperation(value = "寄存代发入库主表-批量删除", notes = "寄存代发入库主表-批量删除")
|
|
|
@RequiresPermissions("storeCode:store_consignment_in:deleteBatch")
|
|
|
- @DeleteMapping(value = "/deleteBatch")
|
|
|
- public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
|
|
-
|
|
|
- for (String o : ids.split(",")) {
|
|
|
-
|
|
|
- StoreConsignmentIn order = storeConsignmentInService.getById(o);
|
|
|
- if (order == null) {
|
|
|
- return Result.error("未找到对应数据");
|
|
|
- }
|
|
|
-
|
|
|
- String submit = order.getSubmit();
|
|
|
- if (StringUtils.isNotBlank(submit) && submit.equals("1")) {
|
|
|
- return Result.error("单号" + order.getBillCode() + "已提交,无法删除");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- this.storeConsignmentInService.delBatchMain(Arrays.asList(ids.split(",")));
|
|
|
- return Result.OK("批量删除成功!");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 批量提交
|
|
|
- *
|
|
|
- * @param ids
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "寄存代发入库-批量提交")
|
|
|
- @ApiOperation(value = "寄存代发入库-批量提交", notes = "寄存代发入库-批量提交")
|
|
|
- @GetMapping(value = "/submitBatch")
|
|
|
- public Result<String> submitBatch(@RequestParam(name = "ids", required = true) String ids) {
|
|
|
-
|
|
|
- return storeConsignmentInService.submitBatch(ids);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 批量取消提交
|
|
|
- *
|
|
|
- * @param ids
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "寄存代发入库-批量取消提交")
|
|
|
- @ApiOperation(value = "寄存代发入库-批量取消提交", notes = "寄存代发入库-批量取消提交")
|
|
|
- @GetMapping(value = "/returnSubmitBatch")
|
|
|
- public Result<String> returnSubmitBatch(@RequestParam(name = "ids", required = true) String ids) {
|
|
|
-
|
|
|
- return storeConsignmentInService.returnSubmitBatch(ids);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 通过id查询
|
|
|
- *
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
- //@AutoLog(value = "寄存代发入库主表-通过id查询")
|
|
|
- @ApiOperation(value="寄存代发入库主表-通过id查询", notes="寄存代发入库主表-通过id查询")
|
|
|
- @GetMapping(value = "/queryById")
|
|
|
- public Result<StoreConsignmentIn> queryById(@RequestParam(name="id",required=true) String id) {
|
|
|
- StoreConsignmentIn storeConsignmentIn = storeConsignmentInService.getById(id);
|
|
|
- if(storeConsignmentIn==null) {
|
|
|
- return Result.error("未找到对应数据");
|
|
|
- }
|
|
|
- return Result.OK(storeConsignmentIn);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 通过id查询
|
|
|
- *
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
- //@AutoLog(value = "寄存代发入库-子表产品明细通过主表ID查询")
|
|
|
- @ApiOperation(value="寄存代发入库-子表产品明细主表ID查询", notes="寄存代发入库-子表产品明细-通主表ID查询")
|
|
|
- @GetMapping(value = "/queryStoreConsignmentInDetailsByMainId")
|
|
|
- public Result<List<StoreConsignmentInDetails>> queryStoreConsignmentInDetailsListByMainId(@RequestParam(name="id",required=true) String id) {
|
|
|
- List<StoreConsignmentInDetails> storeConsignmentInDetailsList = storeConsignmentInDetailsService.selectByMainId(id);
|
|
|
- return Result.OK(storeConsignmentInDetailsList);
|
|
|
- }
|
|
|
- /**
|
|
|
- * 通过id查询
|
|
|
- *
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
- //@AutoLog(value = "寄存代发入库-子表船明细通过主表ID查询")
|
|
|
- @ApiOperation(value="寄存代发入库-子表船明细主表ID查询", notes="寄存代发入库-子表船明细-通主表ID查询")
|
|
|
- @GetMapping(value = "/queryStoreConsignmentInShipByMainId")
|
|
|
- public Result<List<StoreConsignmentInShip>> queryStoreConsignmentInShipListByMainId(@RequestParam(name="id",required=true) String id) {
|
|
|
- List<StoreConsignmentInShip> storeConsignmentInShipList = storeConsignmentInShipService.selectByMainId(id);
|
|
|
- return Result.OK(storeConsignmentInShipList);
|
|
|
- }
|
|
|
+ @DeleteMapping(value = "/deleteBatch")
|
|
|
+ public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
|
|
+
|
|
|
+ for (String o : ids.split(",")) {
|
|
|
+
|
|
|
+ StoreConsignmentIn order = storeConsignmentInService.getById(o);
|
|
|
+ if (order == null) {
|
|
|
+ return Result.error("未找到对应数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ String submit = order.getSubmit();
|
|
|
+ if (StringUtils.isNotBlank(submit) && submit.equals("1")) {
|
|
|
+ return Result.error("单号" + order.getBillCode() + "已提交,无法删除");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.storeConsignmentInService.delBatchMain(Arrays.asList(ids.split(",")));
|
|
|
+ return Result.OK("批量删除成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量提交
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "寄存代发入库-批量提交")
|
|
|
+ @ApiOperation(value = "寄存代发入库-批量提交", notes = "寄存代发入库-批量提交")
|
|
|
+ @GetMapping(value = "/submitBatch")
|
|
|
+ public Result<String> submitBatch(@RequestParam(name = "ids", required = true) String ids) {
|
|
|
+
|
|
|
+ return storeConsignmentInService.submitBatch(ids);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量取消提交
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "寄存代发入库-批量取消提交")
|
|
|
+ @ApiOperation(value = "寄存代发入库-批量取消提交", notes = "寄存代发入库-批量取消提交")
|
|
|
+ @GetMapping(value = "/returnSubmitBatch")
|
|
|
+ public Result<String> returnSubmitBatch(@RequestParam(name = "ids", required = true) String ids) {
|
|
|
+
|
|
|
+ return storeConsignmentInService.returnSubmitBatch(ids);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id查询
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ //@AutoLog(value = "寄存代发入库主表-通过id查询")
|
|
|
+ @ApiOperation(value = "寄存代发入库主表-通过id查询", notes = "寄存代发入库主表-通过id查询")
|
|
|
+ @GetMapping(value = "/queryById")
|
|
|
+ public Result<StoreConsignmentIn> queryById(@RequestParam(name = "id", required = true) String id) {
|
|
|
+ StoreConsignmentIn storeConsignmentIn = storeConsignmentInService.getById(id);
|
|
|
+ if (storeConsignmentIn == null) {
|
|
|
+ return Result.error("未找到对应数据");
|
|
|
+ }
|
|
|
+ return Result.OK(storeConsignmentIn);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id查询
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ //@AutoLog(value = "寄存代发入库-子表产品明细通过主表ID查询")
|
|
|
+ @ApiOperation(value = "寄存代发入库-子表产品明细主表ID查询", notes = "寄存代发入库-子表产品明细-通主表ID查询")
|
|
|
+ @GetMapping(value = "/queryStoreConsignmentInDetailsByMainId")
|
|
|
+ public Result<List<StoreConsignmentInDetails>> queryStoreConsignmentInDetailsListByMainId(@RequestParam(name = "id", required = true) String id) {
|
|
|
+ List<StoreConsignmentInDetails> storeConsignmentInDetailsList = storeConsignmentInDetailsService.selectByMainId(id);
|
|
|
+ return Result.OK(storeConsignmentInDetailsList);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
- * 导出excel
|
|
|
- *
|
|
|
- * @param request
|
|
|
- * @param storeConsignmentIn
|
|
|
- */
|
|
|
+ * 通过id查询
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ //@AutoLog(value = "寄存代发入库-子表船明细通过主表ID查询")
|
|
|
+ @ApiOperation(value = "寄存代发入库-子表船明细主表ID查询", notes = "寄存代发入库-子表船明细-通主表ID查询")
|
|
|
+ @GetMapping(value = "/queryStoreConsignmentInShipByMainId")
|
|
|
+ public Result<List<StoreConsignmentInShip>> queryStoreConsignmentInShipListByMainId(@RequestParam(name = "id", required = true) String id) {
|
|
|
+ List<StoreConsignmentInShip> storeConsignmentInShipList = storeConsignmentInShipService.selectByMainId(id);
|
|
|
+ return Result.OK(storeConsignmentInShipList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出excel
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param storeConsignmentIn
|
|
|
+ */
|
|
|
@RequiresPermissions("storeCode:store_consignment_in:exportXls")
|
|
|
@RequestMapping(value = "/exportXls")
|
|
|
public ModelAndView exportXls(HttpServletRequest request, StoreConsignmentIn storeConsignmentIn) {
|
|
|
- // Step.1 组装查询条件查询数据
|
|
|
- QueryWrapper<StoreConsignmentIn> queryWrapper = QueryGenerator.initQueryWrapper(storeConsignmentIn, request.getParameterMap());
|
|
|
- LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
-
|
|
|
- //配置选中数据查询条件
|
|
|
- String selections = request.getParameter("selections");
|
|
|
- if(oConvertUtils.isNotEmpty(selections)) {
|
|
|
- List<String> selectionList = Arrays.asList(selections.split(","));
|
|
|
- queryWrapper.in("id",selectionList);
|
|
|
- }
|
|
|
- //Step.2 获取导出数据
|
|
|
- List<StoreConsignmentIn> storeConsignmentInList = storeConsignmentInService.list(queryWrapper);
|
|
|
-
|
|
|
- // Step.3 组装pageList
|
|
|
- List<StoreConsignmentInPage> pageList = new ArrayList<StoreConsignmentInPage>();
|
|
|
- for (StoreConsignmentIn main : storeConsignmentInList) {
|
|
|
- StoreConsignmentInPage vo = new StoreConsignmentInPage();
|
|
|
- BeanUtils.copyProperties(main, vo);
|
|
|
- List<StoreConsignmentInDetails> storeConsignmentInDetailsList = storeConsignmentInDetailsService.selectByMainId(main.getId());
|
|
|
- vo.setStoreConsignmentInDetailsList(storeConsignmentInDetailsList);
|
|
|
- List<StoreConsignmentInShip> storeConsignmentInShipList = storeConsignmentInShipService.selectByMainId(main.getId());
|
|
|
- vo.setStoreConsignmentInShipList(storeConsignmentInShipList);
|
|
|
- pageList.add(vo);
|
|
|
- }
|
|
|
-
|
|
|
- // Step.4 AutoPoi 导出Excel
|
|
|
- ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
|
|
- mv.addObject(NormalExcelConstants.FILE_NAME, "寄存代发入库主表列表");
|
|
|
- mv.addObject(NormalExcelConstants.CLASS, StoreConsignmentInPage.class);
|
|
|
- mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("寄存代发入库主表数据", "导出人:"+sysUser.getRealname(), "寄存代发入库主表"));
|
|
|
- mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
|
|
- return mv;
|
|
|
+ // Step.1 组装查询条件查询数据
|
|
|
+ QueryWrapper<StoreConsignmentIn> queryWrapper = QueryGenerator.initQueryWrapper(storeConsignmentIn, request.getParameterMap());
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+
|
|
|
+ //配置选中数据查询条件
|
|
|
+ String selections = request.getParameter("selections");
|
|
|
+ if (oConvertUtils.isNotEmpty(selections)) {
|
|
|
+ List<String> selectionList = Arrays.asList(selections.split(","));
|
|
|
+ queryWrapper.in("id", selectionList);
|
|
|
+ }
|
|
|
+ //Step.2 获取导出数据
|
|
|
+ List<StoreConsignmentIn> storeConsignmentInList = storeConsignmentInService.list(queryWrapper);
|
|
|
+
|
|
|
+ // Step.3 组装pageList
|
|
|
+ List<StoreConsignmentInPage> pageList = new ArrayList<StoreConsignmentInPage>();
|
|
|
+ for (StoreConsignmentIn main : storeConsignmentInList) {
|
|
|
+ StoreConsignmentInPage vo = new StoreConsignmentInPage();
|
|
|
+ BeanUtils.copyProperties(main, vo);
|
|
|
+ List<StoreConsignmentInDetails> storeConsignmentInDetailsList = storeConsignmentInDetailsService.selectByMainId(main.getId());
|
|
|
+ vo.setStoreConsignmentInDetailsList(storeConsignmentInDetailsList);
|
|
|
+ List<StoreConsignmentInShip> storeConsignmentInShipList = storeConsignmentInShipService.selectByMainId(main.getId());
|
|
|
+ vo.setStoreConsignmentInShipList(storeConsignmentInShipList);
|
|
|
+ pageList.add(vo);
|
|
|
+ }
|
|
|
+
|
|
|
+ // Step.4 AutoPoi 导出Excel
|
|
|
+ ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
|
|
+ mv.addObject(NormalExcelConstants.FILE_NAME, "寄存代发入库主表列表");
|
|
|
+ mv.addObject(NormalExcelConstants.CLASS, StoreConsignmentInPage.class);
|
|
|
+ mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("寄存代发入库主表数据", "导出人:" + sysUser.getRealname(), "寄存代发入库主表"));
|
|
|
+ mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
|
|
+ return mv;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 通过excel导入数据
|
|
|
- *
|
|
|
- * @param request
|
|
|
- * @param response
|
|
|
- * @return
|
|
|
- */
|
|
|
+ * 通过excel导入数据
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param response
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@RequiresPermissions("storeCode:store_consignment_in:importExcel")
|
|
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
|
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
|
|
- MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
|
|
- Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
|
|
- for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
|
|
- // 获取上传文件对象
|
|
|
- MultipartFile file = entity.getValue();
|
|
|
- ImportParams params = new ImportParams();
|
|
|
- params.setTitleRows(2);
|
|
|
- params.setHeadRows(1);
|
|
|
- params.setNeedSave(true);
|
|
|
- try {
|
|
|
- List<StoreConsignmentInPage> list = ExcelImportUtil.importExcel(file.getInputStream(), StoreConsignmentInPage.class, params);
|
|
|
- for (StoreConsignmentInPage page : list) {
|
|
|
- StoreConsignmentIn po = new StoreConsignmentIn();
|
|
|
- BeanUtils.copyProperties(page, po);
|
|
|
- storeConsignmentInService.saveMain(po, page.getStoreConsignmentInDetailsList(),page.getStoreConsignmentInShipList());
|
|
|
- }
|
|
|
- return Result.OK("文件导入成功!数据行数:" + list.size());
|
|
|
- } catch (Exception e) {
|
|
|
- log.error(e.getMessage(),e);
|
|
|
- return Result.error("文件导入失败:"+e.getMessage());
|
|
|
- } finally {
|
|
|
- try {
|
|
|
- file.getInputStream().close();
|
|
|
- } catch (IOException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return Result.OK("文件导入失败!");
|
|
|
+ MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
|
|
+ Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
|
|
+ for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
|
|
+ // 获取上传文件对象
|
|
|
+ MultipartFile file = entity.getValue();
|
|
|
+ ImportParams params = new ImportParams();
|
|
|
+ params.setTitleRows(2);
|
|
|
+ params.setHeadRows(1);
|
|
|
+ params.setNeedSave(true);
|
|
|
+ try {
|
|
|
+ List<StoreConsignmentInPage> list = ExcelImportUtil.importExcel(file.getInputStream(), StoreConsignmentInPage.class, params);
|
|
|
+ for (StoreConsignmentInPage page : list) {
|
|
|
+ StoreConsignmentIn po = new StoreConsignmentIn();
|
|
|
+ BeanUtils.copyProperties(page, po);
|
|
|
+ storeConsignmentInService.saveMain(po, page.getStoreConsignmentInDetailsList(), page.getStoreConsignmentInShipList());
|
|
|
+ }
|
|
|
+ return Result.OK("文件导入成功!数据行数:" + list.size());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ return Result.error("文件导入失败:" + e.getMessage());
|
|
|
+ } finally {
|
|
|
+ try {
|
|
|
+ file.getInputStream().close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Result.OK("文件导入失败!");
|
|
|
}
|
|
|
|
|
|
}
|