|
@@ -1,5 +1,6 @@
|
|
|
package org.jeecg.modules.actualControl.billetActual.billetActual.controller;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -11,10 +12,16 @@ import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
|
+import org.jeecg.common.util.oConvertUtils;
|
|
|
+import org.jeecg.modules.actualControl.billetActual.billetActual.dto.StorageBillConfirmDTO;
|
|
|
import org.jeecg.modules.actualControl.billetActual.billetActual.entity.ShippingPushRecord;
|
|
|
import org.jeecg.modules.actualControl.billetActual.billetActual.service.IShippingPushRecordService;
|
|
|
import org.jeecg.modules.actualControl.billetActual.billetActual.vo.BilletPushResponse;
|
|
|
import org.jeecg.modules.actualControl.billetActual.billetActual.vo.ShippingOrderVO;
|
|
|
+import org.jeecg.modules.billet.storageBill.entity.StorageBill;
|
|
|
+import org.jeecg.modules.billet.storageBill.entity.StorageBillPrint;
|
|
|
+import org.jeecg.modules.billet.storageBill.service.IStorageBillPrintService;
|
|
|
+import org.jeecg.modules.billet.storageBill.service.IStorageBillService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
@@ -24,126 +31,133 @@ import org.springframework.web.servlet.ModelAndView;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.util.Arrays;
|
|
|
+import java.util.Collections;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.Optional;
|
|
|
|
|
|
- /**
|
|
|
+/**
|
|
|
* @Description: 装运单推送记录表
|
|
|
* @Author: jeecg-boot
|
|
|
- * @Date: 2025-07-22
|
|
|
+ * @Date: 2025-07-22
|
|
|
* @Version: V1.0
|
|
|
*/
|
|
|
-@Api(tags="装运单推送记录表")
|
|
|
+@Api(tags = "装运单推送记录表")
|
|
|
@RestController
|
|
|
@RequestMapping("/actualControl/shippingPushRecord")
|
|
|
@Slf4j
|
|
|
public class ShippingPushRecordController extends JeecgController<ShippingPushRecord, IShippingPushRecordService> {
|
|
|
- @Autowired
|
|
|
- private IShippingPushRecordService shippingPushRecordService;
|
|
|
-
|
|
|
- /**
|
|
|
- * 分页列表查询
|
|
|
- *
|
|
|
- * @param shippingPushRecord
|
|
|
- * @param pageNo
|
|
|
- * @param pageSize
|
|
|
- * @param req
|
|
|
- * @return
|
|
|
- */
|
|
|
- //@AutoLog(value = "装运单推送记录表-分页列表查询")
|
|
|
- @ApiOperation(value="装运单推送记录表-分页列表查询", notes="装运单推送记录表-分页列表查询")
|
|
|
- @GetMapping(value = "/list")
|
|
|
- public Result<IPage<ShippingPushRecord>> queryPageList(ShippingPushRecord shippingPushRecord,
|
|
|
- @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
- @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
- HttpServletRequest req) {
|
|
|
- QueryWrapper<ShippingPushRecord> queryWrapper = QueryGenerator.initQueryWrapper(shippingPushRecord, req.getParameterMap());
|
|
|
- Page<ShippingPushRecord> page = new Page<ShippingPushRecord>(pageNo, pageSize);
|
|
|
- IPage<ShippingPushRecord> pageList = shippingPushRecordService.page(page, queryWrapper);
|
|
|
- return Result.OK(pageList);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 添加
|
|
|
- *
|
|
|
- * @param shippingPushRecord
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "装运单推送记录表-添加")
|
|
|
- @ApiOperation(value="装运单推送记录表-添加", notes="装运单推送记录表-添加")
|
|
|
- @RequiresPermissions("actualControl:shipping_push_record:add")
|
|
|
- @PostMapping(value = "/add")
|
|
|
- public Result<String> add(@RequestBody ShippingPushRecord shippingPushRecord) {
|
|
|
- shippingPushRecordService.save(shippingPushRecord);
|
|
|
- return Result.OK("添加成功!");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 编辑
|
|
|
- *
|
|
|
- * @param shippingPushRecord
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "装运单推送记录表-编辑")
|
|
|
- @ApiOperation(value="装运单推送记录表-编辑", notes="装运单推送记录表-编辑")
|
|
|
- @RequiresPermissions("actualControl:shipping_push_record:edit")
|
|
|
- @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
|
- public Result<String> edit(@RequestBody ShippingPushRecord shippingPushRecord) {
|
|
|
- shippingPushRecordService.updateById(shippingPushRecord);
|
|
|
- return Result.OK("编辑成功!");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 通过id删除
|
|
|
- *
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "装运单推送记录表-通过id删除")
|
|
|
- @ApiOperation(value="装运单推送记录表-通过id删除", notes="装运单推送记录表-通过id删除")
|
|
|
- @RequiresPermissions("actualControl:shipping_push_record:delete")
|
|
|
- @DeleteMapping(value = "/delete")
|
|
|
- public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
|
|
- shippingPushRecordService.removeById(id);
|
|
|
- return Result.OK("删除成功!");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 批量删除
|
|
|
- *
|
|
|
- * @param ids
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "装运单推送记录表-批量删除")
|
|
|
- @ApiOperation(value="装运单推送记录表-批量删除", notes="装运单推送记录表-批量删除")
|
|
|
- @RequiresPermissions("actualControl:shipping_push_record:deleteBatch")
|
|
|
- @DeleteMapping(value = "/deleteBatch")
|
|
|
- public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
|
|
- this.shippingPushRecordService.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<ShippingPushRecord> queryById(@RequestParam(name="id",required=true) String id) {
|
|
|
- ShippingPushRecord shippingPushRecord = shippingPushRecordService.getById(id);
|
|
|
- if(shippingPushRecord==null) {
|
|
|
- return Result.error("未找到对应数据");
|
|
|
- }
|
|
|
- return Result.OK(shippingPushRecord);
|
|
|
- }
|
|
|
+ @Autowired
|
|
|
+ private IShippingPushRecordService shippingPushRecordService;
|
|
|
+ @Autowired
|
|
|
+ private IStorageBillService storageBillService;
|
|
|
+ @Autowired
|
|
|
+ private IStorageBillPrintService storageBillPrintService;
|
|
|
|
|
|
/**
|
|
|
- * 导出excel
|
|
|
- *
|
|
|
- * @param request
|
|
|
- * @param shippingPushRecord
|
|
|
- */
|
|
|
+ * 分页列表查询
|
|
|
+ *
|
|
|
+ * @param shippingPushRecord
|
|
|
+ * @param pageNo
|
|
|
+ * @param pageSize
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ //@AutoLog(value = "装运单推送记录表-分页列表查询")
|
|
|
+ @ApiOperation(value = "装运单推送记录表-分页列表查询", notes = "装运单推送记录表-分页列表查询")
|
|
|
+ @GetMapping(value = "/list")
|
|
|
+ public Result<IPage<ShippingPushRecord>> queryPageList(ShippingPushRecord shippingPushRecord,
|
|
|
+ @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
+ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
+ HttpServletRequest req) {
|
|
|
+ QueryWrapper<ShippingPushRecord> queryWrapper = QueryGenerator.initQueryWrapper(shippingPushRecord, req.getParameterMap());
|
|
|
+ Page<ShippingPushRecord> page = new Page<ShippingPushRecord>(pageNo, pageSize);
|
|
|
+ IPage<ShippingPushRecord> pageList = shippingPushRecordService.page(page, queryWrapper);
|
|
|
+ return Result.OK(pageList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加
|
|
|
+ *
|
|
|
+ * @param shippingPushRecord
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "装运单推送记录表-添加")
|
|
|
+ @ApiOperation(value = "装运单推送记录表-添加", notes = "装运单推送记录表-添加")
|
|
|
+ @RequiresPermissions("actualControl:shipping_push_record:add")
|
|
|
+ @PostMapping(value = "/add")
|
|
|
+ public Result<String> add(@RequestBody ShippingPushRecord shippingPushRecord) {
|
|
|
+ shippingPushRecordService.save(shippingPushRecord);
|
|
|
+ return Result.OK("添加成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 编辑
|
|
|
+ *
|
|
|
+ * @param shippingPushRecord
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "装运单推送记录表-编辑")
|
|
|
+ @ApiOperation(value = "装运单推送记录表-编辑", notes = "装运单推送记录表-编辑")
|
|
|
+ @RequiresPermissions("actualControl:shipping_push_record:edit")
|
|
|
+ @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
|
|
+ public Result<String> edit(@RequestBody ShippingPushRecord shippingPushRecord) {
|
|
|
+ shippingPushRecordService.updateById(shippingPushRecord);
|
|
|
+ return Result.OK("编辑成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id删除
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "装运单推送记录表-通过id删除")
|
|
|
+ @ApiOperation(value = "装运单推送记录表-通过id删除", notes = "装运单推送记录表-通过id删除")
|
|
|
+ @RequiresPermissions("actualControl:shipping_push_record:delete")
|
|
|
+ @DeleteMapping(value = "/delete")
|
|
|
+ public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
|
|
+ shippingPushRecordService.removeById(id);
|
|
|
+ return Result.OK("删除成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量删除
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "装运单推送记录表-批量删除")
|
|
|
+ @ApiOperation(value = "装运单推送记录表-批量删除", notes = "装运单推送记录表-批量删除")
|
|
|
+ @RequiresPermissions("actualControl:shipping_push_record:deleteBatch")
|
|
|
+ @DeleteMapping(value = "/deleteBatch")
|
|
|
+ public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
|
|
+ this.shippingPushRecordService.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<ShippingPushRecord> queryById(@RequestParam(name = "id", required = true) String id) {
|
|
|
+ ShippingPushRecord shippingPushRecord = shippingPushRecordService.getById(id);
|
|
|
+ if (shippingPushRecord == null) {
|
|
|
+ return Result.error("未找到对应数据");
|
|
|
+ }
|
|
|
+ return Result.OK(shippingPushRecord);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出excel
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param shippingPushRecord
|
|
|
+ */
|
|
|
@RequiresPermissions("actualControl:shipping_push_record:exportXls")
|
|
|
@RequestMapping(value = "/exportXls")
|
|
|
public ModelAndView exportXls(HttpServletRequest request, ShippingPushRecord shippingPushRecord) {
|
|
@@ -151,39 +165,102 @@ public class ShippingPushRecordController extends JeecgController<ShippingPushRe
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 通过excel导入数据
|
|
|
- *
|
|
|
- * @param request
|
|
|
- * @param response
|
|
|
- * @return
|
|
|
- */
|
|
|
+ * 通过excel导入数据
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param response
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@RequiresPermissions("actualControl:shipping_push_record:importExcel")
|
|
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
|
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
|
|
return super.importExcel(request, response, ShippingPushRecord.class);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "铸坯装运单接收接口测试", notes = "铸坯装运单接收接口测试")
|
|
|
- @PostMapping("/receiveShippingOrder")
|
|
|
- public ResponseEntity<BilletPushResponse> receiveShippingOrder(@RequestBody ShippingOrderVO request) {
|
|
|
- // 处理接收到的请求
|
|
|
- // 你可以在这里记录日志、进行数据验证、发送消息等
|
|
|
- try {
|
|
|
- // 假设处理成功,返回响应
|
|
|
- BilletPushResponse response = new BilletPushResponse();
|
|
|
- response.setCode(200); // 你可以根据实际情况设置响应码
|
|
|
- response.setMsg("成功");
|
|
|
-
|
|
|
- // 记录请求的日志等
|
|
|
- // 你可以根据需要将请求保存到数据库中
|
|
|
-
|
|
|
- return ResponseEntity.ok(response);
|
|
|
- } catch (Exception e) {
|
|
|
- BilletPushResponse errorResponse = new BilletPushResponse();
|
|
|
- errorResponse.setCode(500);
|
|
|
- errorResponse.setMsg("处理失败: " + e.getMessage());
|
|
|
- return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(errorResponse);
|
|
|
- }
|
|
|
- }
|
|
|
+ @ApiOperation(value = "铸坯装运单接收接口测试", notes = "铸坯装运单接收接口测试")
|
|
|
+ @PostMapping("/receiveShippingOrder")
|
|
|
+ public ResponseEntity<BilletPushResponse> receiveShippingOrder(@RequestBody ShippingOrderVO request) {
|
|
|
+ // 处理接收到的请求
|
|
|
+ // 你可以在这里记录日志、进行数据验证、发送消息等
|
|
|
+ try {
|
|
|
+ // 假设处理成功,返回响应
|
|
|
+ BilletPushResponse response = new BilletPushResponse();
|
|
|
+ response.setCode(200); // 你可以根据实际情况设置响应码
|
|
|
+ response.setMsg("成功");
|
|
|
|
|
|
+ // 记录请求的日志等
|
|
|
+ // 你可以根据需要将请求保存到数据库中
|
|
|
+
|
|
|
+ return ResponseEntity.ok(response);
|
|
|
+ } catch (Exception e) {
|
|
|
+ BilletPushResponse errorResponse = new BilletPushResponse();
|
|
|
+ errorResponse.setCode(500);
|
|
|
+ errorResponse.setMsg("处理失败: " + e.getMessage());
|
|
|
+ return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(errorResponse);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 编辑
|
|
|
+ *
|
|
|
+ * @param confirmDTO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "装运单确认")
|
|
|
+ @ApiOperation(value = "装运单确认", notes = "装运单确认")
|
|
|
+ @PostMapping("/confirmShippingOrder")
|
|
|
+ public Result<String> confirmShippingOrder(@RequestBody StorageBillConfirmDTO confirmDTO) {
|
|
|
+
|
|
|
+ if (oConvertUtils.isEmpty(confirmDTO.getShippingOrder())) {
|
|
|
+ return Result.error("装运单号不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ LambdaQueryWrapper<StorageBill> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+
|
|
|
+ queryWrapper.eq(StorageBill::getUniqueCode, confirmDTO.getShippingOrder())
|
|
|
+ .orderByDesc(StorageBill::getCreateTime)
|
|
|
+ .last("LIMIT 1");
|
|
|
+ StorageBill storageBill = storageBillService.getOne(queryWrapper);
|
|
|
+ if (storageBill == null) {
|
|
|
+ return Result.error("未找到对应装运单数据");
|
|
|
+ }
|
|
|
+ Date now = new Date();
|
|
|
+
|
|
|
+ // 同步修改装运单storageBill 确认时间
|
|
|
+ storageBill.setConfirmTime(now);
|
|
|
+ storageBill.setConfirmBy("轧钢一体化平台");
|
|
|
+ storageBill.setRemark("装运单确认无误!");
|
|
|
+
|
|
|
+ storageBillService.updateById(storageBill);
|
|
|
+
|
|
|
+ LambdaQueryWrapper<StorageBillPrint> printQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+
|
|
|
+ printQueryWrapper.eq(StorageBillPrint::getStorageBillId, storageBill.getId())
|
|
|
+ .orderByDesc(StorageBillPrint::getCreateTime)
|
|
|
+ .last("LIMIT 1");
|
|
|
+ StorageBillPrint storageBillPrint = storageBillPrintService.getOne(printQueryWrapper);
|
|
|
+ if (oConvertUtils.isNotEmpty(storageBillPrint)) {
|
|
|
+ storageBillPrint.setConfirmBy("轧钢一体化平台");
|
|
|
+ // 修改确认时间
|
|
|
+ storageBillPrint.setConfirmTime(now);
|
|
|
+ storageBillPrint.setRemark("装运单确认无误!");
|
|
|
+ // 清空撤回状态
|
|
|
+ storageBillPrint.setWithdrawStatus(0);
|
|
|
+ storageBillPrintService.updateById(storageBillPrint);
|
|
|
+ }
|
|
|
+
|
|
|
+ LambdaQueryWrapper<ShippingPushRecord> recordQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+
|
|
|
+ recordQueryWrapper.eq(ShippingPushRecord::getShippingOrder, confirmDTO.getShippingOrder());
|
|
|
+
|
|
|
+ Optional.ofNullable(shippingPushRecordService.list(recordQueryWrapper))
|
|
|
+ .orElse(Collections.emptyList())
|
|
|
+ .forEach(record -> {
|
|
|
+ record.setConfirmStatus(1);
|
|
|
+ shippingPushRecordService.updateById(record);
|
|
|
+ });
|
|
|
+
|
|
|
+ return Result.OK("装运单确认成功!");
|
|
|
+ }
|
|
|
}
|