|
@@ -1,6 +1,8 @@
|
|
|
package org.jeecg.modules.billet.billetHotsend.controller;
|
|
|
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
+import com.alibaba.excel.write.metadata.style.WriteCellStyle;
|
|
|
+import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
@@ -10,6 +12,7 @@ import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
+import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
@@ -40,61 +43,62 @@ import java.time.ZoneId;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
-* @Description: 钢坯热送基础信息
|
|
|
-* @Author: jeecg-boot
|
|
|
-* @Date: 2024-04-29
|
|
|
-* @Version: V1.0
|
|
|
-*/
|
|
|
-@Api(tags="钢坯热送基础信息")
|
|
|
+ * @Description: 钢坯热送基础信息
|
|
|
+ * @Author: jeecg-boot
|
|
|
+ * @Date: 2024-04-29
|
|
|
+ * @Version: V1.0
|
|
|
+ */
|
|
|
+@Api(tags = "钢坯热送基础信息")
|
|
|
@RestController
|
|
|
@RequestMapping("/billetHotsendBase/billetHotsendBase")
|
|
|
@Slf4j
|
|
|
public class BilletHotsendBaseController extends JeecgController<BilletHotsend, IBilletHotsendBaseService> {
|
|
|
- @Autowired
|
|
|
- private IBilletHotsendBaseService billetHotsendBaseService;
|
|
|
+ @Autowired
|
|
|
+ private IBilletHotsendBaseService billetHotsendBaseService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private IOperateLogService operateLogService;
|
|
|
+ @Autowired
|
|
|
+ private IOperateLogService operateLogService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private IBilletBasicInfoService billetBasicInfoService;
|
|
|
+ @Autowired
|
|
|
+ private IBilletBasicInfoService billetBasicInfoService;
|
|
|
|
|
|
@Autowired
|
|
|
private ISysDictService sysDictService;
|
|
|
|
|
|
- /**
|
|
|
- * 分页列表查询
|
|
|
- *
|
|
|
- * @param billetHotsend
|
|
|
- * @param pageNo
|
|
|
- * @param pageSize
|
|
|
- * @param req
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "钢坯热送基础信息-分页列表查询")
|
|
|
- @ApiOperation(value="钢坯热送基础信息-分页列表查询", notes="钢坯热送基础信息-分页列表查询")
|
|
|
- @GetMapping(value = "/list")
|
|
|
- public Result<?> queryPageList(BilletHotsend billetHotsend,
|
|
|
- @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
- @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
- HttpServletRequest req) {
|
|
|
- QueryWrapper<BilletHotsend> queryWrapper = QueryGenerator.initQueryWrapper(billetHotsend, req.getParameterMap());
|
|
|
- Page<BilletHotsend> page = new Page<BilletHotsend>(pageNo, pageSize);
|
|
|
- IPage<BilletHotsend> pageList = billetHotsendBaseService.page(page, queryWrapper);
|
|
|
- return Result.OK(pageList);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 添加
|
|
|
- *
|
|
|
- * @param billetHotsendBasePage
|
|
|
- * @return
|
|
|
- */
|
|
|
+ /**
|
|
|
+ * 分页列表查询
|
|
|
+ *
|
|
|
+ * @param billetHotsend
|
|
|
+ * @param pageNo
|
|
|
+ * @param pageSize
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "钢坯热送基础信息-分页列表查询")
|
|
|
+ @ApiOperation(value = "钢坯热送基础信息-分页列表查询", notes = "钢坯热送基础信息-分页列表查询")
|
|
|
+ @GetMapping(value = "/list")
|
|
|
+ public Result<?> queryPageList(BilletHotsend billetHotsend,
|
|
|
+ @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
+ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
+ HttpServletRequest req) {
|
|
|
+ QueryWrapper<BilletHotsend> queryWrapper = QueryGenerator.initQueryWrapper(billetHotsend, req.getParameterMap());
|
|
|
+ Page<BilletHotsend> page = new Page<BilletHotsend>(pageNo, pageSize);
|
|
|
+ IPage<BilletHotsend> pageList = billetHotsendBaseService.page(page, queryWrapper);
|
|
|
+ return Result.OK(pageList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加
|
|
|
+ *
|
|
|
+ * @param billetHotsendBasePage
|
|
|
+ * @return
|
|
|
+ */
|
|
|
// @AutoLog(value = "钢坯热送基础信息-添加")
|
|
|
// @ApiOperation(value="钢坯热送基础信息-添加", notes="钢坯热送基础信息-添加")
|
|
|
// @PostMapping(value = "/add")
|
|
@@ -106,36 +110,35 @@ public class BilletHotsendBaseController extends JeecgController<BilletHotsend,
|
|
|
// }
|
|
|
|
|
|
/**
|
|
|
- * 添加
|
|
|
- *
|
|
|
+ * 添加
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
@AutoLog(value = "钢坯热送基础信息-添加")
|
|
|
- @ApiOperation(value="钢坯热送基础信息-添加", notes="钢坯热送基础信息-添加")
|
|
|
+ @ApiOperation(value = "钢坯热送基础信息-添加", notes = "钢坯热送基础信息-添加")
|
|
|
@PostMapping(value = "/add")
|
|
|
public Result<?> add(@RequestBody BilletHotsendDetailsVo billetHotsendDetailsVo) {
|
|
|
JSONObject jsonObject = billetHotsendBaseService.saveBilletHotsendDetails(billetHotsendDetailsVo);
|
|
|
- if (jsonObject.containsKey("fail")){
|
|
|
+ if (jsonObject.containsKey("fail")) {
|
|
|
return Result.OK((String) jsonObject.get("fail"));
|
|
|
}
|
|
|
return Result.OK((String) jsonObject.get("success"));
|
|
|
}
|
|
|
|
|
|
@AutoLog(value = "新增钢坯热送基础信息")
|
|
|
- @ApiOperation(value="新增钢坯热送基础信息", notes="新增钢坯热送基础信息")
|
|
|
+ @ApiOperation(value = "新增钢坯热送基础信息", notes = "新增钢坯热送基础信息")
|
|
|
@PostMapping(value = "/addBilletHotsendInfo")
|
|
|
public Result<?> addBilletHotsend(@RequestBody BilletHotsendDetailsVo billetHotsendDetailsVo) {
|
|
|
LambdaQueryWrapper<BilletBasicInfo> queryWrapperBB = new LambdaQueryWrapper<BilletBasicInfo>()
|
|
|
.eq(BilletBasicInfo::getCcmNo, Integer.valueOf(billetHotsendDetailsVo.getBilletHotsend().getCcmNo()))
|
|
|
.eq(BilletBasicInfo::getHeatNo, billetHotsendDetailsVo.getBilletHotsend().getHeatNo());
|
|
|
List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapperBB);
|
|
|
- if (oConvertUtils.listIsEmpty(billetBasicInfoList)){
|
|
|
+ if (oConvertUtils.listIsEmpty(billetBasicInfoList)) {
|
|
|
return Result.error("炉次信息不存在,新增失败!");
|
|
|
}
|
|
|
// 根据铸机号、炉号查询热送单信息是否存在
|
|
|
JSONObject jsonObject = billetHotsendBaseService.addBilletHotsendInfo(billetHotsendDetailsVo);
|
|
|
- if (jsonObject.containsKey("fail")){
|
|
|
+ if (jsonObject.containsKey("fail")) {
|
|
|
return Result.OK((String) jsonObject.get("fail"));
|
|
|
}
|
|
|
return Result.OK((String) jsonObject.get("success"));
|
|
@@ -143,17 +146,16 @@ public class BilletHotsendBaseController extends JeecgController<BilletHotsend,
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * 添加
|
|
|
- *
|
|
|
+ * 添加
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
@AutoLog(value = "钢坯棒线发车")
|
|
|
- @ApiOperation(value="钢坯棒线发车", notes="钢坯棒线发车")
|
|
|
+ @ApiOperation(value = "钢坯棒线发车", notes = "钢坯棒线发车")
|
|
|
@PostMapping(value = "/rodLineDepart")
|
|
|
public Result<?> adds(@RequestBody BilletHotsendDetailsVo billetHotsendDetailsVo) {
|
|
|
JSONObject jsonObject = billetHotsendBaseService.saveBilletHotsendDetailsCar(billetHotsendDetailsVo);
|
|
|
- if (jsonObject.containsKey("fail")){
|
|
|
+ if (jsonObject.containsKey("fail")) {
|
|
|
return Result.OK((String) jsonObject.get("fail"));
|
|
|
}
|
|
|
return Result.OK((String) jsonObject.get("success"));
|
|
@@ -161,108 +163,107 @@ public class BilletHotsendBaseController extends JeecgController<BilletHotsend,
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * 编辑
|
|
|
+ * 编辑
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
@AutoLog(value = "钢坯热送附加信息-编辑")
|
|
|
- @ApiOperation(value="钢坯热送附加信息-编辑", notes="钢坯热送附加信息-编辑")
|
|
|
+ @ApiOperation(value = "钢坯热送附加信息-编辑", notes = "钢坯热送附加信息-编辑")
|
|
|
@PutMapping(value = "/editDesc")
|
|
|
public Result<?> editDesc(@RequestBody BilletHotsend billetHotsend) {
|
|
|
billetHotsendBaseService.updateById(billetHotsend);
|
|
|
- operateLogService.add(billetHotsendBaseService.getById(billetHotsend.getId()),billetHotsend,BilletHotsend.class);
|
|
|
+ operateLogService.add(billetHotsendBaseService.getById(billetHotsend.getId()), billetHotsend, BilletHotsend.class);
|
|
|
return Result.OK("编辑成功!");
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 通过id删除
|
|
|
- *
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "钢坯热送基础信息-通过id删除")
|
|
|
- @ApiOperation(value="钢坯热送基础信息-通过id删除", notes="钢坯热送基础信息-通过id删除")
|
|
|
- @DeleteMapping(value = "/delete")
|
|
|
- public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
|
|
- billetHotsendBaseService.removeById(id);
|
|
|
- return Result.OK("删除成功!");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 批量删除
|
|
|
- *
|
|
|
- * @param ids
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "钢坯热送基础信息-批量删除")
|
|
|
- @ApiOperation(value="钢坯热送基础信息-批量删除", notes="钢坯热送基础信息-批量删除")
|
|
|
- @DeleteMapping(value = "/deleteBatch")
|
|
|
- public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
|
|
- this.billetHotsendBaseService.removeBatchByIds(Arrays.asList(ids.split(",")));
|
|
|
- return Result.OK("批量删除成功!");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 通过id查询
|
|
|
- *
|
|
|
- * @param id
|
|
|
- * @return
|
|
|
- */
|
|
|
- @AutoLog(value = "钢坯热送基础信息-通过id查询")
|
|
|
- @ApiOperation(value="钢坯热送基础信息-通过id查询", notes="钢坯热送基础信息-通过id查询")
|
|
|
- @GetMapping(value = "/queryById")
|
|
|
- public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
|
|
- BilletHotsend billetHotsend = billetHotsendBaseService.getById(id);
|
|
|
- if(billetHotsend==null) {
|
|
|
- return Result.error("未找到对应数据");
|
|
|
- }
|
|
|
- return Result.OK(billetHotsend);
|
|
|
-
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 通过id删除
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "钢坯热送基础信息-通过id删除")
|
|
|
+ @ApiOperation(value = "钢坯热送基础信息-通过id删除", notes = "钢坯热送基础信息-通过id删除")
|
|
|
+ @DeleteMapping(value = "/delete")
|
|
|
+ public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
|
|
|
+ billetHotsendBaseService.removeById(id);
|
|
|
+ return Result.OK("删除成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量删除
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "钢坯热送基础信息-批量删除")
|
|
|
+ @ApiOperation(value = "钢坯热送基础信息-批量删除", notes = "钢坯热送基础信息-批量删除")
|
|
|
+ @DeleteMapping(value = "/deleteBatch")
|
|
|
+ public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
|
|
+ this.billetHotsendBaseService.removeBatchByIds(Arrays.asList(ids.split(",")));
|
|
|
+ return Result.OK("批量删除成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id查询
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "钢坯热送基础信息-通过id查询")
|
|
|
+ @ApiOperation(value = "钢坯热送基础信息-通过id查询", notes = "钢坯热送基础信息-通过id查询")
|
|
|
+ @GetMapping(value = "/queryById")
|
|
|
+ public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
|
|
|
+ BilletHotsend billetHotsend = billetHotsendBaseService.getById(id);
|
|
|
+ if (billetHotsend == null) {
|
|
|
+ return Result.error("未找到对应数据");
|
|
|
+ }
|
|
|
+ return Result.OK(billetHotsend);
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
@AutoLog(value = "钢坯热送基础信息-通过铸机和炉号查询")
|
|
|
- @ApiOperation(value="钢坯热送基础信息-通过铸机和炉号查询", notes="钢坯热送基础信息-通过铸机和炉号查询")
|
|
|
+ @ApiOperation(value = "钢坯热送基础信息-通过铸机和炉号查询", notes = "钢坯热送基础信息-通过铸机和炉号查询")
|
|
|
@GetMapping(value = "/queryByCastMachineAndFurnaceNum")
|
|
|
- public Result<?> queryByCastMachineAndFurnaceNum(@RequestParam(name="castMachine") String castMachine,
|
|
|
- @RequestParam(name="furnaceNum") String furnaceNum) {
|
|
|
+ public Result<?> queryByCastMachineAndFurnaceNum(@RequestParam(name = "castMachine") String castMachine,
|
|
|
+ @RequestParam(name = "furnaceNum") String furnaceNum) {
|
|
|
List<BilletHotsend> billetHotsendList = billetHotsendBaseService.queryByCastMachineAndFurnaceNum(castMachine, furnaceNum);
|
|
|
- if(oConvertUtils.listIsNotEmpty(billetHotsendList)) {
|
|
|
+ if (oConvertUtils.listIsNotEmpty(billetHotsendList)) {
|
|
|
return Result.error("该炉号已存在!");
|
|
|
}
|
|
|
return Result.OK(billetHotsendList);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 导出excel
|
|
|
- *
|
|
|
- * @param request
|
|
|
- * @param billetHotsendBase
|
|
|
- */
|
|
|
- @RequestMapping(value = "/exportXls")
|
|
|
- public ModelAndView exportXls(HttpServletRequest request, BilletHotsend billetHotsendBase) {
|
|
|
- return super.exportXls(request, billetHotsendBase, BilletHotsend.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, BilletHotsend.class);
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 导出excel
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param billetHotsendBase
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/exportXls")
|
|
|
+ public ModelAndView exportXls(HttpServletRequest request, BilletHotsend billetHotsendBase) {
|
|
|
+ return super.exportXls(request, billetHotsendBase, BilletHotsend.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, BilletHotsend.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
@AutoLog(value = "钢坯实时信息获取")
|
|
|
- @ApiOperation(value="钢坯实时信息获取", notes="钢坯实时信息获取")
|
|
|
+ @ApiOperation(value = "钢坯实时信息获取", notes = "钢坯实时信息获取")
|
|
|
@PostMapping(value = "/getReal")
|
|
|
public Result<?> getReal() {
|
|
|
RealtimeStats realTimeDate = RealtimeStats.getRealTimeDate("");
|
|
@@ -272,24 +273,25 @@ public class BilletHotsendBaseController extends JeecgController<BilletHotsend,
|
|
|
|
|
|
/**
|
|
|
* 通过铸机、炉号查询结束位
|
|
|
+ *
|
|
|
* @param ccmNo
|
|
|
* @param heatNo
|
|
|
* @param belongTable
|
|
|
* @return
|
|
|
*/
|
|
|
- @ApiOperation(value="钢坯热送单炉支数结束根数-通过铸机号和炉号查询", notes="钢坯热送单炉支数结束根数-通过铸机号和炉号查询")
|
|
|
+ @ApiOperation(value = "钢坯热送单炉支数结束根数-通过铸机号和炉号查询", notes = "钢坯热送单炉支数结束根数-通过铸机号和炉号查询")
|
|
|
@GetMapping(value = "/queryEndNumByCcmNo")
|
|
|
- public Result<Integer> queryEndNumById(@RequestParam(name="ccmNo") String ccmNo,
|
|
|
- @RequestParam(name="heatNo") String heatNo,
|
|
|
- @RequestParam(name="belongTable") String belongTable) {
|
|
|
+ public Result<Integer> queryEndNumById(@RequestParam(name = "ccmNo") String ccmNo,
|
|
|
+ @RequestParam(name = "heatNo") String heatNo,
|
|
|
+ @RequestParam(name = "belongTable") String belongTable) {
|
|
|
Integer endNumStack = billetHotsendBaseService.queryEndNumByCcmNo(ccmNo, heatNo, belongTable);
|
|
|
return Result.OK(endNumStack);
|
|
|
}
|
|
|
|
|
|
@AutoLog(value = "钢坯热送基础信息-通过坯号查询")
|
|
|
- @ApiOperation(value="钢坯热送基础信息-通过坯号查询", notes="钢坯热送基础信息-通过坯号查询")
|
|
|
+ @ApiOperation(value = "钢坯热送基础信息-通过坯号查询", notes = "钢坯热送基础信息-通过坯号查询")
|
|
|
@GetMapping(value = "/queryBilletInfoByBilletNo")
|
|
|
- public Result<?> queryBilletInfoByBilletNo(@RequestParam(name="billetNo") String billetNo) {
|
|
|
+ public Result<?> queryBilletInfoByBilletNo(@RequestParam(name = "billetNo") String billetNo) {
|
|
|
List<BilletBasicInfoDetails> billetHotsendList = billetHotsendBaseService.queryBilletInfoByBilletNo(billetNo);
|
|
|
return Result.OK(billetHotsendList);
|
|
|
}
|
|
@@ -322,31 +324,67 @@ public class BilletHotsendBaseController extends JeecgController<BilletHotsend,
|
|
|
List<BilletHotsend> billetHotsendList = billetHotsendBaseService.list(queryWrapper);
|
|
|
|
|
|
// 构造导出数据列表
|
|
|
- List<BilletHotsendExportDTO> exportList = billetHotsendList.stream().map(item -> {
|
|
|
- BilletHotsendExportDTO dto = new BilletHotsendExportDTO();
|
|
|
- dto.setIndex(index.getAndIncrement());
|
|
|
-
|
|
|
- dto.setCreateTime(item.getCreateTime() != null
|
|
|
- ? item.getCreateTime().toInstant().atZone(zoneId).toLocalDateTime().format(formatter)
|
|
|
- : "");
|
|
|
-
|
|
|
- dto.setHeatNo(item.getHeatNo());
|
|
|
- dto.setShiftGroup(sysDictService.queryDictTextByKey("lg_bz", item.getShiftGroup())); // 班组中文
|
|
|
- dto.setShift(sysDictService.queryDictTextByKey("lg_bb", item.getShift())); // 班别中文
|
|
|
- dto.setSteel(item.getSteel());
|
|
|
- dto.setSpec(item.getSpec());
|
|
|
- dto.setDecideWeight(BigDecimal.valueOf(item.getDecideWeight()));
|
|
|
- dto.setAmountTotal(item.getAmountTotal());
|
|
|
- dto.setBlankOutput(BigDecimal.valueOf(item.getBlankOutput()));
|
|
|
- dto.setStackNum(item.getStackNum());
|
|
|
- dto.setRollcluboneNum(item.getRollcluboneNum());
|
|
|
- dto.setRollclubtwoNum(item.getRollclubtwoNum());
|
|
|
- dto.setRollclubthreeNum(item.getRollclubthreeNum());
|
|
|
- dto.setRollheightNum(item.getRollheightNum());
|
|
|
- dto.setRolloutshippNum(item.getRolloutshippNum());
|
|
|
- dto.setWasteNum(item.getWasteNum());
|
|
|
- return dto;
|
|
|
- }).collect(Collectors.toList());
|
|
|
+ List<BilletHotsendExportDTO> exportList = billetHotsendList.stream()
|
|
|
+ .flatMap(item -> {
|
|
|
+ // 查询该炉号下的所有钢坯基础信息(假设 billetBasicInfoService 有对应方法)
|
|
|
+ List<BilletBasicInfo> basicInfos = billetBasicInfoService.lambdaQuery()
|
|
|
+ .eq(BilletBasicInfo::getHeatNo, item.getHeatNo())
|
|
|
+ .list();
|
|
|
+
|
|
|
+ // 分组统计 size(定尺)出现的数量
|
|
|
+ Map<Integer, Long> sizeCountMap = basicInfos.stream()
|
|
|
+ .filter(info -> {
|
|
|
+ String table = info.getBelongTable();
|
|
|
+ return table != null && !table.isEmpty() && !"billet_auto_tmp".equals(table);
|
|
|
+ })
|
|
|
+ .collect(Collectors.groupingBy(BilletBasicInfo::getLength, Collectors.counting()));
|
|
|
+
|
|
|
+ AtomicInteger localIndex = new AtomicInteger(index.getAndIncrement());
|
|
|
+
|
|
|
+ // 为每个定尺拆分一条导出记录
|
|
|
+ return sizeCountMap.entrySet().stream().map(entry -> {
|
|
|
+ BilletHotsendExportDTO dto = new BilletHotsendExportDTO();
|
|
|
+ dto.setIndex(localIndex.getAndIncrement());
|
|
|
+
|
|
|
+ dto.setCreateTime(item.getCreateTime() != null
|
|
|
+ ? item.getCreateTime().toInstant().atZone(zoneId).toLocalDateTime().format(formatter)
|
|
|
+ : "");
|
|
|
+
|
|
|
+ dto.setHeatNo(item.getHeatNo());
|
|
|
+ dto.setShiftGroup(sysDictService.queryDictTextByKey("lg_bz", item.getShiftGroup()));
|
|
|
+ dto.setShift(sysDictService.queryDictTextByKey("lg_bb", item.getShift()));
|
|
|
+ dto.setSteel(item.getSteel());
|
|
|
+ dto.setSpec(item.getSpec());
|
|
|
+ dto.setDecideWeight(BigDecimal.valueOf(item.getDecideWeight()));
|
|
|
+ dto.setAmountTotal(item.getAmountTotal());
|
|
|
+ dto.setBlankOutput(BigDecimal.valueOf(item.getBlankOutput()));
|
|
|
+ dto.setStackNum(item.getStackNum());
|
|
|
+ dto.setRollcluboneNum(item.getRollcluboneNum());
|
|
|
+ dto.setRollclubtwoNum(item.getRollclubtwoNum());
|
|
|
+ dto.setRollclubthreeNum(item.getRollclubthreeNum());
|
|
|
+ dto.setRollheightNum(item.getRollheightNum());
|
|
|
+ dto.setRolloutshippNum(item.getRolloutshippNum());
|
|
|
+ dto.setWasteNum(item.getWasteNum());
|
|
|
+
|
|
|
+ // 设置定尺和对应数量
|
|
|
+ BigDecimal result = BigDecimal.valueOf(entry.getKey()).divide(BigDecimal.valueOf(1000));
|
|
|
+ dto.setSize(result.toPlainString()); // 定尺
|
|
|
+ dto.setSizeAmount(entry.getValue().intValue()); // 数量
|
|
|
+
|
|
|
+ return dto;
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+
|
|
|
+ // 设置右对齐样式
|
|
|
+ WriteCellStyle headStyle = new WriteCellStyle(); // 表头样式(可不设置对齐)
|
|
|
+
|
|
|
+ WriteCellStyle contentStyle = new WriteCellStyle(); // 内容样式
|
|
|
+ contentStyle.setHorizontalAlignment(HorizontalAlignment.RIGHT); // 右对齐
|
|
|
+
|
|
|
+ // 创建样式策略
|
|
|
+ HorizontalCellStyleStrategy styleStrategy = new HorizontalCellStyleStrategy(headStyle, contentStyle);
|
|
|
|
|
|
// 设置响应头
|
|
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
|
@@ -354,11 +392,12 @@ public class BilletHotsendBaseController extends JeecgController<BilletHotsend,
|
|
|
String fileName = URLEncoder.encode("钢坯热送信息导出", StandardCharsets.UTF_8.toString()).replaceAll("\\+", "%20");
|
|
|
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
|
|
|
|
|
- // 导出数据
|
|
|
+ // 导出数据并应用样式
|
|
|
EasyExcel.write(response.getOutputStream(), BilletHotsendExportDTO.class)
|
|
|
+ .registerWriteHandler(styleStrategy) // 注册样式处理器
|
|
|
.sheet("钢坯热送数据")
|
|
|
.doWrite(exportList);
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
}
|