mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
+2
-2
@@ -51,11 +51,11 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode RAW_GOODS_NOT_EXISTS = new ErrorCode(1_002_029_005, "生产单中未用到此板材");
|
||||
ErrorCode ORDER_STATUS_ERROR = new ErrorCode(1_002_029_006, "生产单不允许删除");
|
||||
ErrorCode APP_TOKEN_ERROR = new ErrorCode(1_002_029_007, "token获取失败");
|
||||
ErrorCode PLATE_PLAN_DATA_ERROR = new ErrorCode(1_002_029_008, "板材数据获取错误");
|
||||
ErrorCode PLATE_PLAN_DATA_ERROR = new ErrorCode(1_002_029_008, "板材生产数据获取错误或此单为空单");
|
||||
ErrorCode PARTS_DATA_ERROR = new ErrorCode(1_002_029_009, "配件数据获取错误");
|
||||
ErrorCode BODY_DATA_ERROR = new ErrorCode(1_002_029_010, "柜体数据获取错误");
|
||||
ErrorCode GOODS_DATA_ERROR = new ErrorCode(1_002_029_011, "商品信息获取错误");
|
||||
ErrorCode PLATE_DATA_ERROR = new ErrorCode(1_002_029_012, "板材数据获取错误");
|
||||
ErrorCode PLATE_DATA_ERROR = new ErrorCode(1_002_029_012, "板材明细获取错误");
|
||||
ErrorCode FILE_READ_SUCCESS = new ErrorCode(1_002_029_012, "文件读取成功");
|
||||
ErrorCode FILE_READ_ERR = new ErrorCode(1_002_029_012, "文件读取错误");
|
||||
}
|
||||
|
||||
+2
@@ -3,12 +3,14 @@ package com.cf.imes.module.executor;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
/**
|
||||
* @author there
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableFeignClients
|
||||
@EnableAsync
|
||||
public class ExecutorServerApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ExecutorServerApplication.class, args);
|
||||
|
||||
+46
-13
@@ -7,6 +7,7 @@ import com.cf.imes.module.executor.controller.admin.order.vo.product.OrderBodyRe
|
||||
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRespVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
|
||||
import com.cf.imes.module.executor.util.fileConversion.admin.api.webcad.ApiDataAchieve;
|
||||
import com.cf.imes.module.executor.util.fileConversion.admin.api.webcad.ApiTypeRealize;
|
||||
import com.cf.imes.module.executor.util.fileConversion.admin.files.excel.ExcelReadUtil;
|
||||
import com.cf.imes.module.executor.util.fileConversion.admin.files.excel.OrderPlateImportExcelVO;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
@@ -52,6 +53,8 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 生产单管理")
|
||||
@@ -69,6 +72,9 @@ public class OrderController {
|
||||
@Resource
|
||||
private ApiDataAchieve apiDataAchieve;
|
||||
|
||||
@Resource
|
||||
private ApiTypeRealize apiTypeRealize;
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(OrderController.class);
|
||||
|
||||
@PostMapping("/create")
|
||||
@@ -231,18 +237,34 @@ public class OrderController {
|
||||
@GetMapping("getApiData")
|
||||
@Operation(summary = "生产单api数据导入新增")
|
||||
@PreAuthorize("@ss.hasPermission('executor:order:getApiData')")
|
||||
public CommonResult<Long> test(@RequestParam(value = "orderNo", required = false, defaultValue = "20230809027818") String orderNo) throws InterruptedException {
|
||||
return success(orderService.importApiData(orderNo));
|
||||
// Long organId = SecurityFrameworkUtils.getLoginUser().getOrganId();
|
||||
// String token = apiDataAchieve.getApiToken(organId);
|
||||
// JSONObject dataPlates = apiDataAchieve.getApiPlateProData(token, orderNo);
|
||||
// JSONObject dataParts = apiDataAchieve.getApiPartsMessage(token, orderNo);
|
||||
// JSONObject dataBody = apiDataAchieve.getApiBodyMessage(token, orderNo);
|
||||
// JSONObject dataGoods = apiDataAchieve.getApiGoodsMessage(token, orderNo);
|
||||
// JSONObject plate = apiDataAchieve.getApiPlateDetailMessage(token, orderNo);
|
||||
// JSONObject dataModule = apiDataAchieve.getApiGroupMessage(token, orderNo);
|
||||
// JSONObject block = apiDataAchieve.getApiBlocksMessage(token, orderNo);
|
||||
// return success(null);
|
||||
public CommonResult<Long> test(@RequestParam(value = "orderNo", required = false, defaultValue = "20230809027818") String orderNo)
|
||||
throws InterruptedException, ExecutionException {
|
||||
// return success(orderService.importApiData(orderNo));
|
||||
Long organId = SecurityFrameworkUtils.getLoginUser().getOrganId();
|
||||
String token = apiDataAchieve.getApiToken(organId);
|
||||
JSONObject dataPlates = apiDataAchieve.getApiPlateProData(token, orderNo).get();
|
||||
JSONObject dataParts = apiDataAchieve.getApiPartsMessage(token, orderNo).get();
|
||||
JSONObject dataBody = apiDataAchieve.getApiBodyMessage(token, orderNo).get();
|
||||
JSONObject dataGoods = apiDataAchieve.getApiGoodsMessage(token, orderNo).get();
|
||||
JSONObject plate = apiDataAchieve.getApiPlateDetailMessage(token, orderNo).get();
|
||||
JSONObject dataModule = apiDataAchieve.getApiGroupMessage(token, orderNo).get();
|
||||
JSONObject block = apiDataAchieve.getApiBlocksMessage(token, orderNo).get();
|
||||
Map<String, List<?>> listMap = apiTypeRealize.apiPlateDataChange(
|
||||
dataPlates.getJSONObject("value"),//板件生产信息
|
||||
dataParts,// 配件信息
|
||||
dataBody, // 柜体信息
|
||||
dataGoods, // 商品信息
|
||||
plate, // 板件信息
|
||||
dataModule,// 加工组信息
|
||||
block); // 板材数据
|
||||
// System.out.println(" dataPlates" + dataPlates + "/n"
|
||||
// + " dataParts" + dataParts + "/n"
|
||||
// + " dataBody" + dataBody + "/n"
|
||||
// + " dataGoods" + dataGoods + "/n"
|
||||
// + " plate" + plate + "/n"
|
||||
// + " dataModule" + dataModule + "/n"
|
||||
// + " block" + block);
|
||||
return success(orderService.importApiData(listMap));
|
||||
}
|
||||
|
||||
@PostMapping("/importFile")
|
||||
@@ -273,7 +295,7 @@ public class OrderController {
|
||||
}else {
|
||||
// 获取数据
|
||||
list = (List<?>) map.get("plate");
|
||||
orderDO = excelReadUtil.changeOrderDO((Map<Object, Object>) map.get("order")).setOrderType(0);
|
||||
orderDO = excelReadUtil.changeOrderDO((Map<Object, Object>) map.get("order")).setOrderType(0).setStatus(1);
|
||||
}
|
||||
} else if (type == 1) { // json
|
||||
|
||||
@@ -292,4 +314,15 @@ public class OrderController {
|
||||
List<GoodsDO> goodsDOS = orderService.getGoodsList(orderId);
|
||||
return success(goodsDOS);
|
||||
}
|
||||
|
||||
@GetMapping("/uploadFiles")
|
||||
@Operation(summary = "导入生产数据文件模板那")
|
||||
@Parameters({
|
||||
@Parameter(name = "file", description = "文件", required = true),
|
||||
@Parameter(name = "type", description = "文件类型名称", required = true)
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('executor:order:upload')")
|
||||
public CommonResult<List<OrderBodyRespVO>> getOrderBody(@RequestParam("orderId") Long orderId) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -39,7 +39,7 @@ public class OrderPageReqVO extends PageParam {
|
||||
@Schema(description = "CAD数据类型,1CAD 2WebCAD 3Excel", example = "1")
|
||||
private Integer dataType;
|
||||
|
||||
@Schema(description = "订单状态,0未排单1已排单2生产中3加工完成4打包完成5入库完成6出库完成", example = "1")
|
||||
@Schema(description = "订单状态,订单状态,0空订单1新单2生产中3生产完成", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "自定义单号")
|
||||
|
||||
+2
-2
@@ -39,8 +39,8 @@ public class OrderRespVO {
|
||||
@ExcelProperty("CAD数据类型,1CAD 2WebCAD 3Excel")
|
||||
private Integer dataType;
|
||||
|
||||
@Schema(description = "订单状态,0未排单1已排单2生产中3加工完成4打包完成5入库完成6出库完成", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("订单状态,0未排单1已排单2生产中3加工完成4打包完成5入库完成6出库完成")
|
||||
@Schema(description = "订单状态,订单状态,0空订单1新单2生产中3生产完成", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("订单状态,订单状态,0空订单1新单2生产中3生产完成")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "自定义单号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
|
||||
+2
-2
@@ -39,8 +39,8 @@ public class OrderSaveReqVO {
|
||||
@NotNull(message = "CAD数据类型,1CAD 2WebCAD 3Excel不能为空")
|
||||
private Integer dataType;
|
||||
|
||||
@Schema(description = "订单状态,0未排单1已排单2生产中3加工完成4打包完成5入库完成6出库完成", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "订单状态,0未排单1已排单2生产中3加工完成4打包完成5入库完成6出库完成不能为空")
|
||||
@Schema(description = "订单状态,订单状态,0空订单1新单2生产中3生产完成", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "订单状态,订单状态,0空订单1新单2生产中3生产完成")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "自定义单号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ public class OrderDO extends BaseDO {
|
||||
*/
|
||||
private Integer dataType;
|
||||
/**
|
||||
* 订单状态,0未排单1已排单2生产中3加工完成4打包完成5入库完成6出库完成
|
||||
* 订单状态,订单状态,0空订单1新单2生产中3生产完成
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
|
||||
+5
-2
@@ -121,12 +121,12 @@ public interface OrderService {
|
||||
List<OrderBodyDO> getBody(Long orderId);
|
||||
|
||||
/**
|
||||
* @param orderNo:生产单号
|
||||
* @param listMap:生产单号
|
||||
* @return Boolean
|
||||
* @author Administrator
|
||||
* @date 2024/3/30
|
||||
*/
|
||||
Long importApiData(String orderNo);
|
||||
Long importApiData(Map<String, List<?>> listMap);
|
||||
|
||||
/**
|
||||
* @param orderId: 生产单Id
|
||||
@@ -134,5 +134,8 @@ public interface OrderService {
|
||||
*/
|
||||
List<GoodsDO> getGoodsList(Long orderId);
|
||||
|
||||
/**
|
||||
* 文件导入
|
||||
*/
|
||||
void importExcelData(OrderDO orderDO, List<?> list);
|
||||
}
|
||||
+108
-110
@@ -282,114 +282,114 @@ public class OrderServiceImpl implements OrderService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long importApiData(String orderNo) {
|
||||
// 获取token
|
||||
Long organId = SecurityFrameworkUtils.getLoginUser().getOrganId();
|
||||
JSONObject app = applicationApi.getApplicationByOrganId(organId);
|
||||
String appId = app.getString("appId");
|
||||
String appSecret = app.getString("appSecret");
|
||||
|
||||
JSONObject json = apiOrderService.getApiTokenMessage(appId, appSecret);
|
||||
if (!json.getString("err_msg").equals("success")) {
|
||||
throw exception(APP_TOKEN_ERROR);
|
||||
}
|
||||
String token = json.getJSONObject("info").getString("access_token");
|
||||
// 获取板件生产数据信息
|
||||
JSONObject jsonPlatesData = new JSONObject();
|
||||
jsonPlatesData.put("order_no", orderNo);//生产单号需要传入赋值
|
||||
jsonPlatesData.put("format", "json");
|
||||
JSONObject dataPlates = apiOrderService.getApiOrderMessage(token, jsonPlatesData);
|
||||
if (!dataPlates.getString("err_code").equals("0")) {
|
||||
throw exception(PLATE_PLAN_DATA_ERROR);
|
||||
}
|
||||
// 获取配件信息 分页获取
|
||||
JSONObject jsonParts = new JSONObject();
|
||||
jsonParts.put("curr_page", 1);
|
||||
jsonParts.put("page_count", PARTS_PAGE_MAX);
|
||||
jsonParts.put("order_no", orderNo);
|
||||
JSONObject parts = apiOrderService.getApiOrderPartsMessage(token, jsonParts);
|
||||
if (!parts.getString("err_code").equals("0")) {
|
||||
throw exception(PARTS_DATA_ERROR);
|
||||
}
|
||||
JSONObject dataParts = new JSONObject();
|
||||
for (int i = 1; i <= parts.getJSONObject("value").getInteger("PageCount"); i++) {
|
||||
jsonParts.put("curr_page", i);
|
||||
JSONObject value = apiOrderService.getApiOrderPartsMessage(token, jsonParts);
|
||||
dataParts = mergeJSONObjects(dataParts, value);
|
||||
}
|
||||
// 柜体信息转换
|
||||
JSONObject jsonBody = new JSONObject();
|
||||
jsonBody.put("curr_page", 1);
|
||||
jsonBody.put("page_count", PARTS_PAGE_MAX);
|
||||
jsonBody.put("order_no", orderNo);
|
||||
JSONObject body = apiOrderService.getApiOrderBodyMessage(token, jsonBody);
|
||||
if (!body.getString("err_code").equals("0")) {
|
||||
throw exception(BODY_DATA_ERROR);
|
||||
}
|
||||
JSONObject dataBody = new JSONObject();
|
||||
for (int i = 1; i <= body.getJSONObject("value").getInteger("PageCount"); i++) {
|
||||
jsonBody.put("curr_page", i);
|
||||
JSONObject value = apiOrderService.getApiOrderBodyMessage(token, jsonBody);
|
||||
dataBody = mergeJSONObjects(dataBody, value);
|
||||
}
|
||||
// 商品信息转换
|
||||
JSONObject jsonGoods = new JSONObject();
|
||||
jsonGoods.put("curr_page", 1);
|
||||
jsonGoods.put("page_count", PARTS_PAGE_MAX);
|
||||
jsonGoods.put("order_no", orderNo);
|
||||
JSONObject goods = apiOrderService.getApiOrderGoodsMessage(token, jsonGoods);
|
||||
if (!goods.getString("err_code").equals("0")) {
|
||||
throw exception(GOODS_DATA_ERROR);
|
||||
}
|
||||
JSONObject dataGoods = new JSONObject();
|
||||
for (int i = 1; i <= goods.getJSONObject("value").getInteger("PageCount"); i++) {
|
||||
jsonGoods.put("curr_page", i);
|
||||
JSONObject value = apiOrderService.getApiOrderGoodsMessage(token, jsonGoods);
|
||||
dataGoods = mergeJSONObjects(dataGoods, value);
|
||||
}
|
||||
// 板材明细信息转换
|
||||
JSONObject jsonPlates = new JSONObject();
|
||||
jsonPlates.put("curr_page", 1);
|
||||
jsonPlates.put("page_count", PARTS_PAGE_MAX);
|
||||
jsonPlates.put("order_no", orderNo);
|
||||
JSONObject plates = apiOrderService.getApiBlocksDataMessage(token, jsonPlates);
|
||||
if (!plates.getString("err_code").equals("0")) {
|
||||
throw exception(PLATE_DATA_ERROR);
|
||||
}
|
||||
JSONObject plate = new JSONObject();
|
||||
for (int i = 1; i <= plates.getJSONObject("value").getInteger("PageCount"); i++) {
|
||||
jsonPlates.put("curr_page", i);
|
||||
JSONObject value = apiOrderService.getApiBlocksDataMessage(token, jsonPlates);
|
||||
plate = mergeJSONObjects(plate, value);
|
||||
}
|
||||
// 加工组信息转换
|
||||
JSONObject jsonModule = new JSONObject();
|
||||
jsonModule.put("order_no", orderNo);
|
||||
JSONObject dataModule = apiOrderService.getApiModuleTypeDataMessage(token, jsonModule);
|
||||
|
||||
// 板材数据信息转换
|
||||
JSONObject jsonBlocks = new JSONObject();
|
||||
jsonBlocks.put("curr_page", 1);
|
||||
jsonBlocks.put("page_count", PARTS_PAGE_MAX);
|
||||
jsonBlocks.put("order_no", orderNo);
|
||||
JSONObject blocks = apiOrderService.getApiBlocksMessage(token, jsonBlocks);
|
||||
if (!blocks.getString("err_code").equals("0")) {
|
||||
throw exception(PLATE_DATA_ERROR);
|
||||
}
|
||||
JSONObject block = new JSONObject();
|
||||
for (int i = 1; i <= blocks.getJSONObject("value").getInteger("PageCount"); i++) {
|
||||
jsonBlocks.put("curr_page", i);
|
||||
JSONObject value = apiOrderService.getApiBlocksMessage(token, jsonBlocks);
|
||||
block = mergeJSONObjects(block, value);
|
||||
}
|
||||
Map<String, List<?>> listMap = apiTypeRealize.apiPlateDataChange(
|
||||
dataPlates.getJSONObject("value"),//板件生产信息
|
||||
dataParts,// 配件信息
|
||||
dataBody, // 柜体信息
|
||||
dataGoods, // 商品信息
|
||||
plate, // 板件信息
|
||||
dataModule,// 加工组信息
|
||||
block); // 板材数据
|
||||
public Long importApiData(Map<String, List<?>> listMap) {
|
||||
//// 获取token
|
||||
// Long organId = SecurityFrameworkUtils.getLoginUser().getOrganId();
|
||||
// JSONObject app = applicationApi.getApplicationByOrganId(organId);
|
||||
// String appId = app.getString("appId");
|
||||
// String appSecret = app.getString("appSecret");
|
||||
//
|
||||
// JSONObject json = apiOrderService.getApiTokenMessage(appId, appSecret);
|
||||
// if (!json.getString("err_msg").equals("success")) {
|
||||
// throw exception(APP_TOKEN_ERROR);
|
||||
// }
|
||||
// String token = json.getJSONObject("info").getString("access_token");
|
||||
//// 获取板件生产数据信息
|
||||
// JSONObject jsonPlatesData = new JSONObject();
|
||||
// jsonPlatesData.put("order_no", orderNo);//生产单号需要传入赋值
|
||||
// jsonPlatesData.put("format", "json");
|
||||
// JSONObject dataPlates = apiOrderService.getApiOrderMessage(token, jsonPlatesData);
|
||||
// if (!dataPlates.getString("err_code").equals("0")) {
|
||||
// throw exception(PLATE_PLAN_DATA_ERROR);
|
||||
// }
|
||||
//// 获取配件信息 分页获取
|
||||
// JSONObject jsonParts = new JSONObject();
|
||||
// jsonParts.put("curr_page", 1);
|
||||
// jsonParts.put("page_count", PARTS_PAGE_MAX);
|
||||
// jsonParts.put("order_no", orderNo);
|
||||
// JSONObject parts = apiOrderService.getApiOrderPartsMessage(token, jsonParts);
|
||||
// if (!parts.getString("err_code").equals("0")) {
|
||||
// throw exception(PARTS_DATA_ERROR);
|
||||
// }
|
||||
// JSONObject dataParts = new JSONObject();
|
||||
// for (int i = 1; i <= parts.getJSONObject("value").getInteger("PageCount"); i++) {
|
||||
// jsonParts.put("curr_page", i);
|
||||
// JSONObject value = apiOrderService.getApiOrderPartsMessage(token, jsonParts);
|
||||
// dataParts = mergeJSONObjects(dataParts, value);
|
||||
// }
|
||||
//// 柜体信息转换
|
||||
// JSONObject jsonBody = new JSONObject();
|
||||
// jsonBody.put("curr_page", 1);
|
||||
// jsonBody.put("page_count", PARTS_PAGE_MAX);
|
||||
// jsonBody.put("order_no", orderNo);
|
||||
// JSONObject body = apiOrderService.getApiOrderBodyMessage(token, jsonBody);
|
||||
// if (!body.getString("err_code").equals("0")) {
|
||||
// throw exception(BODY_DATA_ERROR);
|
||||
// }
|
||||
// JSONObject dataBody = new JSONObject();
|
||||
// for (int i = 1; i <= body.getJSONObject("value").getInteger("PageCount"); i++) {
|
||||
// jsonBody.put("curr_page", i);
|
||||
// JSONObject value = apiOrderService.getApiOrderBodyMessage(token, jsonBody);
|
||||
// dataBody = mergeJSONObjects(dataBody, value);
|
||||
// }
|
||||
//// 商品信息转换
|
||||
// JSONObject jsonGoods = new JSONObject();
|
||||
// jsonGoods.put("curr_page", 1);
|
||||
// jsonGoods.put("page_count", PARTS_PAGE_MAX);
|
||||
// jsonGoods.put("order_no", orderNo);
|
||||
// JSONObject goods = apiOrderService.getApiOrderGoodsMessage(token, jsonGoods);
|
||||
// if (!goods.getString("err_code").equals("0")) {
|
||||
// throw exception(GOODS_DATA_ERROR);
|
||||
// }
|
||||
// JSONObject dataGoods = new JSONObject();
|
||||
// for (int i = 1; i <= goods.getJSONObject("value").getInteger("PageCount"); i++) {
|
||||
// jsonGoods.put("curr_page", i);
|
||||
// JSONObject value = apiOrderService.getApiOrderGoodsMessage(token, jsonGoods);
|
||||
// dataGoods = mergeJSONObjects(dataGoods, value);
|
||||
// }
|
||||
//// 板材明细信息转换
|
||||
// JSONObject jsonPlates = new JSONObject();
|
||||
// jsonPlates.put("curr_page", 1);
|
||||
// jsonPlates.put("page_count", PARTS_PAGE_MAX);
|
||||
// jsonPlates.put("order_no", orderNo);
|
||||
// JSONObject plates = apiOrderService.getApiBlocksDataMessage(token, jsonPlates);
|
||||
// if (!plates.getString("err_code").equals("0")) {
|
||||
// throw exception(PLATE_DATA_ERROR);
|
||||
// }
|
||||
// JSONObject plate = new JSONObject();
|
||||
// for (int i = 1; i <= plates.getJSONObject("value").getInteger("PageCount"); i++) {
|
||||
// jsonPlates.put("curr_page", i);
|
||||
// JSONObject value = apiOrderService.getApiBlocksDataMessage(token, jsonPlates);
|
||||
// plate = mergeJSONObjects(plate, value);
|
||||
// }
|
||||
//// 加工组信息转换
|
||||
// JSONObject jsonModule = new JSONObject();
|
||||
// jsonModule.put("order_no", orderNo);
|
||||
// JSONObject dataModule = apiOrderService.getApiModuleTypeDataMessage(token, jsonModule);
|
||||
//
|
||||
//// 板材数据信息转换
|
||||
// JSONObject jsonBlocks = new JSONObject();
|
||||
// jsonBlocks.put("curr_page", 1);
|
||||
// jsonBlocks.put("page_count", PARTS_PAGE_MAX);
|
||||
// jsonBlocks.put("order_no", orderNo);
|
||||
// JSONObject blocks = apiOrderService.getApiBlocksMessage(token, jsonBlocks);
|
||||
// if (!blocks.getString("err_code").equals("0")) {
|
||||
// throw exception(PLATE_DATA_ERROR);
|
||||
// }
|
||||
// JSONObject block = new JSONObject();
|
||||
// for (int i = 1; i <= blocks.getJSONObject("value").getInteger("PageCount"); i++) {
|
||||
// jsonBlocks.put("curr_page", i);
|
||||
// JSONObject value = apiOrderService.getApiBlocksMessage(token, jsonBlocks);
|
||||
// block = mergeJSONObjects(block, value);
|
||||
// }
|
||||
// Map<String, List<?>> listMap = apiTypeRealize.apiPlateDataChange(
|
||||
// dataPlates.getJSONObject("value"),//板件生产信息
|
||||
// dataParts,// 配件信息
|
||||
// dataBody, // 柜体信息
|
||||
// dataGoods, // 商品信息
|
||||
// plate, // 板件信息
|
||||
// dataModule,// 加工组信息
|
||||
// block); // 板材数据
|
||||
List<OrderDO> order = (List<OrderDO>) listMap.get("orderDO");
|
||||
List<GoodsDO> goodsDO = (List<GoodsDO>) listMap.get("goodsDO");
|
||||
List<RawGoodsDO> rawGoodsDO = (List<RawGoodsDO>) listMap.get("rawGoodsDO");
|
||||
@@ -408,9 +408,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
orderInputProcessor.batchInsert(rawGoodsDO, bodyDO, groupDO, partsDO, plateDO, null, itemDO, order.get(0), goodsDO, plateGoodDOS);
|
||||
List<OrderModelDO> orderModelDOs = BeanUtils.toBean(plateDetail, OrderModelDO.class);
|
||||
orderModelDOs.forEach(orderModelDO -> orderModelDO.setOrderId(order.get(0).getId()));
|
||||
|
||||
orderInputProcessor.batchSaveModel(orderModelDOs);
|
||||
|
||||
return order.get(0).getId();
|
||||
// return null;
|
||||
}
|
||||
|
||||
+25
-21
@@ -2,13 +2,17 @@ package com.cf.imes.module.executor.util.fileConversion.admin.api.webcad;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import com.cf.imes.module.system.api.application.ApplicationApi;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.AsyncResult;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||
|
||||
@@ -42,8 +46,8 @@ public class ApiDataAchieve {
|
||||
}
|
||||
|
||||
// 获取板件生产数据信息
|
||||
// @Async
|
||||
public JSONObject getApiPlateProData(String token, String orderNo) {
|
||||
@Async
|
||||
public Future<JSONObject> getApiPlateProData(String token, String orderNo) {
|
||||
JSONObject jsonPlatesData = new JSONObject();
|
||||
jsonPlatesData.put("order_no", orderNo);//生产单号需要传入赋值
|
||||
jsonPlatesData.put("format", "json");
|
||||
@@ -51,12 +55,12 @@ public class ApiDataAchieve {
|
||||
if (!dataPlates.getString("err_code").equals("0")) {
|
||||
throw exception(PLATE_PLAN_DATA_ERROR);
|
||||
}
|
||||
return dataPlates;
|
||||
return new AsyncResult<>(dataPlates);
|
||||
}
|
||||
|
||||
// 获取配件信息 分页获取
|
||||
// @Async
|
||||
public JSONObject getApiPartsMessage(String token, String orderNo) {
|
||||
@Async
|
||||
public Future<JSONObject> getApiPartsMessage(String token, String orderNo) {
|
||||
JSONObject jsonParts = new JSONObject();
|
||||
jsonParts.put("curr_page", 1);
|
||||
jsonParts.put("page_count", PARTS_PAGE_MAX);
|
||||
@@ -71,12 +75,12 @@ public class ApiDataAchieve {
|
||||
JSONObject value = apiDataProduction.getApiOrderPartsMessage(token, jsonParts);
|
||||
dataParts = mergeJSONObjects(dataParts, value);
|
||||
}
|
||||
return dataParts;
|
||||
return new AsyncResult<>(dataParts);
|
||||
}
|
||||
|
||||
// 柜体信息转换
|
||||
// @Async
|
||||
public JSONObject getApiBodyMessage(String token, String orderNo) {
|
||||
@Async
|
||||
public Future<JSONObject> getApiBodyMessage(String token, String orderNo) {
|
||||
JSONObject jsonBody = new JSONObject();
|
||||
jsonBody.put("curr_page", 1);
|
||||
jsonBody.put("page_count", PARTS_PAGE_MAX);
|
||||
@@ -91,12 +95,12 @@ public class ApiDataAchieve {
|
||||
JSONObject value = apiDataProduction.getApiOrderBodyMessage(token, jsonBody);
|
||||
dataBody = mergeJSONObjects(dataBody, value);
|
||||
}
|
||||
return dataBody;
|
||||
return new AsyncResult<>(dataBody);
|
||||
}
|
||||
|
||||
// 商品信息转换
|
||||
// @Async
|
||||
public JSONObject getApiGoodsMessage(String token, String orderNo) {
|
||||
@Async
|
||||
public Future<JSONObject> getApiGoodsMessage(String token, String orderNo) {
|
||||
JSONObject jsonGoods = new JSONObject();
|
||||
jsonGoods.put("curr_page", 1);
|
||||
jsonGoods.put("page_count", PARTS_PAGE_MAX);
|
||||
@@ -111,12 +115,12 @@ public class ApiDataAchieve {
|
||||
JSONObject value = apiDataProduction.getApiOrderGoodsMessage(token, jsonGoods);
|
||||
dataGoods = mergeJSONObjects(dataGoods, value);
|
||||
}
|
||||
return dataGoods;
|
||||
return new AsyncResult<>(dataGoods);
|
||||
}
|
||||
|
||||
// 板材明细信息转换
|
||||
// @Async
|
||||
public JSONObject getApiPlateDetailMessage(String token, String orderNo) {
|
||||
@Async
|
||||
public Future<JSONObject> getApiPlateDetailMessage(String token, String orderNo) {
|
||||
JSONObject jsonPlates = new JSONObject();
|
||||
jsonPlates.put("curr_page", 1);
|
||||
jsonPlates.put("page_count", PARTS_PAGE_MAX);
|
||||
@@ -131,21 +135,21 @@ public class ApiDataAchieve {
|
||||
JSONObject value = apiDataProduction.getApiBlocksDataMessage(token, jsonPlates);
|
||||
plate = mergeJSONObjects(plate, value);
|
||||
}
|
||||
return plate;
|
||||
return new AsyncResult<>(plate);
|
||||
}
|
||||
|
||||
// 加工组信息转换
|
||||
// @Async
|
||||
public JSONObject getApiGroupMessage(String token, String orderNo) {
|
||||
@Async
|
||||
public Future<JSONObject> getApiGroupMessage(String token, String orderNo) {
|
||||
JSONObject jsonModule = new JSONObject();
|
||||
jsonModule.put("order_no", orderNo);
|
||||
JSONObject dataModule = apiDataProduction.getApiModuleTypeDataMessage(token, jsonModule);
|
||||
return dataModule;
|
||||
return new AsyncResult<>(dataModule);
|
||||
}
|
||||
|
||||
// 板材数据信息转换
|
||||
// @Async
|
||||
public JSONObject getApiBlocksMessage(String token, String orderNo) {
|
||||
@Async
|
||||
public Future<JSONObject> getApiBlocksMessage(String token, String orderNo) {
|
||||
JSONObject jsonBlocks = new JSONObject();
|
||||
jsonBlocks.put("curr_page", 1);
|
||||
jsonBlocks.put("page_count", PARTS_PAGE_MAX);
|
||||
@@ -160,7 +164,7 @@ public class ApiDataAchieve {
|
||||
JSONObject value = apiDataProduction.getApiBlocksMessage(token, jsonBlocks);
|
||||
block = mergeJSONObjects(block, value);
|
||||
}
|
||||
return block;
|
||||
return new AsyncResult<>(block);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+8
-7
@@ -212,7 +212,7 @@ public class ApiTypeRealize {
|
||||
.orderType(1)
|
||||
.orderSort(0)
|
||||
.dataType(2)
|
||||
.status(0)
|
||||
.status(1)
|
||||
.customOrderNo(order.getString("CustomOrderNo"))
|
||||
.customer(order.getString("Consigee"))
|
||||
.address(order.getString("ConsigeeAddress"))
|
||||
@@ -411,7 +411,7 @@ public class ApiTypeRealize {
|
||||
Map<Integer, PlateDetail> plateDetail = platesDetailChange(value);
|
||||
|
||||
// 板材数据
|
||||
Map<String,JSONObject> plateMap = getBlocksData(dataBlocks);
|
||||
Map<Integer,JSONObject> plateMap = getBlocksData(dataBlocks);
|
||||
|
||||
Map<String, Map<Integer, ?>> map = new HashMap<>();
|
||||
Map<Integer, PlateDO> platesInfos = new HashMap<>();
|
||||
@@ -490,7 +490,8 @@ public class ApiTypeRealize {
|
||||
.setDrillsRemark(plate.getString("DrillsRemark"))
|
||||
.setInfoRemark(plate.getString("InfoRemark"))
|
||||
.setRemarkJsonDei(plate.getString("RemarkJson"));
|
||||
plateInfo.setRemark(plateDetail.get(plate.getInteger("BlockNo")).getRemark().toString());
|
||||
plateInfo.setRemark(plateDetail.get(plate.getInteger("BlockNo")).getRemark() != null ?
|
||||
plateDetail.get(plate.getInteger("BlockNo")).getRemark().toString() : "");
|
||||
}
|
||||
if (plateMap.get(plate.getInteger("BlockNo")) != null) {
|
||||
JSONObject jsonObject = plateMap.get(plate.getInteger("BlockNo"));
|
||||
@@ -525,7 +526,7 @@ public class ApiTypeRealize {
|
||||
});
|
||||
num =0;
|
||||
});
|
||||
System.err.println(bodyInfos);
|
||||
// System.err.println(bodyInfos);
|
||||
map.put("platesInfos", platesInfos);
|
||||
map.put("platesItems", platesItem);
|
||||
map.put("plateDetail", plateDetail);
|
||||
@@ -536,13 +537,13 @@ public class ApiTypeRealize {
|
||||
/**
|
||||
* 板材数据转换成 Map<String, Object>
|
||||
*/
|
||||
public Map<String, JSONObject> getBlocksData(JSONObject dataBlocks) {
|
||||
Map<String, JSONObject> map = new HashMap<>();
|
||||
public Map<Integer, JSONObject> getBlocksData(JSONObject dataBlocks) {
|
||||
Map<Integer, JSONObject> map = new HashMap<>();
|
||||
JSONArray ordersArray = dataBlocks.getJSONArray("List");
|
||||
if (ordersArray != null && !ordersArray.isEmpty()) {
|
||||
for (int i = 0; i < ordersArray.size(); i++) {
|
||||
JSONObject block = ordersArray.getJSONObject(i);
|
||||
map.put(block.getString("BlockNo"), block);
|
||||
map.put(block.getInteger("BlockNo"), block);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
|
||||
Reference in New Issue
Block a user