Selaa lähdekoodia

补差价订单详情

zoujiajian 1 vuosi sitten
vanhempi
sitoutus
957b567cf5

+ 13 - 0
netflix-dao/src/main/java/com/cyksj/mapper/OrderDonDifferGoodsMapper.java

@@ -0,0 +1,13 @@
+package com.cyksj.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.cyksj.model.entity.OrderDonDifferGoods;
+
+/**
+ * 项目名: yhlxj2
+ * 文件名: OrderDonDifferGoodsMapper
+ * 创建者: JavaZou
+ * 创建时间:2025/3/10 16:58
+ */
+public interface OrderDonDifferGoodsMapper extends BaseMapper<OrderDonDifferGoods> {
+}

+ 13 - 0
netflix-dao/src/main/java/com/cyksj/mapper/OrderDonDifferRelateMapper.java

@@ -0,0 +1,13 @@
+package com.cyksj.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.cyksj.model.entity.OrderDonDifferRelate;
+
+/**
+ * 项目名: yhlxj2
+ * 文件名: OrderDonDifferRelateMapper
+ * 创建者: JavaZou
+ * 创建时间:2025/3/10 15:08
+ */
+public interface OrderDonDifferRelateMapper extends BaseMapper<OrderDonDifferRelate> {
+}

+ 23 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/OrderDonDifferGoods.java

@@ -0,0 +1,23 @@
+package com.cyksj.model.entity;
+
+import com.ejlchina.searcher.bean.DbField;
+import com.ejlchina.searcher.bean.SearchBean;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 项目名: yhlxj2
+ * 文件名: OrderDonDifferGoods
+ * 创建者: JavaZou
+ * 创建时间:2025/3/10 16:58
+ */
+@Getter
+@Setter
+@SearchBean(tables = "order_don_differ_goods og inner join goods_don g on g.id = og.goods_id")
+public class OrderDonDifferGoods extends BaseEntity{
+	@DbField("og.goods_id")
+	private Long goodsId;
+
+	@DbField("g.title")
+	private String title;
+}

+ 23 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/OrderDonDifferRelate.java

@@ -0,0 +1,23 @@
+package com.cyksj.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 项目名: yhlxj2
+ * 文件名: OrderDonDifferRelate
+ * 创建者: JavaZou
+ * 创建时间:2025/3/10 15:07
+ */
+@Getter
+@Setter
+public class OrderDonDifferRelate extends BaseEntity{
+	private Long orderId;
+
+	private Long goodsId;
+
+	/**
+	 * 操作人员
+	 */
+	private String operator;
+}

+ 3 - 0
netflix-dao/src/main/java/com/cyksj/model/excel/ExcelOrderDonData.java

