浏览代码

查询部分上架,部分销售,部分下单

qzy 3 周之前
父节点
当前提交
a3eaa0a4f7

+ 5 - 0
sp-service/level-one-server/src/main/java/com/pj/ht_trade_settlement/HtTradeSettlement.java

@@ -279,6 +279,11 @@ public class HtTradeSettlement extends Model<HtTradeSettlement> implements Seria
 	 */
 	private Date hzsConfirmTime;
 
+	/**
+	 * 上架总数
+	 */
+	private Integer upCount;
+
 
 	@TableField(exist = false)
 	private String sumUpPrice;

+ 33 - 0
sp-service/level-one-server/src/main/java/com/pj/ht_trade_settlement/HtTradeSettlementMapper.xml

@@ -58,6 +58,39 @@
 			<if test=' this.has("chargebacks") '> and chargebacks = #{chargebacks} </if>
 			<if test=' this.has("hzsConfirmStatus") '> and hzs_confirm_status = #{hzsConfirmStatus} </if>
 			<if test=' this.has("id") '> and id = #{id} </if>
+			<if test=' this.has("upStatus") '>
+				<if test='upStatus==1'>
+					and order_count=up_count
+				</if>
+				<if test='upStatus==2'>
+					and up_count=0
+				</if>
+				<if test='upStatus==3'>
+					and order_count &gt; up_count and up_count &gt; 0
+				</if>
+			 </if>
+			<if test=' this.has("saleStatus") '>
+				<if test='saleStatus==1'>
+					and order_count=on_sale_count
+				</if>
+				<if test='saleStatus==2'>
+					and on_sale_count=0
+				</if>
+				<if test='saleStatus==3'>
+					and order_count &gt; on_sale_count and on_sale_count &gt; 0
+				</if>
+			</if>
+			<if test=' this.has("beOrderStatus") '>
+				<if test='beOrderStatus==1'>
+					and order_count=be_order_count
+				</if>
+				<if test='beOrderStatus==2'>
+					and be_order_count=0
+				</if>
+				<if test='beOrderStatus==3'>
+					and order_count &gt; be_order_count and be_order_count &gt; 0
+				</if>
+			</if>
 		</where>
 		order by
 		<choose>

+ 17 - 11
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderService.java

@@ -721,13 +721,13 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
      */
     public boolean orderRefund(Long id) {
         TbOrder order = getById(id);
-        int refundStatus=order.getRefundStatus();
-        if(refundStatus==1||refundStatus==3){
+        int refundStatus = order.getRefundStatus();
+        if (refundStatus == 1 || refundStatus == 3) {
             StaticLog.error("\n---------退货退款失败:{}已退货退款", id);
             throw new AjaxError("订单已退款或者退款中");
         }
-        int sx010Status=order.getSxb010Status();
-        if (sx010Status!=1){
+        int sx010Status = order.getSxb010Status();
+        if (sx010Status != 1) {
             StaticLog.error("\n---------退货退款失败:{}银行��边民的款未成功", id);
             throw new AjaxError("银行扣边民的款未成功");
         }
@@ -767,9 +767,9 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
             throw new AjaxError("订单无商品信息");
         }
         Integer deductionCount = tbOrder.getDeductionCount() + 1;
-        if (tbOrder.getRefundStatus()!=0){
-            String tradeNo=tbOrder.getTradeNo();
-            tradeNo=StrUtil.subBefore(tradeNo,"_",false);
+        if (tbOrder.getRefundStatus() != 0) {
+            String tradeNo = tbOrder.getTradeNo();
+            tradeNo = StrUtil.subBefore(tradeNo, "_", false);
             tbOrder.setTradeNo(tradeNo + "_" + deductionCount);
         }
         PaymentDto paymentDto = this.getPaymentData(tbOrder);
@@ -795,9 +795,9 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
         if (!tbOrders.isEmpty()) {
             for (TbOrder tbOrder : tbOrders) {
                 Integer deductionCount = tbOrder.getDeductionCount() + 1;
-                if (tbOrder.getRefundStatus()!=0){
-                    String tradeNo=tbOrder.getTradeNo();
-                    tradeNo=StrUtil.subBefore(tradeNo,"_",false);
+                if (tbOrder.getRefundStatus() != 0) {
+                    String tradeNo = tbOrder.getTradeNo();
+                    tradeNo = StrUtil.subBefore(tradeNo, "_", false);
                     tbOrder.setTradeNo(tradeNo + "_" + deductionCount);
                 }
                 PaymentDto paymentDto = this.getPaymentData(tbOrder);
@@ -1155,13 +1155,16 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
     }
 
     public void up(Long id, String upPrice) {
-        TbOrder tbOrder = new TbOrder();
+        TbOrder tbOrder = this.getById(id);
         tbOrder.setId(id);
         tbOrder.setUpPrice(new BigDecimal(upPrice)).setUpTime(new Date()).setUpStatus(2);
         int i = tbOrderMapper.updateById(tbOrder);
         if (i != 1) {
             throw new AjaxError("上架失败");
         }
+        HtTradeSettlement htTradeSettlement = htTradeSettlementService.getById(tbOrder.getSaleMainId());
+        htTradeSettlement.setUpCount(htTradeSettlement.getUpCount() + 1);
+        htTradeSettlementService.updateById(htTradeSettlement);
     }
 
     public void down(Long id) {
@@ -1174,6 +1177,9 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
         }
         db.setUpStatus(1);
         this.updateById(db);
+        HtTradeSettlement htTradeSettlement = htTradeSettlementService.getById(db.getSaleMainId());
+        htTradeSettlement.setUpCount(htTradeSettlement.getUpCount() - 1);
+        htTradeSettlementService.updateById(htTradeSettlement);
     }
 
     public List<OrderDto> getOrderListByMainIds(String mainIds) {