mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-14 13:42:07 +08:00
文件导入新改
This commit is contained in:
+119
-40
@@ -153,6 +153,7 @@ public class OrderController {
|
|||||||
List<OrderBodyRespVO> orderBodyMap = orderService.getOrderBody(orderId);
|
List<OrderBodyRespVO> orderBodyMap = orderService.getOrderBody(orderId);
|
||||||
return success(orderBodyMap);
|
return success(orderBodyMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get-roomToString")
|
@GetMapping("/get-roomToString")
|
||||||
@Operation(summary = "生产单详情-房间和柜体id(toString)")
|
@Operation(summary = "生产单详情-房间和柜体id(toString)")
|
||||||
@Parameter(name = "orderId", description = "生产单编号", required = true, example = "1024")
|
@Parameter(name = "orderId", description = "生产单编号", required = true, example = "1024")
|
||||||
@@ -199,6 +200,7 @@ public class OrderController {
|
|||||||
List<OrderPlatesDetailReqVO> moduleDOList = orderService.getPlatesDetail(orderId, roomId, bodyId, groupId, groupName);
|
List<OrderPlatesDetailReqVO> moduleDOList = orderService.getPlatesDetail(orderId, roomId, bodyId, groupId, groupName);
|
||||||
return success(moduleDOList);
|
return success(moduleDOList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get-platesDetailsPage")
|
@GetMapping("/get-platesDetailsPage")
|
||||||
@Operation(summary = "生产单详情-板材详细信息(分页)")
|
@Operation(summary = "生产单详情-板材详细信息(分页)")
|
||||||
@Parameters({
|
@Parameters({
|
||||||
@@ -209,7 +211,6 @@ public class OrderController {
|
|||||||
@Parameter(name = "groupName", description = "加工组名称", example = "弧形"),
|
@Parameter(name = "groupName", description = "加工组名称", example = "弧形"),
|
||||||
@Parameter(name = "pageNo", description = "第几页", example = "1"),
|
@Parameter(name = "pageNo", description = "第几页", example = "1"),
|
||||||
@Parameter(name = "pageSize", description = "条数", example = "10")
|
@Parameter(name = "pageSize", description = "条数", example = "10")
|
||||||
|
|
||||||
})
|
})
|
||||||
@PreAuthorize("@ss.hasPermission('production:manager-list:detail')")
|
@PreAuthorize("@ss.hasPermission('production:manager-list:detail')")
|
||||||
public CommonResult<PageResult<OrderPlatesDetailReqVO>> platesDetails(@RequestParam("orderId") Long orderId,
|
public CommonResult<PageResult<OrderPlatesDetailReqVO>> platesDetails(@RequestParam("orderId") Long orderId,
|
||||||
@@ -222,6 +223,7 @@ public class OrderController {
|
|||||||
PageResult<OrderPlatesDetailReqVO> moduleDOList = orderService.getPlatesDetail(orderId, roomId, bodyId, groupId, groupName, pageNo, pageSize);
|
PageResult<OrderPlatesDetailReqVO> moduleDOList = orderService.getPlatesDetail(orderId, roomId, bodyId, groupId, groupName, pageNo, pageSize);
|
||||||
return success(moduleDOList);
|
return success(moduleDOList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get-partsDetails")
|
@GetMapping("/get-partsDetails")
|
||||||
@Operation(summary = "生产单详情-配件详细信息")
|
@Operation(summary = "生产单详情-配件详细信息")
|
||||||
@Parameters({
|
@Parameters({
|
||||||
@@ -238,6 +240,7 @@ public class OrderController {
|
|||||||
List<OrderPartsRespVO> moduleDOList = orderService.getPartsDetail(orderId, roomId, bodyId, name);
|
List<OrderPartsRespVO> moduleDOList = orderService.getPartsDetail(orderId, roomId, bodyId, name);
|
||||||
return success(moduleDOList);
|
return success(moduleDOList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get-partsDetailsPage")
|
@GetMapping("/get-partsDetailsPage")
|
||||||
@Operation(summary = "生产单详情-配件详细信息(分页)")
|
@Operation(summary = "生产单详情-配件详细信息(分页)")
|
||||||
@Parameters({
|
@Parameters({
|
||||||
@@ -258,6 +261,7 @@ public class OrderController {
|
|||||||
PageResult<OrderPartsRespVO> moduleDOList = orderService.getPartsDetail(orderId, roomId, bodyId, name, pageNo, pageSize);
|
PageResult<OrderPartsRespVO> moduleDOList = orderService.getPartsDetail(orderId, roomId, bodyId, name, pageNo, pageSize);
|
||||||
return success(moduleDOList);
|
return success(moduleDOList);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 柜体数据获取,需要加上柜体的属性
|
// 柜体数据获取,需要加上柜体的属性
|
||||||
@GetMapping("/get-body")
|
@GetMapping("/get-body")
|
||||||
@Operation(summary = "生产单柜体数据获取")
|
@Operation(summary = "生产单柜体数据获取")
|
||||||
@@ -319,7 +323,6 @@ public class OrderController {
|
|||||||
// 读取文件
|
// 读取文件
|
||||||
excelReadUtil.setErr(0);
|
excelReadUtil.setErr(0);
|
||||||
Map<String, Object> map = excelReadUtil.read(file);
|
Map<String, Object> map = excelReadUtil.read(file);
|
||||||
// System.out.println(" map " + map);
|
|
||||||
System.err.println(excelReadUtil.isErr());
|
System.err.println(excelReadUtil.isErr());
|
||||||
// 判断是否读取有误
|
// 判断是否读取有误
|
||||||
if (excelReadUtil.isErr() == -1) { // 文件为空
|
if (excelReadUtil.isErr() == -1) { // 文件为空
|
||||||
@@ -352,7 +355,70 @@ public class OrderController {
|
|||||||
} else if (type == 2) { // xml
|
} else if (type == 2) { // xml
|
||||||
|
|
||||||
}
|
}
|
||||||
orderService.importExcelData(orderDO, list);
|
orderService.importExcelData(orderDO, list, 0);
|
||||||
|
} catch (Exception e) {
|
||||||
|
ExcelWriterUtil.writeErr(response, "系统出现未知错误,请下载模板,按照模板重新上传文件", orderService.getSavePath() + File.separator + "order_err.xlsx");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/importFileAdd")
|
||||||
|
@Operation(summary = "生产单文件导入新增/导入板材")
|
||||||
|
@Parameters({
|
||||||
|
@Parameter(name = "file", description = "文件", required = true),
|
||||||
|
@Parameter(name = "type", description = "文件类型", required = true),
|
||||||
|
@Parameter(name = "index", description = "导入范围 0:全部,1:板材,默认为全部", required = false),
|
||||||
|
@Parameter(name = "id", description = "生产单id", required = false)
|
||||||
|
})
|
||||||
|
@OperateLog(type = IMPORT)
|
||||||
|
@PreAuthorize("@ss.hasPermission('production:manager-list:create')")
|
||||||
|
public void exportTestTwo(@RequestPart("file") MultipartFile file,
|
||||||
|
@RequestParam(value = "type") Integer type,
|
||||||
|
@RequestParam(value = "index", required = false, defaultValue = "0") Integer index,
|
||||||
|
@RequestParam(value = "id", required = false, defaultValue = "0") Long orderId,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
try {
|
||||||
|
List<?> list = null;
|
||||||
|
OrderDO orderDO = new OrderDO();
|
||||||
|
|
||||||
|
if (type == 0) { //excel
|
||||||
|
// 读取文件
|
||||||
|
excelReadUtil.setErr(0);
|
||||||
|
Map<String, Object> map = excelReadUtil.read(file);
|
||||||
|
System.out.println(" map + " + map);
|
||||||
|
// 判断是否读取有误
|
||||||
|
if (excelReadUtil.isErr() > 0) {
|
||||||
|
// 板材数据格式错误
|
||||||
|
ExcelWriterUtil.write(response, (Map<Object, Object>) map.get("order"), (List<OrderPlateImportExcelVO>) map.get("plate"),
|
||||||
|
orderService.getSavePath() + File.separator + "order_add_excel_err.xlsx");
|
||||||
|
return;
|
||||||
|
}else {
|
||||||
|
list = (List<?>) map.get("plate");
|
||||||
|
|
||||||
|
if (index == null || index == 0) { // 全部导入
|
||||||
|
Map<String, Object> mapOrder = excelReadUtil.changeOrderDO((Map<Object, Object>) map.get("order"));
|
||||||
|
|
||||||
|
if (list.size() == 0) {
|
||||||
|
orderDO.setStatus(0);
|
||||||
|
}
|
||||||
|
orderDO = ((OrderDO) mapOrder.get("order")).setOrderType(OrderTypeEnum.MAIN_ORDER.getStatus());
|
||||||
|
String err = ((String) mapOrder.get("error"));
|
||||||
|
|
||||||
|
if (!orderService.customOrderNoIsExists(orderDO.getCustomOrderNo())) {
|
||||||
|
err += orderDO.getCustomOrderNo() + "-自定义生产单号已存在;";
|
||||||
|
}
|
||||||
|
if (!err.equals("")) {
|
||||||
|
ExcelWriterUtil.writeErr(response, err, orderService.getSavePath() + File.separator + "order_err.xlsx");
|
||||||
|
}
|
||||||
|
}else { // 板材导入
|
||||||
|
orderDO.setId(orderId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (type == 1) { // json
|
||||||
|
|
||||||
|
} else if (type == 2) { // xml
|
||||||
|
|
||||||
|
}
|
||||||
|
orderService.importExcelData(orderDO, list, index);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ExcelWriterUtil.writeErr(response, "系统出现未知错误,请下载模板,按照模板重新上传文件", orderService.getSavePath() + File.separator + "order_err.xlsx");
|
ExcelWriterUtil.writeErr(response, "系统出现未知错误,请下载模板,按照模板重新上传文件", orderService.getSavePath() + File.separator + "order_err.xlsx");
|
||||||
}
|
}
|
||||||
@@ -392,7 +458,7 @@ public class OrderController {
|
|||||||
return success(orderService.getPrintDataMap(orderId, type, response));
|
return success(orderService.getPrintDataMap(orderId, type, response));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取api订单接口
|
// 获取api订单接口
|
||||||
@GetMapping("/getApiOrder")
|
@GetMapping("/getApiOrder")
|
||||||
@Operation(summary = "获取api订单接口")
|
@Operation(summary = "获取api订单接口")
|
||||||
@Parameters({
|
@Parameters({
|
||||||
@@ -411,38 +477,21 @@ public class OrderController {
|
|||||||
JSONObject oauth = apiDataAchieve.getApiToken(organId).get();
|
JSONObject oauth = apiDataAchieve.getApiToken(organId).get();
|
||||||
String token = oauth.getJSONObject("info").getString("access_token");
|
String token = oauth.getJSONObject("info").getString("access_token");
|
||||||
String shopId = oauth.getJSONObject("info").getString("shop_id");
|
String shopId = oauth.getJSONObject("info").getString("shop_id");
|
||||||
JSONObject orderList = apiDataAchieve.getApiOrderList(token,shopId,startTime,endTime,orderNo,customOrderNo).get();
|
JSONObject orderList = apiDataAchieve.getApiOrderList(token, shopId, startTime, endTime, orderNo, customOrderNo).get();
|
||||||
return success(orderService.getApiOrderList(orderList));
|
return success(orderService.getApiOrderList(orderList));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 统计
|
// 统计
|
||||||
// 生产单状态分组统计返回
|
|
||||||
@GetMapping("/getOrderStatusCount")
|
|
||||||
@Operation(summary = "生产单状态分组统计返回")
|
|
||||||
@Parameter(name = "startTerm", description = "按周,按月,按年", required = false, example = "1,2,3")
|
|
||||||
@PreAuthorize("@ss.hasPermission('productManager:List')")
|
|
||||||
public CommonResult<List<OrderStatusRespVO>> getOrderStatusCount(@RequestParam(value = "startTerm", required = false) Integer startTerm) {
|
|
||||||
return success(orderService.getOrderStatusCount(startTerm));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 小板数据分析
|
|
||||||
@GetMapping("/getOrderPlateAnalysisCount")
|
|
||||||
@Operation(summary = "小板数据分析统计(小板数量、小班面积)")
|
|
||||||
@PreAuthorize("@ss.hasPermission('productManager:List')")
|
|
||||||
public CommonResult<List<OrderGoodsPlateRespVO>> getOrderPlateAnalysisCount() {
|
|
||||||
return success(orderService.getOrderPlateAnalysisCount());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 生产单超期/到期告警 (工作台)
|
// 生产单超期/到期告警 (工作台)
|
||||||
@GetMapping("/getOrderWarn")
|
@GetMapping("/getOrderWarn")
|
||||||
@Operation(summary = "生产单警告")
|
@Operation(summary = "生产单超期/到期告警 (工作台)")
|
||||||
@PreAuthorize("@ss.hasPermission('productManager:List')")
|
@PreAuthorize("@ss.hasPermission('productManager:List')")
|
||||||
public CommonResult<Map<String,List<OrderOverdueRespVO>>> getOrderOverdue() {
|
public CommonResult<Map<String, List<OrderOverdueRespVO>>> getOrderOverdue() {
|
||||||
return success(orderService.getOrderWarn());
|
return success(orderService.getOrderWarn());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 生产单总数
|
// 生产单总数
|
||||||
@GetMapping("/orderCount")
|
@GetMapping("/orderCount")
|
||||||
@Operation(summary = "生产单总数")
|
@Operation(summary = "生产单总数")
|
||||||
@PreAuthorize("@ss.hasPermission('productManager:List')")
|
@PreAuthorize("@ss.hasPermission('productManager:List')")
|
||||||
@@ -450,7 +499,7 @@ public class OrderController {
|
|||||||
return success(orderService.orderCount());
|
return success(orderService.orderCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 今日新增生产单总数
|
// 今日新增生产单总数
|
||||||
@GetMapping("/orderCountToday")
|
@GetMapping("/orderCountToday")
|
||||||
@Operation(summary = "今日新增生产单总数")
|
@Operation(summary = "今日新增生产单总数")
|
||||||
@PreAuthorize("@ss.hasPermission('productManager:List')")
|
@PreAuthorize("@ss.hasPermission('productManager:List')")
|
||||||
@@ -458,7 +507,7 @@ public class OrderController {
|
|||||||
return success(orderService.orderCountToday());
|
return success(orderService.orderCountToday());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 今日生产单完成总数
|
// 今日生产单完成总数
|
||||||
@GetMapping("/orderCountTodayFinish")
|
@GetMapping("/orderCountTodayFinish")
|
||||||
@Operation(summary = "今日生产单完成总数")
|
@Operation(summary = "今日生产单完成总数")
|
||||||
@PreAuthorize("@ss.hasPermission('productManager:List')")
|
@PreAuthorize("@ss.hasPermission('productManager:List')")
|
||||||
@@ -466,7 +515,7 @@ public class OrderController {
|
|||||||
return success(orderService.orderCountTodayFinish());
|
return success(orderService.orderCountTodayFinish());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 生产中生产单总数
|
// 生产中生产单总数
|
||||||
@GetMapping("/orderCountProduce")
|
@GetMapping("/orderCountProduce")
|
||||||
@Operation(summary = "生产中生产单总数")
|
@Operation(summary = "生产中生产单总数")
|
||||||
@PreAuthorize("@ss.hasPermission('productManager:List')")
|
@PreAuthorize("@ss.hasPermission('productManager:List')")
|
||||||
@@ -474,7 +523,7 @@ public class OrderController {
|
|||||||
return success(orderService.orderCountProduce());
|
return success(orderService.orderCountProduce());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 生产中生产平方数
|
// 生产中生产平方数
|
||||||
@GetMapping("/orderSquareProduce")
|
@GetMapping("/orderSquareProduce")
|
||||||
@Operation(summary = "生产中生产平方数")
|
@Operation(summary = "生产中生产平方数")
|
||||||
@PreAuthorize("@ss.hasPermission('productManager:List')")
|
@PreAuthorize("@ss.hasPermission('productManager:List')")
|
||||||
@@ -482,20 +531,50 @@ public class OrderController {
|
|||||||
return success(orderService.orderSquareProduce());
|
return success(orderService.orderSquareProduce());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 小板数量
|
// 生产单状态分组统计返回
|
||||||
|
@GetMapping("/getOrderStatusCount")
|
||||||
|
@Operation(summary = "生产单状态分组统计返回")
|
||||||
|
@Parameters({
|
||||||
|
@Parameter(name = "startTime", description = "开始时间", example = "2024-07-15"),
|
||||||
|
@Parameter(name = "endTime", description = "结束时间", example = "2024-07-16")
|
||||||
|
})
|
||||||
|
@PreAuthorize("@ss.hasPermission('productManager:List')")
|
||||||
|
public CommonResult<List<OrderStatusRespVO>> getOrderStatusCount(@RequestParam(value = "startTime") String startTime,
|
||||||
|
@RequestParam(value = "endTime") String endTime) {
|
||||||
|
return success(orderService.getOrderStatusCount(startTime + " 00:00:00", endTime + " 23:59:59"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 小板数量 <集合>
|
||||||
@GetMapping("/getPlateCount")
|
@GetMapping("/getPlateCount")
|
||||||
@Operation(summary = "小板数量")
|
@Operation(summary = "小板数量")
|
||||||
@Parameters({
|
@Parameters({
|
||||||
@Parameter(name = "startTime", description = "开始时间", required = false),
|
@Parameter(name = "startTime", description = "开始时间", example = "2024-07-15"),
|
||||||
@Parameter(name = "endTime", description = "结束时间", required = false),
|
@Parameter(name = "endTime", description = "结束时间", example = "2024-07-16"),
|
||||||
@Parameter(name = "goodsId", description = "材料id", required = true),
|
@Parameter(name = "pageNo", description = "第几页", example = "1"),
|
||||||
@Parameter(name = "organId", description = "组织id", required = false, example = "1")
|
@Parameter(name = "pageSize", description = "每页条数", example = "10")
|
||||||
})
|
})
|
||||||
@PreAuthorize("@ss.hasPermission('productManager:List')")
|
@PreAuthorize("@ss.hasPermission('productManager:List')")
|
||||||
public CommonResult<Integer> getPlateCount(@RequestParam(value = "startTime", required = false) String startTime,
|
public CommonResult<PageResult<OrderGoodsPlateRespVO>> getPlateCount(@RequestParam(value = "startTime") String startTime,
|
||||||
@RequestParam(value = "endTime", required = false) String endTime,
|
@RequestParam(value = "endTime") String endTime,
|
||||||
@RequestParam(value = "goodsId", required = false) Set<String> goodsId,
|
@RequestParam(value = "pageNo") Integer pageNo,
|
||||||
@RequestParam("orderId") Long organId) {
|
@RequestParam(value = "pageSize") Integer pageSize) {
|
||||||
return success(orderService.plateCount());
|
return success(orderService.plateCount(startTime + " 00:00:00", endTime + " 23:59:59", pageNo, pageSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 小板面积 <集合>
|
||||||
|
@GetMapping("/getPlateArea")
|
||||||
|
@Operation(summary = "小板数量")
|
||||||
|
@Parameters({
|
||||||
|
@Parameter(name = "startTime", description = "开始时间", example = "2024-07-15"),
|
||||||
|
@Parameter(name = "endTime", description = "结束时间", example = "2024-07-16"),
|
||||||
|
@Parameter(name = "pageNo", description = "第几页", example = "1"),
|
||||||
|
@Parameter(name = "pageSize", description = "每页条数", example = "10")
|
||||||
|
})
|
||||||
|
@PreAuthorize("@ss.hasPermission('productManager:List')")
|
||||||
|
public CommonResult<PageResult<OrderGoodsPlateRespVO>> getPlateArea(@RequestParam(value = "startTime") String startTime,
|
||||||
|
@RequestParam(value = "endTime") String endTime,
|
||||||
|
@RequestParam(value = "pageNo") Integer pageNo,
|
||||||
|
@RequestParam(value = "pageSize") Integer pageSize) {
|
||||||
|
return success(orderService.plateArea(startTime + " 00:00:00", endTime + " 23:59:59", pageNo, pageSize));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -24,7 +24,7 @@ public class OrderRespVO {
|
|||||||
private String apiOrderId;
|
private String apiOrderId;
|
||||||
|
|
||||||
@Schema(description = "生产单日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "生产单日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@ExcelProperty("交付日期")
|
@ExcelProperty("生产单日期")
|
||||||
private LocalDateTime orderDate;
|
private LocalDateTime orderDate;
|
||||||
|
|
||||||
@Schema(description = "交付日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "交付日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
|||||||
+5
@@ -3,6 +3,8 @@ package com.cf.imes.module.executor.controller.admin.order.vo.order;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 生产单状态统计")
|
@Schema(description = "管理后台 - 生产单状态统计")
|
||||||
@Data
|
@Data
|
||||||
@Builder
|
@Builder
|
||||||
@@ -15,4 +17,7 @@ public class OrderStatusRespVO {
|
|||||||
|
|
||||||
@Schema(description = "订单数量")
|
@Schema(description = "订单数量")
|
||||||
private Integer orderCount;
|
private Integer orderCount;
|
||||||
|
|
||||||
|
@Schema(description = "生产单时间")
|
||||||
|
private LocalDateTime orderDate;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -140,7 +140,7 @@ public interface OrderMapper extends BaseMapperX<OrderDO> {
|
|||||||
List<Long> selectOrderIds(@Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper);
|
List<Long> selectOrderIds(@Param(Constants.WRAPPER) Wrapper<OrderDO> wrapper);
|
||||||
|
|
||||||
// 生产单状态统计
|
// 生产单状态统计
|
||||||
List<OrderStatusRespVO> selectOrderStatusCount(@Param("organId")Long organId, @Param("orderDate") LocalDateTime orderDate);
|
List<OrderStatusRespVO> selectOrderStatusCount(@Param("organId")Long organId, @Param("startTime")String startTime, @Param("endTime")String endTime);
|
||||||
|
|
||||||
// 生产单预警统计
|
// 生产单预警统计
|
||||||
List<OrderOverdueRespVO> selectOrderNear(@Param("today") LocalDateTime today, @Param("orderDate") LocalDateTime orderDate, @Param("organId") Long organId);
|
List<OrderOverdueRespVO> selectOrderNear(@Param("today") LocalDateTime today, @Param("orderDate") LocalDateTime orderDate, @Param("organId") Long organId);
|
||||||
|
|||||||
+11
-4
@@ -7,6 +7,7 @@ import com.cf.imes.module.executor.dal.dataobject.plate.PlateGoodDO;
|
|||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 板材信息 Mapper plate
|
* 板材信息 Mapper plate
|
||||||
@@ -25,9 +26,9 @@ public interface PlateGoodMapper extends BaseMapperX<PlateGoodDO> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 其他信息匹配
|
// 其他信息匹配
|
||||||
default PlateGoodDO selectGood(String goodsName, String material, String color, Boolean texture, BigDecimal width,
|
default List<PlateGoodDO> selectGood(String goodsName, String material, String color, Boolean texture, BigDecimal width,
|
||||||
BigDecimal thickness, BigDecimal height, String brand, String spec, Long organId) {
|
BigDecimal thickness, BigDecimal height, String brand, String spec, Long organId) {
|
||||||
return selectOne(new LambdaQueryWrapper<PlateGoodDO>()
|
LambdaQueryWrapper<PlateGoodDO> queryWrapper = new LambdaQueryWrapper<PlateGoodDO>()
|
||||||
.eq(PlateGoodDO::getGoodsName, goodsName)
|
.eq(PlateGoodDO::getGoodsName, goodsName)
|
||||||
.eq(PlateGoodDO::getMaterial, material)
|
.eq(PlateGoodDO::getMaterial, material)
|
||||||
.eq(PlateGoodDO::getColor, color)
|
.eq(PlateGoodDO::getColor, color)
|
||||||
@@ -35,9 +36,15 @@ public interface PlateGoodMapper extends BaseMapperX<PlateGoodDO> {
|
|||||||
.eq(PlateGoodDO::getWidth, width)
|
.eq(PlateGoodDO::getWidth, width)
|
||||||
.eq(PlateGoodDO::getHeight, height)
|
.eq(PlateGoodDO::getHeight, height)
|
||||||
.eq(PlateGoodDO::getThickness, thickness)
|
.eq(PlateGoodDO::getThickness, thickness)
|
||||||
.eq(PlateGoodDO::getBrand, brand)
|
|
||||||
.eq(PlateGoodDO::getSpec, spec)
|
.eq(PlateGoodDO::getSpec, spec)
|
||||||
.eq(PlateGoodDO::getDeleted, 0)
|
.eq(PlateGoodDO::getDeleted, 0)
|
||||||
.eq(PlateGoodDO::getOrganId, organId));
|
.eq(PlateGoodDO::getOrganId, organId);
|
||||||
|
if (brand == null) {
|
||||||
|
queryWrapper.eq(PlateGoodDO::getBrand,"");
|
||||||
|
}else {
|
||||||
|
queryWrapper.eq(PlateGoodDO::getBrand, brand);
|
||||||
}
|
}
|
||||||
|
return selectList(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-1
@@ -137,5 +137,9 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
|||||||
List<GoodsNum> selectGoodsNum(@Param("orderIds") List<Long> orderIds,@Param("organId") Long organId);
|
List<GoodsNum> selectGoodsNum(@Param("orderIds") List<Long> orderIds,@Param("organId") Long organId);
|
||||||
|
|
||||||
// 小板数据分析
|
// 小板数据分析
|
||||||
List<OrderGoodsPlateRespVO> selectPlateAnalysisList(@Param("organId") Long organId, @Param("orderDate") LocalDateTime orderDate);
|
// List<OrderGoodsPlateRespVO> selectPlateAnalysisListByCount(@Param("organId") Long organId, @Param("startTime") String startTime, @Param("endTime") String endTime); // 数量
|
||||||
|
IPage<OrderGoodsPlateRespVO> selectPlateAnalysisListByCount(@Param("page") IPage<OrderGoodsPlateRespVO> page, @Param("organId") Long organId, @Param("startTime") String startTime, @Param("endTime") String endTime); // 数量
|
||||||
|
// List<OrderGoodsPlateRespVO> selectPlateAnalysisListByArea(@Param("organId") Long organId, @Param("startTime") String startTime, @Param("endTime") String endTime); // 面积
|
||||||
|
IPage<OrderGoodsPlateRespVO> selectPlateAnalysisListByArea(@Param("page") IPage<OrderGoodsPlateRespVO> page, @Param("organId") Long organId, @Param("startTime") String startTime, @Param("endTime") String endTime); // 面积
|
||||||
|
|
||||||
}
|
}
|
||||||
+3
-5
@@ -96,13 +96,12 @@ public class OrderInputProcessor {
|
|||||||
* @param itemDOS
|
* @param itemDOS
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Long batchInsert(Collection<RawGoodsDO> rawGoodsDOS, Collection<OrderBodyDO> orderBodyDOS,
|
public void batchInsert(Collection<RawGoodsDO> rawGoodsDOS, Collection<OrderBodyDO> orderBodyDOS,
|
||||||
Collection<OrderGroupDO> orderGroupDOS, Collection<OrderPartsDO> orderPartsDOS,
|
Collection<OrderGroupDO> orderGroupDOS, Collection<OrderPartsDO> orderPartsDOS,
|
||||||
Collection<PlateDO> plateDOS, Collection<OrderModuleExtraDO> orderModuleExtraDOS,
|
Collection<PlateDO> plateDOS, Collection<OrderModuleExtraDO> orderModuleExtraDOS,
|
||||||
Collection<OrderItemDO> itemDOS, OrderDO orderDO,
|
Collection<OrderItemDO> itemDOS,
|
||||||
Collection<GoodsDO> goodsDOS, Collection<PlateGoodDO> plateGoodDOS) {
|
Collection<GoodsDO> goodsDOS, Collection<PlateGoodDO> plateGoodDOS) {
|
||||||
if (orderDO != null)
|
|
||||||
orderMapper.insert(orderDO);
|
|
||||||
|
|
||||||
if (rawGoodsDOS != null)
|
if (rawGoodsDOS != null)
|
||||||
for (int i = 0; i < rawGoodsDOS.size(); i += 1000) {
|
for (int i = 0; i < rawGoodsDOS.size(); i += 1000) {
|
||||||
@@ -151,7 +150,6 @@ public class OrderInputProcessor {
|
|||||||
//plateMapper.insertBatch(plateDOS);
|
//plateMapper.insertBatch(plateDOS);
|
||||||
//orderModuleExtraMapper.insertBatch(orderModuleExtraDOS);
|
//orderModuleExtraMapper.insertBatch(orderModuleExtraDOS);
|
||||||
//orderItemMapper.insertBatch(itemDOS);
|
//orderItemMapper.insertBatch(itemDOS);
|
||||||
return orderDO.getId();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+9
-15
@@ -77,6 +77,7 @@ public interface OrderService {
|
|||||||
* @return List<OrderBodyRespVO>
|
* @return List<OrderBodyRespVO>
|
||||||
*/
|
*/
|
||||||
List<OrderBodyRespVO> getOrderBody(Long orderId);
|
List<OrderBodyRespVO> getOrderBody(Long orderId);
|
||||||
|
String getOrderBodyToString(Long orderId);
|
||||||
|
|
||||||
|
|
||||||
List<OrderRoomBodyRespVO> getRoomAndBody(Long planId);
|
List<OrderRoomBodyRespVO> getRoomAndBody(Long planId);
|
||||||
@@ -140,7 +141,7 @@ public interface OrderService {
|
|||||||
/**
|
/**
|
||||||
* 文件数据导入
|
* 文件数据导入
|
||||||
*/
|
*/
|
||||||
void importExcelData(OrderDO orderDO, List<?> list);
|
void importExcelData(OrderDO orderDO, List<?> list, Integer index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模板文件导入保存
|
* 模板文件导入保存
|
||||||
@@ -177,25 +178,13 @@ public interface OrderService {
|
|||||||
/**
|
/**
|
||||||
* 生产单状态统计
|
* 生产单状态统计
|
||||||
*/
|
*/
|
||||||
List<OrderStatusRespVO> getOrderStatusCount(Integer startTerm);
|
List<OrderStatusRespVO> getOrderStatusCount(String startTime, String endTime);
|
||||||
|
|
||||||
/**
|
|
||||||
* 小板数据分析统计
|
|
||||||
*/
|
|
||||||
List<OrderGoodsPlateRespVO> getOrderPlateAnalysisCount();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生产单超期告警分析统计
|
* 生产单超期告警分析统计
|
||||||
*/
|
*/
|
||||||
Map<String,List<OrderOverdueRespVO>> getOrderWarn();
|
Map<String,List<OrderOverdueRespVO>> getOrderWarn();
|
||||||
|
|
||||||
/**
|
|
||||||
* 今日要完成生产单数
|
|
||||||
*/
|
|
||||||
List<OrderRespVO> getOrderOverdue();
|
|
||||||
|
|
||||||
String getOrderBodyToString(Long orderId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生产单总数统计
|
* 生产单总数统计
|
||||||
*/
|
*/
|
||||||
@@ -224,5 +213,10 @@ public interface OrderService {
|
|||||||
/**
|
/**
|
||||||
* 小板数量
|
* 小板数量
|
||||||
*/
|
*/
|
||||||
Integer plateCount();
|
PageResult<OrderGoodsPlateRespVO> plateCount(String startTime, String endTime, Integer pageNo, Integer pageSize);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小板面积
|
||||||
|
*/
|
||||||
|
PageResult<OrderGoodsPlateRespVO> plateArea(String startTime, String endTime, Integer pageNo, Integer pageSize);
|
||||||
}
|
}
|
||||||
+53
-49
@@ -280,7 +280,6 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
// 判断生产单是否删除
|
// 判断生产单是否删除
|
||||||
Integer deleted = getOrderDeleted(orderId);
|
Integer deleted = getOrderDeleted(orderId);
|
||||||
|
|
||||||
|
|
||||||
List<OrderBodyRespVO> orderBodyRespVOList = BeanUtils.toBean(
|
List<OrderBodyRespVO> orderBodyRespVOList = BeanUtils.toBean(
|
||||||
orderBodyMapper.selectList(orderId, deleted, SecurityFrameworkUtils.getLoginUser().getOrganId()), OrderBodyRespVO.class);
|
orderBodyMapper.selectList(orderId, deleted, SecurityFrameworkUtils.getLoginUser().getOrganId()), OrderBodyRespVO.class);
|
||||||
return orderBodyRespVOList;
|
return orderBodyRespVOList;
|
||||||
@@ -354,8 +353,35 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer plateCount() {
|
public PageResult<OrderGoodsPlateRespVO> plateCount(String startTime, String endTime, Integer pageNo, Integer pageSize) {
|
||||||
return null;
|
// 角色判断
|
||||||
|
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||||
|
// 数据查询
|
||||||
|
PageDTO<OrderGoodsPlateRespVO> page = new PageDTO<>(pageNo, pageSize);
|
||||||
|
IPage<OrderGoodsPlateRespVO> orderDetail;
|
||||||
|
if (loginUser.getIsSupAdmin()){
|
||||||
|
orderDetail = plateMapper.selectPlateAnalysisListByCount(page,null, startTime, endTime);
|
||||||
|
}else {
|
||||||
|
orderDetail = plateMapper.selectPlateAnalysisListByCount(page,OrganContextHolder.getOrganId(), startTime, endTime);
|
||||||
|
}
|
||||||
|
PageResult<OrderGoodsPlateRespVO> pageResult = new PageResult(orderDetail.getRecords(), orderDetail.getTotal());
|
||||||
|
return pageResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<OrderGoodsPlateRespVO> plateArea(String startTime, String endTime, Integer pageNo, Integer pageSize) {
|
||||||
|
// 角色判断
|
||||||
|
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||||
|
// 数据查询
|
||||||
|
PageDTO<OrderGoodsPlateRespVO> page = new PageDTO<>(pageNo, pageSize);
|
||||||
|
IPage<OrderGoodsPlateRespVO> orderDetail;
|
||||||
|
if (loginUser.getIsSupAdmin()){
|
||||||
|
orderDetail = plateMapper.selectPlateAnalysisListByArea(page,null, startTime, endTime);
|
||||||
|
}else {
|
||||||
|
orderDetail = plateMapper.selectPlateAnalysisListByArea(page,OrganContextHolder.getOrganId(), startTime, endTime);
|
||||||
|
}
|
||||||
|
PageResult<OrderGoodsPlateRespVO> pageResult = new PageResult(orderDetail.getRecords(), orderDetail.getTotal());
|
||||||
|
return pageResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -519,7 +545,10 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
|
|
||||||
String nickName = SecurityFrameworkUtils.getLoginUser().getNickname();
|
String nickName = SecurityFrameworkUtils.getLoginUser().getNickname();
|
||||||
OrderDO orderDO = order.get(0).setSalesman(nickName).setSplitter(nickName);
|
OrderDO orderDO = order.get(0).setSalesman(nickName).setSplitter(nickName);
|
||||||
orderInputProcessor.batchInsert(rawGoodsDO, bodyDO, groupDO, partsDO, plateDO, null, itemDO, orderDO, goodsDO, plateGoodDOS);
|
if (orderDO != null){
|
||||||
|
orderMapper.insert(orderDO);
|
||||||
|
}
|
||||||
|
orderInputProcessor.batchInsert(rawGoodsDO, bodyDO, groupDO, partsDO, plateDO, null, itemDO, goodsDO, plateGoodDOS);
|
||||||
List<OrderModelDO> orderModelDOs = BeanUtils.toBean(plateDetail, OrderModelDO.class);
|
List<OrderModelDO> orderModelDOs = BeanUtils.toBean(plateDetail, OrderModelDO.class);
|
||||||
|
|
||||||
if (orderModelDOs.size() > 0) {
|
if (orderModelDOs.size() > 0) {
|
||||||
@@ -546,18 +575,21 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
List<PlateGoodDO> plateGoodLists = new ArrayList<>();
|
List<PlateGoodDO> plateGoodLists = new ArrayList<>();
|
||||||
|
|
||||||
for (GoodsDO goodsDO : goodsLists) {
|
for (GoodsDO goodsDO : goodsLists) {
|
||||||
PlateGoodDO plateGoodDO;
|
PlateGoodDO plateGoodDO = null;
|
||||||
|
List<PlateGoodDO> plateGoodDOS = null;
|
||||||
if (goodsDO.getGoodsId() != null) { // 有goodsId
|
if (goodsDO.getGoodsId() != null) { // 有goodsId
|
||||||
plateGoodDO = plateGoodMapper.selectGoodOne(goodsDO.getGoodsId(), SecurityFrameworkUtils.getLoginUser().getOrganId());
|
plateGoodDO = plateGoodMapper.selectGoodOne(goodsDO.getGoodsId(), SecurityFrameworkUtils.getLoginUser().getOrganId());
|
||||||
} else { // 没有goodsId 其他信息匹配
|
} else { // 没有goodsId 其他信息匹配
|
||||||
plateGoodDO = plateGoodMapper.selectGood(goodsDO.getGoodsName(), goodsDO.getMaterial(), goodsDO.getColor(),
|
plateGoodDOS = plateGoodMapper.selectGood(goodsDO.getGoodsName(), goodsDO.getMaterial(), goodsDO.getColor(),
|
||||||
goodsDO.getTexture(), goodsDO.getWidth(), goodsDO.getWidth(), goodsDO.getHeight(), goodsDO.getSpec(),
|
goodsDO.getTexture(), goodsDO.getWidth(), goodsDO.getThickness(), goodsDO.getHeight(), goodsDO.getBrand(),
|
||||||
goodsDO.getBrand(), SecurityFrameworkUtils.getLoginUser().getOrganId());
|
goodsDO.getSpec(), SecurityFrameworkUtils.getLoginUser().getOrganId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plateGoodDO != null) {//存在板材
|
if (plateGoodDOS.size() > 0) {//存在板材
|
||||||
goodsDO.setGoodsId(plateGoodDO.getGoodsId());
|
goodsDO.setGoodsId(plateGoodDOS.get(0).getGoodsId());
|
||||||
break;
|
break;
|
||||||
|
} else if (plateGoodDO != null) { // 存在板材
|
||||||
|
goodsDO.setGoodsId(plateGoodDO.getGoodsId());
|
||||||
} else { // 不存在板材
|
} else { // 不存在板材
|
||||||
Long plateGoods = (Long) identifierGenerator.nextId(null);
|
Long plateGoods = (Long) identifierGenerator.nextId(null);
|
||||||
Long goodsId = (Long) identifierGenerator.nextId(null);
|
Long goodsId = (Long) identifierGenerator.nextId(null);
|
||||||
@@ -576,7 +608,6 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
}
|
}
|
||||||
map.put("goodsDO", goodsLists);
|
map.put("goodsDO", goodsLists);
|
||||||
map.put("plateGoodDOLists", plateGoodLists);
|
map.put("plateGoodDOLists", plateGoodLists);
|
||||||
// System.err.println(" map " + map);
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -673,39 +704,12 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<OrderStatusRespVO> getOrderStatusCount(Integer startTerm) {
|
public List<OrderStatusRespVO> getOrderStatusCount(String startTime, String endTime) {
|
||||||
// 根据开始条件选择
|
List<OrderStatusRespVO> orderStatusRespVOS = orderMapper.selectOrderStatusCount(OrganContextHolder.getOrganId(), startTime, endTime);
|
||||||
LocalDateTime orderDate = null;
|
|
||||||
|
|
||||||
if (startTerm != null){
|
|
||||||
switch (startTerm) {
|
|
||||||
case 2: // 月
|
|
||||||
orderDate = LocalDate.now().withDayOfMonth(1).atStartOfDay();
|
|
||||||
break;
|
|
||||||
case 3: // 年
|
|
||||||
orderDate = LocalDate.now().withMonth(1).withDayOfMonth(1).atStartOfDay();
|
|
||||||
break;
|
|
||||||
default: // 周
|
|
||||||
orderDate = LocalDate.now().with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)).atStartOfDay();
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
orderDate = LocalDate.now().with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)).atStartOfDay();
|
|
||||||
}
|
|
||||||
|
|
||||||
List<OrderStatusRespVO> orderStatusRespVOS = orderMapper.selectOrderStatusCount(OrganContextHolder.getOrganId(), orderDate);
|
|
||||||
orderStatusRespVOS.removeIf(obj -> obj.getOrderState() == OrderStatusEnum.EMPTY.getStatus());
|
orderStatusRespVOS.removeIf(obj -> obj.getOrderState() == OrderStatusEnum.EMPTY.getStatus());
|
||||||
return orderStatusRespVOS;
|
return orderStatusRespVOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<OrderGoodsPlateRespVO> getOrderPlateAnalysisCount() {
|
|
||||||
LocalDateTime orderDate = LocalDate.now().withDayOfMonth(1).atStartOfDay();
|
|
||||||
List<OrderGoodsPlateRespVO> orderGoodsPlateRespVOS = plateMapper.selectPlateAnalysisList(OrganContextHolder.getOrganId(), orderDate);
|
|
||||||
return orderGoodsPlateRespVOS;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String,List<OrderOverdueRespVO>> getOrderWarn() {
|
public Map<String,List<OrderOverdueRespVO>> getOrderWarn() {
|
||||||
Map<String,List<OrderOverdueRespVO>> map = new HashMap<>();
|
Map<String,List<OrderOverdueRespVO>> map = new HashMap<>();
|
||||||
@@ -724,11 +728,6 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<OrderRespVO> getOrderOverdue() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 判断是否已经导入
|
// 判断是否已经导入
|
||||||
private Boolean validateOrderNoExists(String orderNo, Long organId) {
|
private Boolean validateOrderNoExists(String orderNo, Long organId) {
|
||||||
if (orderMapper.selectCount(new LambdaQueryWrapper<OrderDO>()
|
if (orderMapper.selectCount(new LambdaQueryWrapper<OrderDO>()
|
||||||
@@ -782,9 +781,14 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void importExcelData(OrderDO orderDO, List<?> list) {
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void importExcelData(OrderDO orderDO, List<?> list, Integer index) {
|
||||||
|
if (index == 0){
|
||||||
orderDO.setId((Long) snowFlakeGenerator.nextId(null));
|
orderDO.setId((Long) snowFlakeGenerator.nextId(null));
|
||||||
|
orderMapper.insert(orderDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (list.size() > 0) {
|
||||||
Map<String, List<?>> listMap = excelTypeRealize.changeDate(list, orderDO.getId());
|
Map<String, List<?>> listMap = excelTypeRealize.changeDate(list, orderDO.getId());
|
||||||
List<RawGoodsDO> rawGoodsDO = (List<RawGoodsDO>) listMap.get("rawGoodsDOS");
|
List<RawGoodsDO> rawGoodsDO = (List<RawGoodsDO>) listMap.get("rawGoodsDOS");
|
||||||
List<GoodsDO> goodsDO = (List<GoodsDO>) listMap.get("goodsDOS");
|
List<GoodsDO> goodsDO = (List<GoodsDO>) listMap.get("goodsDOS");
|
||||||
@@ -797,19 +801,19 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
List<OrderModelDO> orderModelDOS = (List<OrderModelDO>) listMap.get("orderModelDOS");
|
List<OrderModelDO> orderModelDOS = (List<OrderModelDO>) listMap.get("orderModelDOS");
|
||||||
List<OrderPartsRemark> orderPartsRemarks = (List<OrderPartsRemark>) listMap.get("orderPartsRemarks");
|
List<OrderPartsRemark> orderPartsRemarks = (List<OrderPartsRemark>) listMap.get("orderPartsRemarks");
|
||||||
// 板材库匹配
|
// 板材库匹配
|
||||||
Map<String, List<?>> map = getPlateGoods(goodsDO);// 检验商品板材信息是否存在
|
Map<String, List<?>> map = getPlateGoods(goodsDO);// 检验商品板材信息是否存在 excel
|
||||||
goodsDO = (List<GoodsDO>) map.get("goodsDO");
|
goodsDO = (List<GoodsDO>) map.get("goodsDO");
|
||||||
List<PlateGoodDO> plateGoodDOS = (List<PlateGoodDO>) map.get("plateGoodDOLists");
|
List<PlateGoodDO> plateGoodDOS = (List<PlateGoodDO>) map.get("plateGoodDOLists");
|
||||||
|
|
||||||
// validateCustomOrderNoExists(orderDO.getCustomOrderNo());
|
// validateCustomOrderNoExists(orderDO.getCustomOrderNo());
|
||||||
orderInputProcessor.batchInsert(rawGoodsDO, bodyDO, groupDO, partsDO, plateDO, null, itemDO, orderDO, goodsDO, plateGoodDOS);
|
orderInputProcessor.batchInsert(rawGoodsDO, bodyDO, groupDO, partsDO, plateDO, null, itemDO, goodsDO, plateGoodDOS);
|
||||||
if (orderModelDOS.size() > 0) {
|
if (orderModelDOS.size() > 0) {
|
||||||
orderInputProcessor.batchSaveModel(orderModelDOS);
|
orderInputProcessor.batchSaveModel(orderModelDOS);
|
||||||
}
|
}
|
||||||
if (orderPartsRemarks.size() > 0) {
|
if (orderPartsRemarks.size() > 0) {
|
||||||
orderInputProcessor.batchSaveOrderPartsModel(orderPartsRemarks);
|
orderInputProcessor.batchSaveOrderPartsModel(orderPartsRemarks);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+43
-15
@@ -66,9 +66,9 @@ public class ExcelReadUtil { // 文件读取
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
index.set(true);
|
index.set(true);
|
||||||
if (MapUtil.isEmpty(orderMap) || CollectionUtil.isEmpty(list)) {
|
// if (MapUtil.isEmpty(orderMap) || CollectionUtil.isEmpty(list)) {
|
||||||
isErr.set(-1);
|
// isErr.set(-1);
|
||||||
}
|
// }
|
||||||
map.put("order", orderMap);
|
map.put("order", orderMap);
|
||||||
map.put("plate", list);
|
map.put("plate", list);
|
||||||
return map;
|
return map;
|
||||||
@@ -78,36 +78,57 @@ public class ExcelReadUtil { // 文件读取
|
|||||||
// order 数据转换
|
// order 数据转换
|
||||||
public Map<String, Object> changeOrderDO(Map<Object, Object> orderMap) {
|
public Map<String, Object> changeOrderDO(Map<Object, Object> orderMap) {
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
String s = (String) orderMap.get("出货日期");
|
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
||||||
// string 拼接
|
|
||||||
String error = "";
|
String error = "";
|
||||||
// 电话校验
|
// 判断是否为空
|
||||||
if (!validatePhoneNumber((String) orderMap.get("客户电话"))) {
|
if ( orderMap.get("客户") == null){
|
||||||
error += (String) orderMap.get("客户电话")+ "-客户电话格式错误;";
|
error += "客户不能为空;";
|
||||||
}
|
}
|
||||||
|
if (orderMap.get("经销商") == null){
|
||||||
|
error += "经销商不能为空;";
|
||||||
|
}
|
||||||
|
if (orderMap.get("客户地址") == null){
|
||||||
|
error += "客户地址不能为空;";
|
||||||
|
}
|
||||||
|
if (orderMap.get("出货日期") == null){
|
||||||
|
error += "出货日期不能为空;";
|
||||||
|
}
|
||||||
|
if (orderMap.get("客户电话") == null){
|
||||||
|
error += "客户电话不能为空;";
|
||||||
|
} else {
|
||||||
|
if (!validatePhoneNumber((String) orderMap.get("客户电话"))) {
|
||||||
|
error += orderMap.get("客户电话")+ "-客户电话格式错误;";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (orderMap.get("经销商电话") != null){
|
||||||
if (!validatePhoneNumber((String) orderMap.get("经销商电话"))) {
|
if (!validatePhoneNumber((String) orderMap.get("经销商电话"))) {
|
||||||
error += (String) orderMap.get("经销商电话")+ "-经销商电话格式错误;";
|
error += orderMap.get("经销商电话")+ "-经销商电话格式错误;";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
OrderDO orderDO = OrderDO.builder()
|
OrderDO orderDO = OrderDO.builder()
|
||||||
.organId(OrganContextHolder.getOrganId())
|
.organId(OrganContextHolder.getOrganId())
|
||||||
.dataType(0)
|
.dataType(0)
|
||||||
.customer((String) orderMap.get("客户"))
|
.customer((String) orderMap.get("客户")) //
|
||||||
.customOrderNo((String) orderMap.get("自定义单号"))
|
.customOrderNo((String) orderMap.get("自定义单号"))
|
||||||
.dealer((String) orderMap.get("经销商"))
|
.dealer((String) orderMap.get("经销商")) //
|
||||||
.dealerPhoneNumber((String) orderMap.get("经销商电话"))
|
.dealerPhoneNumber((String) orderMap.get("经销商电话"))
|
||||||
.address((String) orderMap.get("客户地址"))
|
.address((String) orderMap.get("客户地址")) //
|
||||||
.phoneNumber((String) orderMap.get("客户电话"))
|
.phoneNumber((String) orderMap.get("客户电话")) //
|
||||||
.salesman((String) orderMap.get("业务员"))
|
.salesman((String) orderMap.get("业务员"))
|
||||||
.splitter((String) orderMap.get("拆单员"))
|
.splitter((String) orderMap.get("拆单员"))
|
||||||
.remark((String) orderMap.get("备注"))
|
.remark((String) orderMap.get("备注"))
|
||||||
.build();
|
.build();
|
||||||
|
if (orderMap.get("出货日期") == null){
|
||||||
|
error += "出货日期不能为空;";
|
||||||
|
}else {
|
||||||
|
String s = (String) orderMap.get("出货日期");
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
try {
|
try {
|
||||||
LocalDate orderDate = LocalDate.parse(s, formatter);
|
LocalDate orderDate = LocalDate.parse(s, formatter);
|
||||||
orderDO.setDeliveryDate(orderDate.atStartOfDay());
|
orderDO.setDeliveryDate(orderDate.atStartOfDay()); //
|
||||||
} catch (DateTimeParseException e) {
|
} catch (DateTimeParseException e) {
|
||||||
error += s + "-出货日期格式错误;";
|
error += s + "-出货日期格式错误;";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
map.put("order", orderDO);
|
map.put("order", orderDO);
|
||||||
map.put("error", error);
|
map.put("error", error);
|
||||||
return map;
|
return map;
|
||||||
@@ -382,6 +403,13 @@ public class ExcelReadUtil { // 文件读取
|
|||||||
errList.add("成品宽数据长度错误");
|
errList.add("成品宽数据长度错误");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (flag) {
|
||||||
|
Double plateHeight = Double.parseDouble(vo.getHeight());
|
||||||
|
Double plateWidth = Double.parseDouble(vo.getWidth());
|
||||||
|
vo.setArea(plateHeight * plateWidth * 0.000001);
|
||||||
|
}
|
||||||
|
|
||||||
if (!convertToDouble(vo.getSplitHeight())) {
|
if (!convertToDouble(vo.getSplitHeight())) {
|
||||||
flag = false;
|
flag = false;
|
||||||
errList.add("拆单长数据类型错误");
|
errList.add("拆单长数据类型错误");
|
||||||
|
|||||||
+10
-11
@@ -139,7 +139,6 @@ public class ExcelTypeRealize {
|
|||||||
excelVO -> excelVO.getRoomsName() != null ? excelVO.getRoomsName() : " ",
|
excelVO -> excelVO.getRoomsName() != null ? excelVO.getRoomsName() : " ",
|
||||||
Collectors.toList()
|
Collectors.toList()
|
||||||
));
|
));
|
||||||
System.out.println("roomCollect " + roomCollect);
|
|
||||||
|
|
||||||
roomCollect.forEach((roomName, listRoom) -> {
|
roomCollect.forEach((roomName, listRoom) -> {
|
||||||
Long roomId = (Long) snowFlakeGenerator.nextId(null);
|
Long roomId = (Long) snowFlakeGenerator.nextId(null);
|
||||||
@@ -161,12 +160,12 @@ public class ExcelTypeRealize {
|
|||||||
// 加工组类型为条件进行分组
|
// 加工组类型为条件进行分组
|
||||||
Map<String, List<OrderPlateImportExcelVO>> synthesisCollect = listBody.stream()
|
Map<String, List<OrderPlateImportExcelVO>> synthesisCollect = listBody.stream()
|
||||||
.collect(Collectors.groupingBy(
|
.collect(Collectors.groupingBy(
|
||||||
excelVO -> excelVO.getSynthesis() != null ? excelVO.getSynthesis() : " ",
|
excelVO -> excelVO.getSynthesisTypeName() != null ? excelVO.getSynthesisTypeName() : " ",
|
||||||
Collectors.toList()
|
Collectors.toList()
|
||||||
));
|
));
|
||||||
Long groupTypeId = (Long) snowFlakeGenerator.nextId(null);
|
Long groupTypeId = (Long) snowFlakeGenerator.nextId(null);
|
||||||
|
|
||||||
synthesisCollect.forEach((synthesis, listSynthesis) -> {
|
synthesisCollect.forEach((synthesisTypeName, listSynthesis) -> {
|
||||||
// 加工组名称为条件进行分组
|
// 加工组名称为条件进行分组
|
||||||
Map<String, List<OrderPlateImportExcelVO>> combinationNameCollect = listSynthesis.stream()
|
Map<String, List<OrderPlateImportExcelVO>> combinationNameCollect = listSynthesis.stream()
|
||||||
.collect(Collectors.groupingBy(
|
.collect(Collectors.groupingBy(
|
||||||
@@ -174,11 +173,11 @@ public class ExcelTypeRealize {
|
|||||||
Collectors.toList()
|
Collectors.toList()
|
||||||
));
|
));
|
||||||
combinationNameCollect.forEach((combinationName, listCombinationName) -> {
|
combinationNameCollect.forEach((combinationName, listCombinationName) -> {
|
||||||
Long groupId = (Long) snowFlakeGenerator.nextId(null);
|
|
||||||
// 板数量
|
// 板数量
|
||||||
final Double[] plateCountByCombination = {0.0};
|
final Double[] plateCountByCombination = {0.0};
|
||||||
|
Long groupId = (Long) snowFlakeGenerator.nextId(null);
|
||||||
OrderGroupDO orderGroupDO = OrderGroupDO.builder().id(groupId).orderId(orderId).organId(organId).bodyId(bodyId)
|
OrderGroupDO orderGroupDO = OrderGroupDO.builder().id(groupId).orderId(orderId).organId(organId).bodyId(bodyId)
|
||||||
.groupTypeId(groupTypeId).groupTypeName(synthesis).name(combinationName).width(0.0).height(0.0)
|
.groupTypeId(groupTypeId).groupTypeName(synthesisTypeName).name(combinationName != " " ? combinationName : synthesisTypeName).width(0.0).height(0.0)
|
||||||
.depth(0.0).multiNum(0).plateNum(0).unregularNum(0).filename("无").remark("无").build();
|
.depth(0.0).multiNum(0).plateNum(0).unregularNum(0).filename("无").remark("无").build();
|
||||||
|
|
||||||
listCombinationName.forEach(combination -> {
|
listCombinationName.forEach(combination -> {
|
||||||
@@ -207,7 +206,7 @@ public class ExcelTypeRealize {
|
|||||||
.plateNo(combination.getPlateNo())
|
.plateNo(combination.getPlateNo())
|
||||||
.goodsId(combination.getGoodId())
|
.goodsId(combination.getGoodId())
|
||||||
.width(BigDecimal.valueOf(Double.parseDouble(combination.getWidth())))
|
.width(BigDecimal.valueOf(Double.parseDouble(combination.getWidth())))
|
||||||
.plateNo(((obtainingTime)+ Long.toString(plateNo).substring(2)))
|
.plateNo(((obtainingTime) + Long.toString(plateNo).substring(2)))
|
||||||
.height(BigDecimal.valueOf(Double.parseDouble(combination.getHeight())))
|
.height(BigDecimal.valueOf(Double.parseDouble(combination.getHeight())))
|
||||||
.thickness(BigDecimal.valueOf(Double.parseDouble(combination.getThickness())))
|
.thickness(BigDecimal.valueOf(Double.parseDouble(combination.getThickness())))
|
||||||
.splitWidth(BigDecimal.valueOf(Double.parseDouble(combination.getSplitWidth())))
|
.splitWidth(BigDecimal.valueOf(Double.parseDouble(combination.getSplitWidth())))
|
||||||
@@ -229,7 +228,7 @@ public class ExcelTypeRealize {
|
|||||||
|
|
||||||
OrderItemDO orderItemDO = OrderItemDO.builder().orderId(orderId).type(OrderItemTypeEnum.PLATE_ITEM.getStatus())
|
OrderItemDO orderItemDO = OrderItemDO.builder().orderId(orderId).type(OrderItemTypeEnum.PLATE_ITEM.getStatus())
|
||||||
.roomId(roomId).bodyId(bodyId).plateId(plateId)
|
.roomId(roomId).bodyId(bodyId).plateId(plateId)
|
||||||
.num(1.0).groupId(groupId).build();
|
.num(1.0).groupId(synthesisTypeName != " " ? groupId : null).build();
|
||||||
orderItemDOS.add(orderItemDO);
|
orderItemDOS.add(orderItemDO);
|
||||||
orderModelDOS.add(OrderModelDO.builder().orderId(orderId).plateId(plateId)
|
orderModelDOS.add(OrderModelDO.builder().orderId(orderId).plateId(plateId)
|
||||||
.typographicFace(Integer.valueOf(typographyDTO.getValue())).build());
|
.typographicFace(Integer.valueOf(typographyDTO.getValue())).build());
|
||||||
@@ -249,14 +248,14 @@ public class ExcelTypeRealize {
|
|||||||
.remark(remarkExtract(combination.remarkJSON())).build();
|
.remark(remarkExtract(combination.remarkJSON())).build();
|
||||||
orderPartsRemarks.add(orderPartsRemark);
|
orderPartsRemarks.add(orderPartsRemark);
|
||||||
OrderItemDO orderItemDO = OrderItemDO.builder().orderId(orderId).type(OrderItemTypeEnum.PARTS_ITEM.getStatus())
|
OrderItemDO orderItemDO = OrderItemDO.builder().orderId(orderId).type(OrderItemTypeEnum.PARTS_ITEM.getStatus())
|
||||||
.roomId(roomId).bodyId(bodyId).partsId(partsId).groupId(groupId)
|
.roomId(roomId).bodyId(bodyId).partsId(partsId).groupId(synthesisTypeName != " " ? groupId : null)
|
||||||
.num(Double.valueOf(combination.getGoodsNumber())).build();
|
.num(Double.valueOf(combination.getGoodsNumber())).build();
|
||||||
orderItemDOS.add(orderItemDO);
|
orderItemDOS.add(orderItemDO);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
orderGroupDO.setPlateNum(plateCountByCombination[0].intValue());
|
orderGroupDO.setPlateNum(plateCountByCombination[0].intValue());
|
||||||
if (orderGroupDO.getName() != null && !orderGroupDO.getName().trim().isEmpty()) {
|
if (orderGroupDO.getGroupTypeName() != null && !orderGroupDO.getGroupTypeName().trim().isEmpty()) {
|
||||||
orderGroupDOS.add(orderGroupDO);
|
orderGroupDOS.add(orderGroupDO);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -279,8 +278,8 @@ public class ExcelTypeRealize {
|
|||||||
map.put("orderModuleExtraDOS", orderModuleExtraDOS);
|
map.put("orderModuleExtraDOS", orderModuleExtraDOS);
|
||||||
map.put("orderModelDOS", orderModelDOS);
|
map.put("orderModelDOS", orderModelDOS);
|
||||||
map.put("orderPartsRemarks", orderPartsRemarks);
|
map.put("orderPartsRemarks", orderPartsRemarks);
|
||||||
System.out.println(" goodsDOS " + goodsDOS);
|
System.out.println(" orderGroupDOS " + orderGroupDOS);
|
||||||
System.out.println(" rawGoodsDOS " + rawGoodsDOS);
|
System.out.println(" orderItemDOS " + orderItemDOS);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-2
@@ -102,12 +102,12 @@ public class OrderPlateImportExcelVO {
|
|||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
private String cabinetsName;
|
private String cabinetsName;
|
||||||
|
|
||||||
@ExcelProperty(value = "加工组类型")
|
@ExcelIgnore
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
private String synthesis;
|
private String synthesis;
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
@ExcelIgnore
|
@ExcelProperty(value = "加工组类型")
|
||||||
private String synthesisTypeName;//加工组类型的名称
|
private String synthesisTypeName;//加工组类型的名称
|
||||||
|
|
||||||
@ExcelProperty(value = "加工组名称")
|
@ExcelProperty(value = "加工组名称")
|
||||||
@@ -208,6 +208,10 @@ public class OrderPlateImportExcelVO {
|
|||||||
@ExcelIgnore
|
@ExcelIgnore
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
@ExcelIgnore
|
||||||
|
private Double area; //面积
|
||||||
|
|
||||||
//备注转json数据
|
//备注转json数据
|
||||||
public String remarkJSON() {
|
public String remarkJSON() {
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|||||||
+4
-3
@@ -84,12 +84,13 @@
|
|||||||
<select id="selectOrderStatusCount" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatusRespVO">
|
<select id="selectOrderStatusCount" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderStatusRespVO">
|
||||||
select
|
select
|
||||||
o.status as orderState,
|
o.status as orderState,
|
||||||
count(o.id) as orderCount
|
count(o.id) as orderCount,
|
||||||
|
o.order_date
|
||||||
from orders o
|
from orders o
|
||||||
where o.organ_id = #{organId}
|
where o.organ_id = #{organId}
|
||||||
and DATE(o.order_date) >= #{orderDate}
|
and DATE(o.order_date) between #{startTime} and #{endTime}
|
||||||
and o.deleted = 0
|
and o.deleted = 0
|
||||||
group by o.status
|
group by o.status, o.order_date
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectOrderNear" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderOverdueRespVO">
|
<select id="selectOrderNear" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderOverdueRespVO">
|
||||||
|
|||||||
+44
-4
@@ -605,7 +605,7 @@
|
|||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectPlateAnalysisList" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderGoodsPlateRespVO">
|
<select id="selectPlateAnalysisListByCount" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderGoodsPlateRespVO">
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
MIN(g.brand) AS brand,
|
MIN(g.brand) AS brand,
|
||||||
@@ -626,10 +626,50 @@
|
|||||||
LEFT JOIN order_plate a ON g.id = a.goods_id AND g.organ_id = a.organ_id
|
LEFT JOIN order_plate a ON g.id = a.goods_id AND g.organ_id = a.organ_id
|
||||||
LEFT JOIN orders o ON o.id = a.order_id
|
LEFT JOIN orders o ON o.id = a.order_id
|
||||||
WHERE
|
WHERE
|
||||||
o.organ_id = #{organId}
|
a.deleted = 0
|
||||||
AND a.deleted = 0
|
AND DATE(o.order_date) BETWEEN #{startTime} AND #{endTime}
|
||||||
AND DATE(o.order_date) >= #{orderDate}
|
<if test="organId != null">
|
||||||
|
AND o.organ_id = #{organId}
|
||||||
|
</if>
|
||||||
GROUP BY
|
GROUP BY
|
||||||
g.goods_id
|
g.goods_id
|
||||||
|
HAVING
|
||||||
|
SUM(a.area) > 0
|
||||||
|
ORDER BY
|
||||||
|
orderCount DESC;
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectPlateAnalysisListByArea" resultType="com.cf.imes.module.executor.controller.admin.order.vo.order.OrderGoodsPlateRespVO">
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
MIN(g.brand) AS brand,
|
||||||
|
MIN(g.color) AS color,
|
||||||
|
g.goods_id,
|
||||||
|
MIN(g.goods_name) AS goods_name,
|
||||||
|
MIN(g.height) AS height,
|
||||||
|
MIN(g.material) AS material,
|
||||||
|
MIN(g.spec) AS spec,
|
||||||
|
MIN(g.texture) AS texture,
|
||||||
|
MIN(g.thickness) AS thickness,
|
||||||
|
MIN(g.width) AS width,
|
||||||
|
MIN(o.order_date) AS orderDate,
|
||||||
|
SUM(a.area) AS orderArea,
|
||||||
|
COUNT(a.id) AS orderCount
|
||||||
|
FROM
|
||||||
|
order_goods g
|
||||||
|
LEFT JOIN order_plate a ON g.id = a.goods_id AND g.organ_id = a.organ_id
|
||||||
|
LEFT JOIN orders o ON o.id = a.order_id
|
||||||
|
WHERE
|
||||||
|
a.deleted = 0
|
||||||
|
AND DATE(o.order_date) BETWEEN #{startTime} AND #{endTime}
|
||||||
|
<if test="organId != null">
|
||||||
|
AND o.organ_id = #{organId}
|
||||||
|
</if>
|
||||||
|
GROUP BY
|
||||||
|
g.goods_id
|
||||||
|
HAVING
|
||||||
|
SUM(a.area) > 0
|
||||||
|
ORDER BY
|
||||||
|
orderArea DESC;
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
Reference in New Issue
Block a user