@@ -111,6 +111,9 @@ public class ExcelOrderDonData {
 	@ExcelIgnore
 	private OrderDon.Status status;
 
+	@ExcelProperty("补差价订单")
+	private String diffInfo;
+
 	@ExcelProperty("状态")
 	private String statusStr;
 

+ 12 - 0
netflix-dao/src/main/java/com/cyksj/model/manage/views/OrderDonBackView.java

@@ -303,4 +303,16 @@ public class OrderDonBackView {
 
 	@DbIgnore
 	private String expiryTime;
+
+	/**
+	 * 补差价平台
+	 */
+	@DbIgnore
+	private Long diffGoodsId;
+
+	@DbIgnore
+	private String diffTitle;
+
+	@DbIgnore
+	private String diffOperator;
 }

+ 37 - 0
netflix-dao/src/main/java/com/cyksj/model/views/OrderDonDifferRelateView.java

@@ -0,0 +1,37 @@
+package com.cyksj.model.views;
+
+import com.ejlchina.searcher.bean.DbField;
+import com.ejlchina.searcher.bean.SearchBean;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/**
+ * 项目名: yhlxj2
+ * 文件名: OrderDonDifferRelateView
+ * 创建者: JavaZou
+ * 创建时间:2025/3/10 15:11
+ */
+@Getter
+@Setter
+@SearchBean(tables = "order_don_differ_relate odr left join goods_don g on g.id = odr.goods_id")
+public class OrderDonDifferRelateView {
+	@DbField("odr.order_id")
+	private Long orderId;
+
+	@DbField("odr.goods_id")
+	private Long goodsId;
+
+	@DbField("g.title")
+	private String title;
+
+	@DbField("odr.operator")
+	private String operator;
+
+	@DbField("odr.created_time")
+	private Date createdTime;
+
+	@DbField("odr.update_time")
+	private Date updateTime;
+}

+ 84 - 2
netflix-web/src/main/java/com/cyksj/web/controller/manage/CmsOrderController.java

@@ -126,11 +126,15 @@ public class CmsOrderController {
 
 	private final UserBenefitsOrderRecordMapper userBenefitsOrderRecordMapper;
 
+	private final OrderDonDifferRelateMapper orderDonDifferRelateMapper;
+
+	private final OrderDonDifferGoodsMapper orderDonDifferGoodsMapper;
+
 	private static final GlobalThreadPoolTaskExecutor TASK_EXECUTOR = GlobalThreadPoolTaskExecutor.getInstance();
 
 	@GetMapping("/get")
 	@SaCheckPermission("order:view")
-	public Result<SearchResult<OrderDonBackView>> get(Long channelId, String account, String showId, Long acId, String nickname, String register, Boolean isGoogle, Boolean isSubsidy, Boolean isRenewPackage, Integer otherOrderType, Long userMirrorShopId) {
+	public Result<SearchResult<OrderDonBackView>> get(Long channelId, String account, String showId, Long acId, String nickname, String register, Boolean isGoogle, Boolean isSubsidy, Boolean isRenewPackage, Integer otherOrderType, Long userMirrorShopId, String operator, Long diffGoodsId) {
 		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
 		if (channelId != null) {
 			List<Long> popularizeIds = channelPopularizeMapper.getPopularizeIdByChannelId(channelId);
@@ -206,6 +210,19 @@ public class CmsOrderController {
 			}
 			conditionSql += String.format(" exists (select 1 from user_mirror_shop_order_relate umr where mp_id = %s and umr.order_id = o.id limit 1)", userMirrorShopId);
 		}
+		if (diffGoodsId != null || StrUtil.isNotBlank(operator)) {
+			if (StrUtil.isNotEmpty(conditionSql)) {
+				conditionSql += " and ";
+			}
+			conditionSql += " exists (select 1 from order_don_differ_relate odr where odr.order_id = o.id";
+			if (diffGoodsId != null) {
+				conditionSql += String.format(" and odr.goods_id = %s", diffGoodsId);
+			}
+			if (StrUtil.isNotBlank(operator)) {
+				conditionSql += String.format(" and odr.operator = '%s'", operator);
+			}
+			conditionSql += ")";
+		}
 		if (StrUtil.isNotBlank(conditionSql)) {
 			builder.put("condition", conditionSql);
 		}
@@ -286,6 +303,15 @@ public class CmsOrderController {
 					data.setNickname(e.getNickname());
 				});
 			}
+			//补差价订单
+			if (data.getGoodsDonType() != null && data.getGoodsDonType() == 5) {
+				OrderDonDifferRelateView donDifferRelateView = beanSearcher.searchFirst(OrderDonDifferRelateView.class, MapUtils.builder().field(OrderDonDifferRelateView::getOrderId, data.getId()).build());
+				if (donDifferRelateView != null) {
+					data.setDiffGoodsId(donDifferRelateView.getGoodsId());
+					data.setDiffTitle(donDifferRelateView.getTitle());
+					data.setDiffOperator(donDifferRelateView.getOperator());
+				}
+			}
 		});
 		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
 	}
