mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
生产单板材造型新增大板等字段,ES板材造型数据压缩保存,标签Bug修改
This commit is contained in:
+5
-7
@@ -168,18 +168,16 @@ public class ESDocumentServiceImpl implements ESDocumentService {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
Date date = new Date();
|
||||
documents.forEach(esDocument -> {
|
||||
// 假设esDocument有一个ID集。如果没有,则应该抛出异常或进行相应的处理。
|
||||
if (CharSequenceUtil.isBlank(esDocument.getId())) {
|
||||
throw new IllegalArgumentException("更新操作的文档ID不能为空");
|
||||
}
|
||||
|
||||
esDocument.setCreator(loginUser.getNickname());
|
||||
esDocument.setUpdater(loginUser.getNickname());
|
||||
esDocument.setOrganId(loginUser.getOrganId());
|
||||
esDocument.setUpdateTime(simpleDateFormat.format(date));
|
||||
|
||||
br.operations(op -> op.update(u -> u
|
||||
br.operations(op -> op.index(idx -> idx
|
||||
.index(idxName)
|
||||
.id(esDocument.getId())
|
||||
.action(a -> a
|
||||
.doc(esDocument))));
|
||||
.document(esDocument)));
|
||||
});
|
||||
return elasticsearchClient.bulk(br.build());
|
||||
}
|
||||
|
||||
+22
-6
@@ -15,8 +15,10 @@ import com.cf.imes.module.executor.controller.admin.order.vo.product.OrderBodyRe
|
||||
import com.cf.imes.module.executor.controller.admin.order.vo.product.OrderRoomBodyRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRespVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||
import com.cf.imes.module.executor.dal.mysql.order.OrderMapper;
|
||||
import com.cf.imes.module.executor.enums.OrderDeletedEnum;
|
||||
import com.cf.imes.module.executor.enums.OrderStatusEnum;
|
||||
import com.cf.imes.module.executor.service.order.OrderInputProcessor;
|
||||
import com.cf.imes.module.executor.service.order.OrderService;
|
||||
import com.cf.imes.module.executor.util.ExcelWriterUtil;
|
||||
import com.cf.imes.module.executor.util.fileConversion.admin.api.webcad.ApiDataAchieve;
|
||||
@@ -57,11 +59,6 @@ import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.ge
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 生产单管理")
|
||||
@RestController
|
||||
@RequestMapping("/executor/order")
|
||||
@@ -72,6 +69,9 @@ public class OrderController {
|
||||
@Resource
|
||||
private OrderService orderService;
|
||||
|
||||
@Resource
|
||||
private OrderMapper orderMapper;
|
||||
|
||||
@Resource
|
||||
private ExcelReadUtil excelReadUtil;
|
||||
|
||||
@@ -99,6 +99,9 @@ public class OrderController {
|
||||
@Resource
|
||||
private RedisLockUtil redisLockUtil;
|
||||
|
||||
@Resource
|
||||
private OrderInputProcessor orderInputProcessor;
|
||||
|
||||
private String lockKey = "order:1631:lock:";
|
||||
private String errKey = "api数据导入异常";
|
||||
private String errValue = "当前存在导入情况,请稍后";
|
||||
@@ -209,8 +212,9 @@ public class OrderController {
|
||||
log.error(errKey, errValue);
|
||||
return success(errValue);
|
||||
}
|
||||
Long orderId = null;
|
||||
try {
|
||||
Long orderId = (Long) identifierGenerator.nextId(null);
|
||||
orderId = (Long) identifierGenerator.nextId(null);
|
||||
Long organId = getUserOrganId();
|
||||
JSONObject oauth = apiDataAchieve.getApiToken(organId).get();
|
||||
String token = oauth.getJSONObject("info").getString("access_token");
|
||||
@@ -248,6 +252,12 @@ public class OrderController {
|
||||
log.error(errKey, e);
|
||||
return success(e.getMessage());
|
||||
} finally {
|
||||
// 进行判断,为空,写入时出现了错误,数据库数据回滚,此时删除 ES 里的数据
|
||||
OrderDO orderDO = orderMapper.selectById(orderId);
|
||||
if (orderDO == null) {
|
||||
orderInputProcessor.deleteByOrderId(orderId, ORDER_PLATE_MODEL);
|
||||
orderInputProcessor.deleteByOrderId(orderId, ORDER_PLATE_MODEL_COMPRESS);
|
||||
}
|
||||
redisLockUtil.unlock(lockKey);
|
||||
}
|
||||
|
||||
@@ -395,6 +405,12 @@ public class OrderController {
|
||||
XMLUtil.writeErr(response, xmlStr, " order_add_xml_err.xml");
|
||||
}
|
||||
} finally {
|
||||
// 进行判断,为空,写入时出现了错误,数据库数据回滚,此时删除 ES 里的数据
|
||||
OrderDO order = orderMapper.selectById(orderDO.getId());
|
||||
if (order == null) {
|
||||
orderInputProcessor.deleteByOrderId(orderDO.getId(), ORDER_PLATE_MODEL);
|
||||
orderInputProcessor.deleteByOrderId(orderDO.getId(), ORDER_PLATE_MODEL_COMPRESS);
|
||||
}
|
||||
redisLockUtil.unlock(lockKey);
|
||||
}
|
||||
}
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.cf.imes.module.executor.controller.admin.order.vo.order;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Schema(description = "大板,小板,生产单ID合集")
|
||||
@Data
|
||||
public class OrderGoodsPlateIds {
|
||||
|
||||
|
||||
@Schema(description = "板件ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long id;
|
||||
|
||||
|
||||
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long orderId;
|
||||
|
||||
|
||||
@Schema(description = "实际的大板ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String actualGoodsId;
|
||||
|
||||
|
||||
@Schema(description = "大板分类ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long goodsId;
|
||||
|
||||
}
|
||||
|
||||
|
||||
+5
-4
@@ -11,6 +11,7 @@ import org.hibernate.validator.constraints.Length;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@@ -24,7 +25,7 @@ public class PlanSaveReqVO {
|
||||
private Long id;
|
||||
|
||||
|
||||
@Schema(description = "排序优先级", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Schema(description = "排序优先级")
|
||||
private Long sort;
|
||||
|
||||
|
||||
@@ -55,11 +56,11 @@ public class PlanSaveReqVO {
|
||||
private String remark;
|
||||
|
||||
|
||||
@Schema(description = "生产操作人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Schema(description = "生产操作人")
|
||||
private String operator;
|
||||
|
||||
|
||||
@Schema(description = "生产时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Schema(description = "生产时间")
|
||||
private LocalDateTime produceTime;
|
||||
|
||||
|
||||
@@ -68,7 +69,7 @@ public class PlanSaveReqVO {
|
||||
private List<Item> itemList;
|
||||
|
||||
|
||||
@Schema(description = "去除的大板分类ID",requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Schema(description = "去除的大板分类ID")
|
||||
private List<Long> deleteIds;
|
||||
|
||||
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.cf.imes.module.executor.dal.dataobject.ordermodel;
|
||||
|
||||
|
||||
import com.cf.imes.framework.es.core.dal.ESDocument;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
|
||||
/**
|
||||
* @author 生产单板材造型数据的压缩保存
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class OrderModelCompressDO extends ESDocument {
|
||||
|
||||
@Schema(description = "生产单id")
|
||||
private Long orderId;
|
||||
|
||||
|
||||
@Schema(description = "生产单造型的压缩数据")
|
||||
private String orderModelZip;
|
||||
|
||||
|
||||
}
|
||||
+9
@@ -29,6 +29,15 @@ public class OrderModelDO extends ESDocument {
|
||||
@Schema(description = "小板id")
|
||||
private Long plateId;
|
||||
|
||||
@Schema(description = "大板的实际ID")
|
||||
private String goodsId;
|
||||
|
||||
@Schema(description = "大板的分类ID")
|
||||
private Long plateGoodsId;
|
||||
|
||||
@Schema(description = "是否已优化")
|
||||
private Boolean isOptimized;
|
||||
|
||||
@Schema(description = "房间的基点坐标")
|
||||
private BasePosition roomBasePosition; // 板件基准点坐标
|
||||
@Schema(description = "柜体的基点坐标")
|
||||
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
package com.cf.imes.module.executor.dal.dataobject.ordermodel;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cf.imes.module.executor.util.deviseData.structure.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class OrderPlateList {
|
||||
|
||||
|
||||
@Schema(description = "小板id")
|
||||
private Long plateId;
|
||||
@Schema(description = "是否已优化")
|
||||
private Boolean isOptimized;
|
||||
@Schema(description = "房间的基点坐标")
|
||||
private BasePosition roomBasePosition; // 板件基准点坐标
|
||||
@Schema(description = "柜体的基点坐标")
|
||||
private BasePosition bodyBasePosition; // 板件基准点坐标
|
||||
@Schema(description = "板件的基点坐标")
|
||||
private BasePosition plateBasePosition; // 板件基准点坐标
|
||||
|
||||
@Schema(description = "纹路 纹路(0正纹1可翻转2反纹)")
|
||||
private Integer texture;
|
||||
@Schema(description = "排版面 排钻类型(0正面1反面2随意面)")
|
||||
private Integer typographicFace;
|
||||
@Schema(description = "开门类型 0非门板,1左开,2右开,3上翻,4下翻")
|
||||
private Integer openDoorType; // 字典转换
|
||||
@Schema(description = "小板类型")
|
||||
private String boardType;
|
||||
|
||||
@Schema(description = "板件配件信息")
|
||||
private List<PartsInfo> partsInfos;
|
||||
|
||||
@Schema(description = "开料长")
|
||||
private BigDecimal splitLength;
|
||||
@Schema(description = "开料宽")
|
||||
private BigDecimal splitWidth;
|
||||
|
||||
|
||||
@Schema(description = "偏移量X")
|
||||
private BigDecimal offsetX;
|
||||
@Schema(description = "偏移量Y")
|
||||
private BigDecimal offsetY;
|
||||
|
||||
@Schema(description = "是否有二维刀路")
|
||||
private Boolean has2DModel;
|
||||
@Schema(description = "是否有三维刀路")
|
||||
private Boolean has3DModel;
|
||||
|
||||
@Schema(description = "点明细,表示小板外围轮廓的几个转折点(不含封边)")
|
||||
private List<PointDetail> pointDetail;
|
||||
@Schema(description = "原始点明细列表")
|
||||
private List<PointDetail> rawPointDetail;
|
||||
@Schema(description = "坯料点明细")
|
||||
private List<PointDetail> basePointDetail ; //坯料点明细
|
||||
@Schema(description = "holes数量集合 count=孔数量 countFaceA=正面垂直孔数量] countFaceB=反面垂直孔数量] countSide=水平侧孔数量] countSideL=左侧孔数量] countSideR=右侧孔数量 countSideU=上侧孔数量 countSideD=下侧孔数量 countBevelled=斜面孔数量 countLocking=偏心轮/锁定孔数量 countBuildIn=预埋件/插入孔数量 countHinge=铰链孔数量 countThrough=通孔(对穿孔)/挖穿孔数量]")
|
||||
private Map<String,Integer> holeCount;//孔类型数量集合
|
||||
@Schema(description = "孔明细列表")
|
||||
private List<HoleDetail> holeDetail;
|
||||
@Schema(description = "凹槽数量集合")
|
||||
private Map<String,Integer> contourCount;//凹槽数量集合
|
||||
@Schema(description = "造型明细(凹槽)")
|
||||
private List<ModelDetail> contourDetail;
|
||||
@Schema(description = "造型明细(孤岛,现在是xml数据格式添加)")
|
||||
private List<ModelDetail> sideDetail ; //造型明细(孤岛) sideDetail
|
||||
@Schema(description = "侧面孔明细列表")
|
||||
private List<HoleDetail> sideHoleDetail;
|
||||
|
||||
@Schema(description = "生产封边备注")
|
||||
private Map<String,String> sideRemark;// 封边备注
|
||||
@Schema(description = "板材扩展备注")
|
||||
private JSONObject plateExtraRemark;// 封边备注
|
||||
|
||||
@Schema(description = "扩展备注(包含铰链备注、订单板件流水号)")
|
||||
private String extraRemark; // 扩展备注(包含铰链备注、订单板件流水号)(板材明细中)
|
||||
@Schema(description = "特殊备注(Json字符串)")
|
||||
private String specialRemarkDei; // 特殊备注(Json字符串)
|
||||
@Schema(description = "拉手备注(Json字符串)")
|
||||
private String extraHandleRemark; // 拉手备注
|
||||
@Schema(description = "排钻备注(Json字符串)")
|
||||
private String drillsRemark; // 排钻备注(Json字符串)
|
||||
@Schema(description = "板其他备注(Json字符串)")
|
||||
private String infoRemark; // 板其他备注(Json字符串)
|
||||
@Schema(description = "板件备注(Json字符串)")
|
||||
private String remarkJsonDei; // 板件备注(Json字符串)
|
||||
|
||||
@Schema(description = "普通备注(板材数据中)")
|
||||
private String remarkJson; // 普通备注(板材数据中)
|
||||
@Schema(description = "特殊备注(板材数据中)")
|
||||
private String specialRemark; // 特殊备注(板材数据中)
|
||||
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.cf.imes.module.executor.dal.dataobject.ordermodel;
|
||||
|
||||
|
||||
import com.cf.imes.framework.es.core.dal.ESDocument;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author 高级筛选数据
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class OrderPlateModel extends ESDocument {
|
||||
|
||||
@Schema(description = "生产单id")
|
||||
private Long orderId;
|
||||
|
||||
@Schema(description = "大板分类ID")
|
||||
private Long plateGoodsId;
|
||||
|
||||
@Schema(description = "大板实际ID")
|
||||
private String goodsId;
|
||||
|
||||
}
|
||||
+1
@@ -567,6 +567,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
|
||||
// 查询排单对应的大板信息
|
||||
List<GoodsReqVO> goodsDOS = goodsMapper.selectGoodsListByOrderIds(planId,getUserOrganId());
|
||||
|
||||
AssertUtils.notEmpty(goodsDOS,PLAN_GOODS_DATA_ERROR);
|
||||
|
||||
List<Long> orderIds = goodsDOS.stream().map(GoodsReqVO::getOrderId).distinct().toList();
|
||||
|
||||
|
||||
+31
-5
@@ -10,13 +10,12 @@ import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.es.core.service.ESDocumentService;
|
||||
import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRemark;
|
||||
import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.order.OrderDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderGroup.OrderGroupDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderItem.OrderItemDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderModuleExtra.OrderModuleExtraDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderParts.OrderPartsDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderParts.PartsDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelCompressDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateGoodDO;
|
||||
@@ -26,20 +25,20 @@ import com.cf.imes.module.executor.dal.mysql.order.OrderMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderBody.OrderBodyMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderGroup.OrderGroupMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderItem.OrderItemMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderModuleExtra.OrderModuleExtraMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderParts.OrderPartsMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderParts.PartsMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.plate.PlateGoodMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.rawgoods.RawGoodsMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -99,6 +98,8 @@ public class OrderInputProcessor {
|
||||
|
||||
public static final String ORDER_PARTS_REMARK_MODEL = "imes_order_parts_remark_model";
|
||||
|
||||
public static final String ORDER_PLATE_MODEL_COMPRESS = "imes_order_plate_model_compress";
|
||||
|
||||
/**
|
||||
* 批量保存生产单小板五金数据
|
||||
*
|
||||
@@ -203,6 +204,31 @@ public class OrderInputProcessor {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存生产单板材造型的压缩数据
|
||||
*
|
||||
* @param orderModelDOs
|
||||
*/
|
||||
public void batchSaveCompressModel(List<OrderModelCompressDO> orderModelDOs) {
|
||||
try {
|
||||
BulkResponse bulkResponse = esDocumentService.bulkCreate(ORDER_PLATE_MODEL_COMPRESS, orderModelDOs);
|
||||
boolean errors = bulkResponse.errors();
|
||||
if (errors) {
|
||||
log.error(bulkResponse.items().toString());
|
||||
throw new ServiceException(500, "未知异常");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 保存生产单配件备注数据
|
||||
*
|
||||
|
||||
+45
@@ -30,7 +30,9 @@ import com.cf.imes.module.executor.dal.dataobject.orderGroup.OrderGroupDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderItem.OrderItemDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderParts.OrderPartsDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderParts.PartsDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelCompressDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderPlateList;
|
||||
import com.cf.imes.module.executor.dal.dataobject.pack.OrderPackageDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plan.PlanDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO;
|
||||
@@ -78,6 +80,8 @@ import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.toJsonString;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.zipString;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
|
||||
|
||||
@@ -423,8 +427,16 @@ public class OrderServiceImpl implements OrderService {
|
||||
List<OrderModelDO> orderModelDOs = BeanUtils.toBean(plateDetail, OrderModelDO.class);
|
||||
|
||||
if (orderModelDOs != null && !orderModelDOs.isEmpty()) {
|
||||
// 将生产单板材的造型信息进行压缩并保存
|
||||
OrderModelCompressDO orderModelCompressDO = new OrderModelCompressDO();
|
||||
orderModelCompressDO.setOrderId(order.getId());
|
||||
|
||||
orderModelDOs.forEach(orderModelDO -> orderModelDO.setOrderId(order.getId()));
|
||||
// 保存大板的分类和实际ID和未优化
|
||||
saveOrderPlateModel(plateDO,goodsDO,orderModelDOs,orderModelCompressDO);
|
||||
orderInputProcessor.batchSaveModel(orderModelDOs);
|
||||
// 保存压缩的数据
|
||||
orderInputProcessor.batchSaveCompressModel(Collections.singletonList(orderModelCompressDO));
|
||||
}
|
||||
if (partsRemark != null && !partsRemark.isEmpty()) {
|
||||
orderInputProcessor.batchSaveOrderPartsModel(partsRemark);
|
||||
@@ -497,6 +509,19 @@ public class OrderServiceImpl implements OrderService {
|
||||
if (plateDetail != null && !plateDetail.isEmpty()){
|
||||
List<OrderModelDO> orderModelDOs = BeanUtils.toBean(plateDetail, OrderModelDO.class);
|
||||
orderInputProcessor.batchSaveModel(orderModelDOs);
|
||||
// if (!orderModelDOs.isEmpty()) {
|
||||
// orderModelDOs.forEach(orderModelDO -> orderModelDO.setOrderId(orderDO.getId()));
|
||||
// System.out.println("----" + orderModelDOs);
|
||||
// 将生产单板材的造型信息进行压缩并保存
|
||||
OrderModelCompressDO orderModelCompressDO = new OrderModelCompressDO();
|
||||
orderModelCompressDO.setOrderId(orderDO.getId());
|
||||
|
||||
saveOrderPlateModel(plateDO,goodsDO,orderModelDOs,orderModelCompressDO);
|
||||
orderInputProcessor.batchSaveModel(orderModelDOs);
|
||||
// 保存压缩的数据
|
||||
orderInputProcessor.batchSaveCompressModel(Collections.singletonList(orderModelCompressDO));
|
||||
|
||||
// }
|
||||
}
|
||||
if (orderPartsRemarks != null && !orderPartsRemarks.isEmpty()) {
|
||||
orderInputProcessor.batchSaveOrderPartsModel(orderPartsRemarks);
|
||||
@@ -1186,5 +1211,25 @@ public class OrderServiceImpl implements OrderService {
|
||||
|
||||
|
||||
|
||||
private void saveOrderPlateModel(List<PlateDO> plateDO, List<GoodsDO> goodsDO, List<OrderModelDO> orderModelDOs,OrderModelCompressDO orderModelCompressDO) {
|
||||
|
||||
// 将生产单板材的造型信息进行压缩并保存
|
||||
String orderPlateModeList = toJsonString(BeanUtils.toBean(orderModelDOs, OrderPlateList.class));
|
||||
orderModelCompressDO.setOrderModelZip(zipString(orderPlateModeList));
|
||||
|
||||
// 板材造型数据添加 大板分类ID,实际ID,优化信息(默认为 false)
|
||||
List<OrderGoodsPlateIds> orderGoodsPlateIds = BeanUtils.toBean(plateDO, OrderGoodsPlateIds.class);
|
||||
List<GoodsDO> finalGoodsDO = goodsDO;
|
||||
orderGoodsPlateIds.forEach(f->
|
||||
f.setActualGoodsId(finalGoodsDO.stream().filter(g->g.getId().equals(f.getGoodsId())).map(GoodsDO::getGoodsId).toList().get(0))
|
||||
);
|
||||
orderModelDOs.forEach(f->{
|
||||
f.setGoodsId(orderGoodsPlateIds.stream().filter(fo->fo.getId().equals(f.getPlateId())).map(OrderGoodsPlateIds::getActualGoodsId).toList().get(0));
|
||||
f.setPlateGoodsId(orderGoodsPlateIds.stream().filter(fo->fo.getId().equals(f.getPlateId())).map(OrderGoodsPlateIds::getGoodsId).toList().get(0));
|
||||
f.setIsOptimized(false);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+4
-3
@@ -1,9 +1,10 @@
|
||||
package com.cf.imes.module.manage.controller.admin.plate.vo.plate;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
+8
-2
@@ -233,9 +233,10 @@ public class ErrorCodeConstants {
|
||||
public static final ErrorCode LABEL_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_300_000, "标签模板不存在");
|
||||
public static final ErrorCode LABEL_NOT_EXISTS = new ErrorCode(1_002_300_001, "标签不存在");
|
||||
public static final ErrorCode DEFAULT_LABEL_NOT_EXISTS = new ErrorCode(1_002_300_002, "该类型标签默认模板不存在");
|
||||
public static final ErrorCode MACHINE_USE_LABEL = new ErrorCode(1_002_300_003, "无法删除已有机台使用标签");
|
||||
public static final ErrorCode MACHINE_USE_LABEL = new ErrorCode(1_002_300_003, "当前标签已有机台使用,无法删除");
|
||||
public static final ErrorCode DEFAULT_NOT_DELETED = new ErrorCode(1_002_300_004, "默认标签模板无法删除");
|
||||
public static final ErrorCode LABEL_ERROR = new ErrorCode(1_002_300_005, "当前标签错误,请重新配置标签");
|
||||
public static final ErrorCode LABEL_IS_USE_ERROR = new ErrorCode(1_002_300_006, "当前标签打包设置中已有用户使用,无法删除");
|
||||
|
||||
|
||||
// ========== 系统数据源 1_002_301_000 ==========
|
||||
@@ -296,6 +297,7 @@ public class ErrorCodeConstants {
|
||||
public static final ErrorCode FAILED_TO_MODIFY_THE_STATUS_OF_THE_CURRENT_PRODUCTION_ORDER = new ErrorCode(1_002_040_003, "修改当前生产单的工序状态和生产单的状态失败");
|
||||
public static final ErrorCode NO_OPTIMIZATION_INFORMATION_AVAILABLE = new ErrorCode(1_002_040_004, "当前订单无优化信息");
|
||||
public static final ErrorCode NO_PRODUCTION_ORDER_INFORMATION_AVAILABLE = new ErrorCode(1_002_040_005, "已经是{}一条了");
|
||||
public static final ErrorCode ORDER_IS_PACK_ERROR = new ErrorCode(1_002_040_006, "生产单' {} '已经完成全部打包,无法进行分堆");
|
||||
|
||||
|
||||
//=========== 断言提示信息 1-002-041-000 ============
|
||||
@@ -323,9 +325,13 @@ public class ErrorCodeConstants {
|
||||
public static final ErrorCode ORDER_PACK_DATA_ERROR = new ErrorCode(1_002_041_019, "当前包裹信息有误,请重新选择包裹");
|
||||
public static final ErrorCode PLAN_BODY_DATA_ERROR = new ErrorCode(1_002_041_019, "当前排单的生产单对应的柜体数据异常,请查看柜体数据或联系客服");
|
||||
public static final ErrorCode CREATE_PLAN_DATA_ERROR = new ErrorCode(1_002_041_020, "排单优化数据异常,请重新进行优化或者删除排单然后重新创建排单");
|
||||
public static final ErrorCode PLAN_MIXED_ORDER_ERROR = new ErrorCode(1_002_041_021, "当前选择的混排板材条件不相同,无法混排,请重新选择板材进行排单!");
|
||||
public static final ErrorCode PLAN_MIXED_ORDER_ERROR = new ErrorCode(1_002_041_021, "当前选择的混排板材条件:' {} ' 不相同,无法混排,请重新选择板材进行排单!");
|
||||
public static final ErrorCode BRANCHING_SETTING_ERROR = new ErrorCode(1_002_041_022, "当前分线配置有误,请重新进行保存");
|
||||
public static final ErrorCode BRANCHING_DEFAULT_SETTING_ERROR = new ErrorCode(1_002_041_023, "当前组织智能分线无默认配置,请进行配置");
|
||||
public static final ErrorCode ADVANCED_SCREENING_CONFIG_ERROR = new ErrorCode(1_002_041_024, "当前筛选的配置有误,请重新进行配置");
|
||||
public static final ErrorCode CONFIG_DATA_ERROR = new ErrorCode(1_002_041_025, "当前配置为空,保存失败,请添加配置后再保存");
|
||||
public static final ErrorCode PLAN_MIXED_DATA_ERROR = new ErrorCode(1_002_041_021, "当前混排条件错误,无法混排,请重新选择条件进行混单!");
|
||||
public static final ErrorCode PLAN_GOODS_DATA_ERROR = new ErrorCode(1_002_041_022, "当前排单未保存大板和小板信息,请重新进行排单");
|
||||
|
||||
|
||||
|
||||
|
||||
+2
-1
@@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -60,7 +61,7 @@ public class LabelController {
|
||||
@Operation(summary = "删除标签")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('sysTagDesignManager:delete')")
|
||||
public CommonResult<Boolean> deleteLabel(@RequestParam("id") Long id) {
|
||||
public CommonResult<Boolean> deleteLabel(@RequestParam("id") @NotNull(message = "标签ID不能为空") Long id) {
|
||||
labelService.deleteLabel(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
+3
-3
@@ -37,10 +37,10 @@ public class LabelSaveReqVO {
|
||||
@NotNull(message = "高度不能为空")
|
||||
private Integer height;
|
||||
|
||||
/*@Schema(description = "标签元素模板列表")
|
||||
private List<LabelElementSaveReqVO> elements;*/
|
||||
|
||||
@Schema(description = "配置")
|
||||
private String template;
|
||||
|
||||
@Schema(description = "组织ID")
|
||||
private Long organId;
|
||||
|
||||
}
|
||||
-9
@@ -65,15 +65,6 @@ public class MachineAuthController {
|
||||
|
||||
return success(machineService.getTemplateAuth(pageParam));
|
||||
|
||||
// List<MachineAuthResp> list = page.getList().stream().map(e->MachineAuthResp.builder()
|
||||
// .id(e.getId())
|
||||
// .machineType(e.getMachineType())
|
||||
// .machineName(e.getName())
|
||||
// .organId(e.getOrganId())
|
||||
// .build()
|
||||
// ).collect(Collectors.toList());
|
||||
//
|
||||
// return success(new PageResult<MachineAuthResp>(list, page.getTotal()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-8
@@ -90,13 +90,6 @@ public class MachineController {
|
||||
return success(BeanUtils.toBean(pageResult, CuttingRespVO.class));
|
||||
}
|
||||
|
||||
// @GetMapping("getDefaultCutting")
|
||||
// @Operation(summary = "获得默认机台模板")
|
||||
// @Parameter(name = "machineType", description = "机台类型", required = true, example = "1")
|
||||
// //@PreAuthorize("@ss.hasPermission('machine::query')")
|
||||
// public CommonResult<CuttingTemplateRespVO> getDefaultCutting(@RequestParam Integer machineType) {
|
||||
// return success(machineTemplateService.getDefaultCutting(machineType));
|
||||
// }
|
||||
|
||||
|
||||
|
||||
@@ -110,7 +103,6 @@ public class MachineController {
|
||||
@GetMapping(value = {"/list-all-simple", "/simple-list"})
|
||||
@Operation(summary = "获取机台精简信息列表", description = "主要用于前端的下拉选项")
|
||||
public CommonResult<List<MachineSimpleRespVO>> getSimpleDeptList(@RequestParam(required = false) Long organId,@RequestParam(required = false) Long type) {
|
||||
// organId = organId == null ? OrganContextHolder.getOrganId() : organId;
|
||||
List<MachineSimpleRespVO> list = machineService.simpleList(type);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
+4
-23
@@ -2,7 +2,6 @@ package com.cf.imes.module.system.controller.admin.machine;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.module.system.controller.admin.machine.vo.MachineOrgAuthReq;
|
||||
import com.cf.imes.module.system.controller.admin.machine.vo.OrganTemplatePage;
|
||||
import com.cf.imes.module.system.controller.admin.machine.vo.OrganTemplateResp;
|
||||
import com.cf.imes.module.system.controller.admin.machine.vo.TemplateAutoResp;
|
||||
@@ -11,7 +10,10 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@@ -28,21 +30,6 @@ public class MachineTemplateAuthController {
|
||||
@Resource
|
||||
private MachineTemplateService machineTemplateService;
|
||||
|
||||
@PutMapping("insert-organ-auth-template")
|
||||
@Operation(summary = "组织模板授权新增")
|
||||
@PreAuthorize("@ss.hasPermission('machine-template-auth::update')")
|
||||
public CommonResult<Boolean> auth(@RequestBody MachineOrgAuthReq vo) {
|
||||
return success(machineTemplateService.auth(vo));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("update-organ-auth-template")
|
||||
@Operation(summary = "组织模板授权修改")
|
||||
@PreAuthorize("@ss.hasPermission('machine-template-auth::update')")
|
||||
public CommonResult<Boolean> updateTemplateAuth(@RequestBody MachineOrgAuthReq vo) {
|
||||
return success(machineTemplateService.updateTemplateAuth(vo));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("organ-template-page")
|
||||
@@ -66,12 +53,6 @@ public class MachineTemplateAuthController {
|
||||
@PreAuthorize("@ss.hasPermission('machine-template-auth::query')")
|
||||
public CommonResult<TemplateAutoResp> getTemplateAuth(@RequestParam(required = false) Long organId ) {
|
||||
return success(machineTemplateService.getTemplateAuth(organId));
|
||||
// List<TemplateAutoResp> list = page.getList().stream().map(e->TemplateAutoResp.builder()
|
||||
// .id(e.getId())
|
||||
// .machineType(e.getMachineType())
|
||||
// .templateName(e.getName())
|
||||
// .build()
|
||||
// ).collect(Collectors.toList());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
package com.cf.imes.module.system.controller.admin.machine.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author there
|
||||
*/
|
||||
@Data
|
||||
public class MachineAuthVO {
|
||||
@NotNull(message = "用户id不能空")
|
||||
private Long userId;
|
||||
|
||||
private List<Long> machinesIds;
|
||||
}
|
||||
+1
-2
@@ -31,6 +31,5 @@ public class OrganTemplateResp {
|
||||
|
||||
@Schema(description = "机台模板列表")
|
||||
private List<MachineTemplateBrandReqVO> machineTemplateBrandReqVOS;
|
||||
// @Schema(description = "机台模板列表")
|
||||
// private List<OrganTemplateVO> authTemplateList;
|
||||
|
||||
}
|
||||
|
||||
-1
@@ -4,7 +4,6 @@ import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.system.controller.admin.label.vo.LabelPageReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.labeltemplate.vo.LabelTemplatePageReqVO;
|
||||
import com.cf.imes.module.system.dal.dataobject.lable.LabelDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
+61
-27
@@ -1,23 +1,35 @@
|
||||
package com.cf.imes.module.system.service.lable;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.cf.imes.framework.common.enums.UserSettingTypeEnum;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.system.controller.admin.label.vo.*;
|
||||
import com.cf.imes.module.system.controller.admin.label.vo.LabelPageReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.label.vo.LabelRespVO;
|
||||
import com.cf.imes.module.system.controller.admin.label.vo.LabelSaveReqVO;
|
||||
import com.cf.imes.module.system.dal.dataobject.lable.LabelDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.machine.MachineDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.setting.PackageConfigDO;
|
||||
import com.cf.imes.module.system.dal.mysql.label.LabelMapper;
|
||||
import com.cf.imes.module.system.dal.mysql.machine.MachineMapper;
|
||||
import com.cf.imes.module.system.dal.mysql.setting.PackageConfigMapper;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.parseTree;
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.unzipString;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
@@ -37,27 +49,32 @@ public class LabelServiceImpl implements LabelService {
|
||||
@Resource
|
||||
private MachineMapper machineMapper;
|
||||
|
||||
@Resource
|
||||
private PackageConfigMapper packageConfigMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createLabel(LabelSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
LabelDO Label = BeanUtils.toBean(createReqVO, LabelDO.class);
|
||||
Label.setTemplate(JsonUtils.zipString(Label.getTemplate()));
|
||||
labelMapper.insert(Label);
|
||||
LabelDO label = BeanUtils.toBean(createReqVO, LabelDO.class);
|
||||
label.setTemplate(JsonUtils.zipString(label.getTemplate()));
|
||||
labelMapper.insert(label);
|
||||
// 返回
|
||||
return Label.getId();
|
||||
return label.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateLabel(LabelSaveReqVO updateReqVO) {
|
||||
|
||||
// 校验存在
|
||||
validateLabelExists(updateReqVO.getId());
|
||||
LabelDO labelDO = validateLabelExists(updateReqVO.getId());
|
||||
// 更新
|
||||
LabelDO updateObj = BeanUtils.toBean(updateReqVO, LabelDO.class);
|
||||
if(!updateReqVO.getTemplate().isEmpty()){
|
||||
updateObj.setTemplate(JsonUtils.zipString(updateObj.getTemplate()));
|
||||
}
|
||||
updateObj.setOrganId(labelDO.getOrganId());
|
||||
|
||||
labelMapper.updateById(updateObj);
|
||||
}
|
||||
@@ -66,10 +83,8 @@ public class LabelServiceImpl implements LabelService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteLabel(Long id) {
|
||||
// 校验存在
|
||||
LabelDO LabelDO = labelMapper.selectById(id);
|
||||
if (LabelDO == null) {
|
||||
throw exception(LABEL_NOT_EXISTS);
|
||||
}
|
||||
LabelDO labelDO = validateLabelExists(id);
|
||||
|
||||
List<MachineDO> machineDOS = machineMapper.selectList(new LambdaQueryWrapperX<MachineDO>()
|
||||
.select(MachineDO::getId)
|
||||
.eq(MachineDO::getLabelId, id)
|
||||
@@ -77,25 +92,47 @@ public class LabelServiceImpl implements LabelService {
|
||||
if(CollUtil.isNotEmpty(machineDOS)) {
|
||||
throw exception(MACHINE_USE_LABEL);
|
||||
}
|
||||
// 删除标签模板表
|
||||
|
||||
List<Long> labelId = new ArrayList<>();
|
||||
|
||||
Long organId = labelDO.getOrganId();
|
||||
List<PackageConfigDO> packageConfigDOS = packageConfigMapper.selectSettingList(UserSettingTypeEnum.PACKAGED.getType(),organId);
|
||||
|
||||
if(CollUtil.isNotEmpty(packageConfigDOS)) {
|
||||
packageConfigDOS.forEach(f -> {
|
||||
|
||||
JsonNode packConfig = parseTree(unzipString(f.getSetting()));
|
||||
labelId.add(packConfig.get("partLabelId").asLong());
|
||||
labelId.add(packConfig.get("orderLabelId").asLong());
|
||||
labelId.add(packConfig.get("plateLabelId").asLong());
|
||||
|
||||
});
|
||||
|
||||
if (CollUtil.isNotEmpty(labelId) && labelId.contains(id)) {
|
||||
throw exception(LABEL_IS_USE_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
// 删除标签
|
||||
labelMapper.deleteById(id);
|
||||
|
||||
}
|
||||
|
||||
private void validateLabelExists(Long id) {
|
||||
if (labelMapper.selectById(id) == null) {
|
||||
private LabelDO validateLabelExists(Long id) {
|
||||
LabelDO labelDO = labelMapper.selectById(id);
|
||||
if (labelDO == null) {
|
||||
throw exception(LABEL_NOT_EXISTS);
|
||||
}
|
||||
return labelDO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LabelRespVO getLabel(Long id) {
|
||||
LabelDO LabelDO = labelMapper.selectById(id);
|
||||
if (LabelDO == null) {
|
||||
throw exception(LABEL_ERROR);
|
||||
}
|
||||
LabelDO.setTemplate(JsonUtils.unzipString(LabelDO.getTemplate()));
|
||||
LabelRespVO LabelRespVO = BeanUtils.toBean(LabelDO, LabelRespVO.class);
|
||||
|
||||
LabelDO labelDO = validateLabelExists(id);
|
||||
|
||||
labelDO.setTemplate(unzipString(labelDO.getTemplate()));
|
||||
LabelRespVO LabelRespVO = BeanUtils.toBean(labelDO, LabelRespVO.class);
|
||||
return LabelRespVO;
|
||||
}
|
||||
|
||||
@@ -104,7 +141,7 @@ public class LabelServiceImpl implements LabelService {
|
||||
|
||||
PageResult<LabelDO> labelDOPageResult = labelMapper.selectPage(pageReqVO);
|
||||
|
||||
labelDOPageResult.setList(labelDOPageResult.getList().stream().map(m -> m.setTemplate(JsonUtils.unzipString(m.getTemplate()))).collect(Collectors.toList()));
|
||||
labelDOPageResult.setList(labelDOPageResult.getList().stream().map(m -> m.setTemplate(unzipString(m.getTemplate()))).toList());
|
||||
|
||||
return labelDOPageResult;
|
||||
}
|
||||
@@ -115,22 +152,19 @@ public class LabelServiceImpl implements LabelService {
|
||||
public Map<String, List<LabelRespVO>> getGroupList(Long organId) {
|
||||
List<LabelDO> LabelDOS = labelMapper.selectList(new LambdaQueryWrapperX<LabelDO>()
|
||||
.eqIfPresent(LabelDO::getOrganId, organId)
|
||||
/*.eq(LabelDO::getDeleted,false)*/)
|
||||
.stream().map(m -> m.setTemplate(JsonUtils.unzipString(m.getTemplate()))).collect(Collectors.toList());
|
||||
)
|
||||
.stream().map(m -> m.setTemplate(unzipString(m.getTemplate()))).toList();
|
||||
List<LabelRespVO> LabelRespVOS = BeanUtils.toBean(LabelDOS, LabelRespVO.class);
|
||||
return LabelRespVOS.stream().collect(Collectors.groupingBy(LabelRespVO::getType));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LabelDO> list(String type) {
|
||||
// return labelMapper.selectList(new LambdaQueryWrapperX<LabelDO>()
|
||||
// .eq(LabelDO::getOrganId,getUserOrganId())
|
||||
// .eqIfPresent(LabelDO::getType, type));
|
||||
|
||||
return labelMapper.selectList(new LambdaQueryWrapperX<LabelDO>()
|
||||
.eqIfPresent(LabelDO::getType, type)
|
||||
.eq(LabelDO::getOrganId,getUserOrganId()))
|
||||
.stream().map( m -> m.setTemplate(JsonUtils.unzipString(m.getTemplate()))).collect(Collectors.toList());
|
||||
.stream().map( m -> m.setTemplate(unzipString(m.getTemplate()))).toList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
-7
@@ -13,9 +13,6 @@ import java.util.Map;
|
||||
*/
|
||||
public interface MachineTemplateService {
|
||||
|
||||
|
||||
Boolean auth(MachineAuthVO vo);
|
||||
|
||||
PageResult<MachineTemplateDO> page(MachinePageReqVO pageParam);
|
||||
|
||||
|
||||
@@ -32,9 +29,6 @@ public interface MachineTemplateService {
|
||||
|
||||
Map<Integer, List<MachineTemplateRespVO>> getMachineTemplateTree();
|
||||
|
||||
|
||||
Boolean auth(MachineOrgAuthReq vo);
|
||||
|
||||
PageResult<OrganTemplateResp> organTemplatePage(OrganTemplatePage page);
|
||||
|
||||
OrganTemplateResp organTemplateByOrganId(Long organId);
|
||||
@@ -46,6 +40,5 @@ public interface MachineTemplateService {
|
||||
|
||||
TemplateAutoResp getTemplateAuth(Long organId);
|
||||
|
||||
Boolean updateTemplateAuth(MachineOrgAuthReq vo);
|
||||
|
||||
}
|
||||
|
||||
-88
@@ -1,6 +1,5 @@
|
||||
package com.cf.imes.module.system.service.machine;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import co.elastic.clients.elasticsearch.ElasticsearchClient;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -9,13 +8,11 @@ import com.cf.imes.framework.common.enums.MachineTypeEnum;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||
import com.cf.imes.module.system.controller.admin.machine.vo.*;
|
||||
import com.cf.imes.module.system.controller.admin.organ.vo.organ.OrganSimpleRespVO;
|
||||
import com.cf.imes.module.system.convert.machine.MachineTemplateConvert;
|
||||
import com.cf.imes.module.system.dal.dataobject.machine.MachineBrandDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.machine.UserMachineDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.machinetemplate.MachineTemplateDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.machinetemplate.MachineTemplateLimitDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.organ.OrganizationDO;
|
||||
@@ -206,20 +203,6 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
public PageResult<OrganTemplateResp> organTemplatePage(OrganTemplatePage page) {
|
||||
Page<OrganTemplateResp> respPage = new Page<>(page.getPageNo(), page.getPageSize());
|
||||
|
||||
// List<MachineTemplateDO> machineTemplateDOS = machineTemplateMapper.selectMachineTemplate(page.getTemplateName());
|
||||
//
|
||||
// List<Long> machineTemplateIds = machineTemplateDOS.stream().map(m -> m.getId()).toList();
|
||||
//
|
||||
// MPJLambdaWrapperX<OrganizationDO> lambdaWrapperX = new MPJLambdaWrapperX<>();
|
||||
// lambdaWrapperX.leftJoin(MachineTemplateLimitDO.class, MachineTemplateLimitDO::getMachineId, OrganizationDO::getId)
|
||||
// .eqIfExists(OrganizationDO::getName,page.getOrganId())
|
||||
// .in(MachineTemplateLimitDO::getMachineId, machineTemplateIds)
|
||||
// .distinct();
|
||||
//
|
||||
// PageResult<OrganizationDO> pageResult = organMapper.selectJoinPage(page, OrganizationDO.class, lambdaWrapperX);
|
||||
//
|
||||
//
|
||||
// List<Long> organIds = pageResult.getList().stream().map(OrganizationDO::getId).toList();
|
||||
|
||||
Page<OrganTemplateResp> organTemplateRespPage = machineTemplateLimitMapper.selectMachinePage(respPage, page);
|
||||
|
||||
@@ -392,30 +375,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean updateTemplateAuth(MachineOrgAuthReq vo) {
|
||||
|
||||
// List<MachineAuth> machineAuthList = vo.getMachineAuthList();
|
||||
//
|
||||
// if(!machineAuthList.isEmpty()) {
|
||||
// List<MachineTemplateLimitDO> machineTemplateLimitDOS = new ArrayList<>();
|
||||
//
|
||||
// for (MachineAuth machineAuth : machineAuthList) {
|
||||
//
|
||||
// machineTemplateLimitDOS.add(MachineTemplateLimitDO.builder()
|
||||
// .id(machineAuth.getMachineId())
|
||||
// .showAutoNotePrinter(machineAuth.getShowAutoNotePrinter())
|
||||
// .showDualWorkstation(machineAuth.getShowDualWorkstation())
|
||||
// .showPriorFacing(machineAuth.getShowPriorFacing())
|
||||
// .build());
|
||||
// }
|
||||
//
|
||||
// machineTemplateLimitMapper.updateBatch(machineTemplateLimitDOS);
|
||||
// }
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@@ -430,54 +390,6 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean auth(MachineAuthVO vo) {
|
||||
userMachineMapper.delete(new LambdaQueryWrapperX<UserMachineDO>().eq(UserMachineDO::getUserId, vo.getUserId()));
|
||||
if (CollUtil.isNotEmpty(vo.getMachinesIds())) {
|
||||
ArrayList<UserMachineDO> userMachineDOS = new ArrayList<>();
|
||||
for (Long machinesId : vo.getMachinesIds()) {
|
||||
userMachineDOS.add(UserMachineDO.builder()
|
||||
.userId(vo.getUserId())
|
||||
.machineId(machinesId)
|
||||
.build());
|
||||
}
|
||||
userMachineMapper.insertBatch(userMachineDOS);
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean auth(MachineOrgAuthReq vo) {
|
||||
|
||||
// 去掉授权删除
|
||||
// machineTemplateLimitMapper.delete(new LambdaQueryWrapperX<MachineTemplateLimitDO>().eq(MachineTemplateLimitDO::getOrganId, vo.getOrganId()));
|
||||
|
||||
// List<MachineAuth> machineAuthList = vo.getMachineAuthList();
|
||||
//
|
||||
// if(CollectionUtil.isNotEmpty(machineAuthList)) {
|
||||
// List<MachineTemplateLimitDO> organMachineDOS = new ArrayList<>();
|
||||
// LocalDateTime now = LocalDateTime.now();
|
||||
// for (MachineAuth machineAuth : machineAuthList) {
|
||||
// organMachineDOS.add(
|
||||
// MachineTemplateLimitDO.builder()
|
||||
// .createTime(now)
|
||||
// .organId(vo.getOrganId())
|
||||
// .machineId(machineAuth.getMachineId())
|
||||
// .showDualWorkstation(machineAuth.getShowDualWorkstation())
|
||||
// .showAutoNotePrinter(machineAuth.getShowAutoNotePrinter())
|
||||
// .showPriorFacing(machineAuth.getShowPriorFacing())
|
||||
// .build()
|
||||
// );
|
||||
//
|
||||
// }
|
||||
// machineTemplateLimitMapper.insertBatch(organMachineDOS);
|
||||
// }
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PageResult<MachineTemplateDO> page(MachinePageReqVO pageParam) {
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ public class IntellectBranchingService extends AbstractSystemConfigServiceHandle
|
||||
checkMachineConfig(jsonObject.get("machineConfig"),machineName);
|
||||
}
|
||||
|
||||
if(jsonArray.size() <= 2){
|
||||
if(jsonArray.size() < 2){
|
||||
throw new ServiceException(BRANCHING_SETTING_COUNT_ERROR);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user