mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
侧面造型修改
This commit is contained in:
+1
@@ -222,6 +222,7 @@ public class OrderController {
|
||||
JSONObject dataModule = apiDataAchieve.getApiGroupMessage(token, orderNo).get();
|
||||
JSONObject block = apiDataAchieve.getApiBlocksMessage(token, orderNo).get();
|
||||
Map<String, Object> listMap = apiTypeRealize.apiPlateDataChange(
|
||||
token,
|
||||
order,
|
||||
dataPlates,//板件生产信息
|
||||
dataParts,// 配件信息
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ public class OrderModelDO extends ESDocument {
|
||||
@Schema(description = "造型明细(凹槽)")
|
||||
private List<ModelDetail> contourDetail;
|
||||
@Schema(description = "造型明细(孤岛,现在是xml数据格式添加)")
|
||||
private List<ModelDetail> isletsDetail ; //造型明细(孤岛)
|
||||
private List<ModelDetail> sideDetail ; //造型明细(孤岛) sideDetail
|
||||
@Schema(description = "侧面孔明细列表")
|
||||
private List<HoleDetail> sideHoleDetail;
|
||||
|
||||
|
||||
+4
@@ -127,4 +127,8 @@ public interface OrderItemMapper extends BaseMapperX<OrderItemDO> {
|
||||
IPage<OrderGoodsDetailRespVO> selectGoodsDetailByOrderId(@Param("page") IPage page, @Param("orderId") Long orderId, @Param("roomId") Set<Long> roomId,
|
||||
@Param("bodyId") Set<Long> bodyId, @Param("groupId") Set<Long> groupId, @Param("goodsId") Set<Long> goodsId,
|
||||
@Param("organId") Long organId, @Param("deleted") Integer deleted);
|
||||
|
||||
List<Long> selectPartsNotId(@Param("orderId") Long orderId, @Param("roomId") Long roomId,
|
||||
@Param("bodyId") Long bodyId, @Param("groupId") Long groupId, @Param("goodsId") Long goodsId,
|
||||
@Param("organId") Long organId, @Param("deleted") Integer deleted);
|
||||
}
|
||||
+13
-2
@@ -291,6 +291,14 @@ public class OrderServiceImpl implements OrderService {
|
||||
List<Long> partsList = orderPartsMapper.selectPartsIdListByBodyId(bodyIds, getUserOrganId(), orderId); // 配件
|
||||
|
||||
if (!partsList.isEmpty()){
|
||||
// // 判断是否含有重复的配件
|
||||
// List<Long> partsNot = new ArrayList<>();
|
||||
// for (Long partsId : partsList) {
|
||||
// Long partNot = orderItemMapper.selectPartsNotId(partsId, getUserOrganId(), orderId);
|
||||
// if (!groupIds.isEmpty()) {
|
||||
// orderGroupMapper.updateDeletedGroup(groupIds, getUserOrganId(), orderId);
|
||||
// }
|
||||
// }
|
||||
orderPartsMapper.updateDeletedParts(partsList, getUserOrganId(),orderId);
|
||||
}
|
||||
|
||||
@@ -403,11 +411,11 @@ public class OrderServiceImpl implements OrderService {
|
||||
orderInputProcessor.batchInsert(rawGoodsDO, bodyDO, groupDO, partsDO, plateDO, itemDO, goodsDO, plateGoodDOS, partsDOS);
|
||||
List<OrderModelDO> orderModelDOs = BeanUtils.toBean(plateDetail, OrderModelDO.class);
|
||||
|
||||
if (!orderModelDOs.isEmpty()) {
|
||||
if (orderModelDOs != null && !orderModelDOs.isEmpty()) {
|
||||
orderModelDOs.forEach(orderModelDO -> orderModelDO.setOrderId(order.getId()));
|
||||
orderInputProcessor.batchSaveModel(orderModelDOs);
|
||||
}
|
||||
if (!partsRemark.isEmpty()) {
|
||||
if (partsRemark != null && !partsRemark.isEmpty()) {
|
||||
orderInputProcessor.batchSaveOrderPartsModel(partsRemark);
|
||||
}
|
||||
|
||||
@@ -727,6 +735,9 @@ public class OrderServiceImpl implements OrderService {
|
||||
Map<String, List<?>> map = new HashMap<>();
|
||||
List<PlateGoodDO> plateGoodLists = new ArrayList<>();
|
||||
|
||||
if (goodsLists == null) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
for (GoodsDO goodsDO : goodsLists) {
|
||||
PlateGoodDO plateGoodDO = null;
|
||||
List<PlateGoodDO> plateGoodDOS = null;
|
||||
|
||||
+1
-1
@@ -106,7 +106,7 @@ public class PlateDetail{
|
||||
private List<HoleDetail> holeDetail ; //孔明细,表示板上的孔
|
||||
private Map<String,Integer> contourCount;//凹槽数量集合 (xml中特有----槽所在板面的对应数量)
|
||||
private List<ModelDetail> contourDetail ; //造型明细(xml中为凹槽,将孤岛的信息放入槽中)
|
||||
// private List<ModelDetail> isletsDetail ; //造型明细(孤岛)不需要
|
||||
private List<ModelDetail> sideDetail ; //造型明细(侧面)
|
||||
|
||||
private List<HoleDetail> sideHoleDetail;//侧面孔明细
|
||||
|
||||
|
||||
+14
@@ -14,6 +14,7 @@ import javax.annotation.Resource;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
@@ -42,6 +43,7 @@ public class ApiDataAchieve {
|
||||
private static final String ERR_CODE_KEY = "err_code";
|
||||
private static final String PAGECOUNT_KEY = "PageCount";
|
||||
private static final String VALUE_KEY = "value";
|
||||
private static final String GOODS_ID = "goods_id";
|
||||
|
||||
|
||||
// 获得token数据
|
||||
@@ -182,6 +184,18 @@ public class ApiDataAchieve {
|
||||
return new AsyncResult<>(block);
|
||||
}
|
||||
|
||||
// 商品列表信息转换
|
||||
@Async
|
||||
public Future<JSONObject> getApiGoodsMessage(String token, Long[] id) {
|
||||
JSONObject jsonGoods = new JSONObject();
|
||||
jsonGoods.put(GOODS_ID, id);
|
||||
JSONObject good = apiDataProduction.getApiGoods(token, jsonGoods);
|
||||
if (!good.getString(ERR_CODE_KEY).equals("0")) {
|
||||
log.error("配件数据获取错误" + id);
|
||||
}
|
||||
return new AsyncResult<>(good);
|
||||
}
|
||||
|
||||
// 订单获取
|
||||
public Future<JSONObject> getApiOrder(String token, String shopId, String orderNo) {
|
||||
JSONObject jsonOrders = new JSONObject();
|
||||
|
||||
+4
@@ -45,4 +45,8 @@ public interface ApiDataProduction {
|
||||
// 订单列表
|
||||
@RequestMapping(value = "/Api-erpOrders-orderList",method = RequestMethod.POST)
|
||||
JSONObject getApiOrderList(@RequestParam("token") String token, @RequestBody JSONObject json);
|
||||
|
||||
// 商品列表
|
||||
@RequestMapping(value = "/Api-erpOrders-goodsData",method = RequestMethod.POST)
|
||||
JSONObject getApiGoods(@RequestParam("token") String token, @RequestBody JSONObject json);
|
||||
}
|
||||
|
||||
+91
-16
@@ -46,6 +46,9 @@ public class ApiTypeRealize {
|
||||
@Resource
|
||||
private SnowflakeIdWorker3rd idWorker;
|
||||
|
||||
@Resource
|
||||
private ApiDataAchieve apiDataAchieve;
|
||||
|
||||
|
||||
private static final Integer X = 0;
|
||||
private static final Integer Y = 1;
|
||||
@@ -53,6 +56,11 @@ public class ApiTypeRealize {
|
||||
|
||||
private static final Integer INDEX = 0;
|
||||
|
||||
private static String PART_WIDTH = "width";
|
||||
private static String PART_LENGTH = "length";
|
||||
private static String PART_THICKNESS = "thickness";
|
||||
private static String PART_COLOR = "color";
|
||||
private static String PART_MATERIAL = "material";
|
||||
/**
|
||||
* @param dataPlates: 板件生产信息 造型数据
|
||||
* @param dataParts: 配件信息
|
||||
@@ -63,7 +71,8 @@ public class ApiTypeRealize {
|
||||
* @param dataBlocks: 大板信息
|
||||
* @return Map<Long, List < ?>>
|
||||
*/
|
||||
public Map<String, Object> apiPlateDataChange(JSONObject order,
|
||||
public Map<String, Object> apiPlateDataChange(String token,
|
||||
JSONObject order,
|
||||
JSONObject dataPlates,
|
||||
JSONObject dataParts,
|
||||
JSONObject dataBody,
|
||||
@@ -99,7 +108,7 @@ public class ApiTypeRealize {
|
||||
|
||||
|
||||
// 配件
|
||||
Map<String, Object> partsDO = partsInfoChange(dataParts, orderId, goodsDOS, bodyInfoChange, organId);
|
||||
Map<String, Object> partsDO = partsInfoChange(dataParts, orderId, goodsDOS, bodyInfoChange, organId, token);
|
||||
|
||||
Map<Long, OrderPartsRemark> partsRemark = (Map<Long, OrderPartsRemark>) partsDO.get("remarks"); // 配件备注
|
||||
map.put(FieldConstants.PARTS_REMARK, new ArrayList<>(partsRemark.values()));
|
||||
@@ -117,28 +126,45 @@ public class ApiTypeRealize {
|
||||
Map<String, Object> platesDO = platesInfoChange(dataPlates, plates, orderId, goodsDOS, bodyInfoChange, dataBlocks, organId);
|
||||
|
||||
Map<Long, PlateDO> orderPlatesDO = (Map<Long, PlateDO>) platesDO.get("platesInfos");
|
||||
if (orderPlatesDO != null) {
|
||||
map.put(FieldConstants.PLATE, new ArrayList<>(orderPlatesDO.values()));
|
||||
}
|
||||
|
||||
|
||||
Map<Long, PlateDetail> plateDetail = (Map<Long, PlateDetail>) platesDO.get("plateDetail");
|
||||
if (plateDetail != null) {
|
||||
map.put(FieldConstants.PLATE_DETAIL, new ArrayList<>(plateDetail.values()));
|
||||
}
|
||||
|
||||
|
||||
Map<Long, OrderItemDO> platesItems = (Map<Long, OrderItemDO>) platesDO.get("platesItems");
|
||||
|
||||
Map<Long, OrderBodyDO> bodyItemsPlates = (Map<Long, OrderBodyDO>) platesDO.get("bodyInfos");
|
||||
|
||||
platesItems = orderPartsChange(orderGroupDO, groupLists, platesItems);// item补充
|
||||
if (platesItems != null) {
|
||||
itemsList.addAll(platesItems.values());
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (goodsDOS != null) {
|
||||
List<GoodsDO> goodsDO = new ArrayList<>(goodsDOS.values()); // (List<GoodsDO>)
|
||||
map.put(FieldConstants.GOODS, goodsDO);
|
||||
}
|
||||
|
||||
if (rawGoodsDOS != null) {
|
||||
List<RawGoodsDO> rawGoodsDO = new ArrayList<>(rawGoodsDOS.values());
|
||||
map.put(FieldConstants.RAW_GOODS, rawGoodsDO);
|
||||
}
|
||||
|
||||
|
||||
map.put(FieldConstants.GROUP, new ArrayList<>(groupAddUnregularNum(itemsList, orderPlatesDO, orderGroupDO).values()));
|
||||
map.put(FieldConstants.ITEM, itemsList);
|
||||
if (bodyItemsPlates != null) {
|
||||
map.put(FieldConstants.BODY, new ArrayList<>(bodyItemsPlates.values()));
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -197,6 +223,10 @@ public class ApiTypeRealize {
|
||||
Map<Long, PlateDO> orderPlatesDO,
|
||||
Map<Long, OrderGroupDO> orderGroupDO) {
|
||||
|
||||
if (itemsList == null || orderGroupDO == null || orderPlatesDO == null) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
Map<Long, List<OrderItemDO>> groupPlate = itemsList.stream().collect(Collectors.groupingBy(OrderItemDO::getGroupId));
|
||||
List<PlateDO> orderItemDOList = orderPlatesDO.values().stream().toList();
|
||||
Map<Long, PlateDO> plateDOMap = orderItemDOList.stream().collect(Collectors.toMap(PlateDO::getId, plate -> plate));
|
||||
@@ -453,10 +483,44 @@ public class ApiTypeRealize {
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 配件长宽厚信息转换
|
||||
*/
|
||||
private Map<String,Object> getPartsSize(JSONObject size, JSONObject spec) {
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
if (size != null && !size.isEmpty()) {
|
||||
map.put(PART_WIDTH, size.getInteger(ProduceApiConstants.PD_WIDTH));
|
||||
map.put(PART_LENGTH, size.getInteger(ProduceApiConstants.PD_LENGTH));
|
||||
map.put(PART_THICKNESS, size.getInteger(ProduceApiConstants.PD_THICKNESS));
|
||||
}
|
||||
if (spec != null && !spec.isEmpty()) {
|
||||
map.put(PART_COLOR, spec.getString(ProduceApiConstants.PD_PARTS_SPEC_COLOR));
|
||||
map.put(PART_MATERIAL, spec.getString(ProduceApiConstants.PD_PARTS_SPEC_MATERIAL));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* goods_sn获取
|
||||
*/
|
||||
private String getGoodsSn(Long goodId, String token) {
|
||||
String goodsSn;
|
||||
try {
|
||||
JSONObject jsonGood = apiDataAchieve.getApiGoodsMessage(token, new Long[]{goodId}).get();
|
||||
System.out.println(jsonGood.getJSONArray(ProduceApiConstants.DATA));
|
||||
|
||||
goodsSn = jsonGood.getJSONArray(ProduceApiConstants.DATA).getJSONObject(0).getString(ProduceApiConstants.GD_GOODS_SN);
|
||||
} catch (Exception e){
|
||||
return null;
|
||||
}
|
||||
|
||||
return goodsSn;
|
||||
}
|
||||
|
||||
/**
|
||||
* 配件信息转存
|
||||
*
|
||||
* @param value: JSON数据
|
||||
* @param value: 配件数据
|
||||
* @param orderId:
|
||||
* @param goodsDOMap:
|
||||
* @return Map<Integer, OrderPartsDO> Integer指配件的dataId标识id
|
||||
@@ -465,7 +529,8 @@ public class ApiTypeRealize {
|
||||
Long orderId,
|
||||
Map<Long, GoodsDO> goodsDOMap,
|
||||
Map<Long, OrderBodyDO> bodyInfos,
|
||||
Long organId) {
|
||||
Long organId,
|
||||
String token) {
|
||||
|
||||
if (value == null || value.isEmpty()) {
|
||||
return Collections.emptyMap();
|
||||
@@ -481,16 +546,31 @@ public class ApiTypeRealize {
|
||||
for (int i = 0; i < partsLists.size(); i++) {
|
||||
JSONObject parts = partsLists.getJSONObject(i);
|
||||
Long partsId = (Long) identifierGenerator.nextId(null);
|
||||
// 这边用的配件详情接口的数据,可能存在多种配件的goodsId相同
|
||||
// 配件长宽厚颜色赋值
|
||||
Map<String, Object> sizeMap = getPartsSize(parts.getJSONObject(ProduceApiConstants.PD_SIZE), parts.getJSONObject(ProduceApiConstants.PD_PARTS_SPEC_OB));
|
||||
// goods_id转换,需要调用接口
|
||||
// Long goodsId = goodsDOMap.get(parts.getLong(ProduceApiConstants.PD_GOODS_ID)) != null
|
||||
// ? goodsDOMap.get(parts.getLong(ProduceApiConstants.PD_GOODS_ID)).getId() : parts.getLong(ProduceApiConstants.PD_GOODS_ID);
|
||||
Long goodsId = parts.getLong(ProduceApiConstants.PD_GOODS_ID);
|
||||
String goodsSn = null;
|
||||
if (goodsId != null) {
|
||||
goodsSn = getGoodsSn(parts.getLong(ProduceApiConstants.PD_GOODS_ID), token);
|
||||
}
|
||||
OrderPartsDO partsInfo = OrderPartsDO.builder()
|
||||
.id(partsId)
|
||||
.orderId(orderId)
|
||||
.goodsId(String.valueOf(goodsDOMap.get(parts.getLong(ProduceApiConstants.PD_GOODS_ID)) != null
|
||||
? goodsDOMap.get(parts.getLong(ProduceApiConstants.PD_GOODS_ID)).getId() : parts.getLong(ProduceApiConstants.PD_GOODS_ID)))
|
||||
.goodsId(goodsSn)
|
||||
.name(parts.getString(ProduceApiConstants.PD_NAME))
|
||||
.material(String.valueOf(goodsDOMap.get(parts.getLong(ProduceApiConstants.PD_GOODS_ID)) != null
|
||||
? goodsDOMap.get(parts.getLong(ProduceApiConstants.PD_GOODS_ID)).getMaterial() : ""))
|
||||
// .material(String.valueOf(goodsDOMap.get(parts.getLong(ProduceApiConstants.PD_GOODS_ID)) != null
|
||||
// ? goodsDOMap.get(parts.getLong(ProduceApiConstants.PD_GOODS_ID)).getMaterial() : ""))
|
||||
.material((String) sizeMap.get(PART_MATERIAL))
|
||||
.type(parts.getString(ProduceApiConstants.PD_OBJECT_TYPE))
|
||||
.model(parts.getString(ProduceApiConstants.PD_MODEL))
|
||||
.color((String) sizeMap.get(PART_COLOR))
|
||||
.width((Double) sizeMap.get(PART_WIDTH))
|
||||
.length((Double) sizeMap.get(PART_LENGTH))
|
||||
.thickness((Double) sizeMap.get(PART_THICKNESS))
|
||||
.spec(parts.getString(ProduceApiConstants.PD_SPEC))
|
||||
.brand(parts.getString(ProduceApiConstants.PD_BRAND))
|
||||
.factory(parts.getString(ProduceApiConstants.PD_FACTORY))
|
||||
@@ -812,7 +892,8 @@ public class ApiTypeRealize {
|
||||
.rawPointDetail(getPointDetail(block, false))
|
||||
.holeDetail(getHoleDetail(block, true))
|
||||
.sideHoleDetail(getHoleDetail(block, false))
|
||||
.contourDetail(getModelDetail(block))
|
||||
.contourDetail(getModelDetail(block.getJSONArray(ProduceApiConstants.BPD_MODEL)))
|
||||
.sideDetail(getModelDetail(block.getJSONArray(ProduceApiConstants.BPD_SIDE_MODEL)))
|
||||
.build();
|
||||
|
||||
if (block.getJSONObject(ProduceApiConstants.BPD_EXTRA_REMARK) != null) {
|
||||
@@ -938,9 +1019,7 @@ public class ApiTypeRealize {
|
||||
}
|
||||
|
||||
// 造型明细板数据解析 (type 为1,正面;3,侧面)
|
||||
private List<ModelDetail> getModelDetail(JSONObject block) {
|
||||
JSONArray models = block.getJSONArray(ProduceApiConstants.BPD_MODEL);
|
||||
JSONArray sideModels = block.getJSONArray(ProduceApiConstants.BPD_SIDE_MODEL); // 侧面造型
|
||||
private List<ModelDetail> getModelDetail(JSONArray models) {
|
||||
|
||||
List<ModelDetail> modelDetails = new ArrayList<>();
|
||||
|
||||
@@ -950,10 +1029,6 @@ public class ApiTypeRealize {
|
||||
modelDetails.addAll(modelData);
|
||||
}
|
||||
|
||||
List<ModelDetail> sideModelData = getModelData(sideModels);
|
||||
if (sideModelData != null && !sideModelData.isEmpty()) {
|
||||
modelDetails.addAll(sideModelData);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 处理异常,例如记录日志或抛出自定义异常
|
||||
}
|
||||
|
||||
+6
-2
@@ -12,6 +12,9 @@ public class ProduceApiConstants {
|
||||
public static final String ZERO = "0";
|
||||
public static final String ONE = "1";
|
||||
|
||||
// ========== getApiOrderPartsMessage partsList 配件明细模块 ==========
|
||||
public static final String GD_GOODS_SN = "goods_sn"; // 用户自定义配件编号
|
||||
|
||||
|
||||
// ========== getApiOrderPartsMessage partsList 配件明细模块 ==========
|
||||
public static final String PD_ROOM_ID = "RoomID"; // 房间标识
|
||||
@@ -31,8 +34,9 @@ public class ProduceApiConstants {
|
||||
public static final String PD_GROUP_NAME = "GroupName"; // 五金分类
|
||||
public static final String PD_OBJECT_TYPE = "ObjectType"; // 五金类型
|
||||
public static final String PD_SPEC_EXTRAS = "SpecExtras"; // 五金额外规格
|
||||
public static final String PD_PARTS_SPEC = "PartsSpec"; // 配件属性
|
||||
public static final String PD_PARTS_SPEC_SPEC = "spec"; // 配件属性 -> 规格
|
||||
public static final String PD_PARTS_SPEC = "spec"; // 配件规格
|
||||
public static final String PD_PARTS_SPEC_OB = "PartsSpec"; // 配件属性
|
||||
public static final String PD_PARTS_SPEC_SPEC = "PartsSpec"; // 配件属性 -> 规格
|
||||
public static final String PD_PARTS_SPEC_MATERIAL = "material"; // 配件属性 -> 材质
|
||||
public static final String PD_PARTS_SPEC_COLOR = "color"; // 配件属性 -> 颜色
|
||||
public static final String PD_SPECIAL_REMARK = "SpecialRemark"; // 特殊备注(Json字符串)
|
||||
|
||||
Reference in New Issue
Block a user