@@ -335,7 +361,7 @@ public class CmsOrderController {
 	@GetMapping("/export")
 	@SaCheckPermission("order:export")
 	@Log(module = "订单管理/导出订单", businessType = BusinessType.EXPORT, isSaveRequestData = true)
-	public void exportOrders(HttpServletResponse response, Long channelId, String account, String showId, Long acId, String nickname, String register, Boolean isGoogle, Boolean isSubsidy, Boolean isRenewPackage, Integer otherOrderType, Long userMirrorShopId) throws InterruptedException {
+	public void exportOrders(HttpServletResponse response, Long channelId, String account, String showId, Long acId, String nickname, String register, Boolean isGoogle, Boolean isSubsidy, Boolean isRenewPackage, Integer otherOrderType, Long userMirrorShopId, String operator, Long diffGoodsId) throws InterruptedException {
 		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
 		if (channelId != null) {
 			List<Long> popularizeIds = channelPopularizeMapper.getPopularizeIdByChannelId(channelId);
@@ -405,6 +431,19 @@ public class CmsOrderController {
 				builder.put("tb", String.format(" inner join user_mirror_shop_order_relate umr on umr.order_id = o.id"));
 			}
 		}
+		if (diffGoodsId != null || StrUtil.isNotBlank(operator)) {
+			if (StrUtil.isNotEmpty(conditionSql)) {
+				conditionSql += " and ";
+			}
+			conditionSql += " exists (select 1 from order_don_differ_relate odr where odr.order_id = o.id";
+			if (diffGoodsId != null) {
+				conditionSql += String.format(" and odr.goods_id = %s", diffGoodsId);
+			}
+			if (StrUtil.isNotBlank(operator)) {
+				conditionSql += String.format(" and odr.operator = '%s'", operator);
+			}
+			conditionSql += ")";
+		}
 		if (userMirrorShopId != null) {
 			conditionSql += String.format(" exists (select 1 from user_mirror_shop_order_relate umr where mp_id = %s and umr.order_id = o.id limit 1)", userMirrorShopId);
 		}
@@ -1239,7 +1278,50 @@ public class CmsOrderController {
 				data.setCouponName(couponMapper.getCouponNameByCouponUserId(data.getCouponUserId()));
 				data.setCouponMoney(data.getCouponMoney() == null ? BigDecimal.ZERO : data.getCouponMoney());
 			}
+			//差价订单
+			if (data.getGoodsDonType() != null && data.getGoodsDonType() == 5) {
+				OrderDonDifferRelateView orderDonDifferRelateView = beanSearcher.searchFirst(OrderDonDifferRelateView.class, MapUtils.builder().field(OrderDonDifferRelateView::getOrderId, data.getId()).build());
+				if (orderDonDifferRelateView != null) {
+					data.setDiffInfo(orderDonDifferRelateView.getTitle() + "-" + orderDonDifferRelateView.getOperator());
+				}
+			}
 		});
 		countDownLatch.countDown();
 	}
+
+	/**
+	 * 补差价可选平台
+	 */
+	@GetMapping("/get/diff/goods")
+	public Result<List<OrderDonDifferGoods>> getDiffGoods() {
+		List<OrderDonDifferGoods> orderDonDifferGoods = beanSearcher.searchAll(OrderDonDifferGoods.class, MapUtils.flatBuilder(request.getParameterMap()).orderBy(OrderDonDifferGoods::getGoodsId).build());
+		return GatewayResponse.SUCCESS.newBuilder().toResult(orderDonDifferGoods);
+	}
+
+	/**
+	 * 新增补差价平台
+	 */
+	@PostMapping("/post/diff/goods")
+	public Result<String> insertDiffGoods(@RequestBody OrderDonDifferGoods orderDonDifferGoods) {
+		try {
+			orderDonDifferGoodsMapper.insert(orderDonDifferGoods);
+		} catch (DuplicateKeyException e) {
+		}
+		return GatewayResponse.SUCCESS.newBuilder().toResult();
+	}
+
+	/**
+	 * 更新补差价订单关联信息
+	 */
+	@PutMapping("/update/diff/info")
+	public Result<String> updateDiffOrderDonInfo(@RequestBody OrderDonDifferRelate relate) {
+		OrderDonDifferRelate orderDonDifferRelate = orderDonDifferRelateMapper.selectOne(Wrappers.lambdaQuery(OrderDonDifferRelate.class)
+				.eq(OrderDonDifferRelate::getOrderId, relate.getOrderId())
+				.last("limit 1"));
+		if (orderDonDifferRelate != null) {
+			relate.setId(orderDonDifferRelate.getId());
+			orderDonDifferRelateMapper.updateById(relate);
+		} else orderDonDifferRelateMapper.insert(relate);
+		return GatewayResponse.SUCCESS.newBuilder().toResult();
+	}
 }