فهرست منبع

8.8 一级市场取消订单接口

Mechrevo 2 سال پیش
والد
کامیت
057b39f271

+ 74 - 0
sp-core/sp-api/src/main/java/com/pj/api/dto/OrderDto.java

@@ -10,6 +10,80 @@ import java.util.Date;
  * @Date 2023 08 07 11 51
  **/
 public class OrderDto {
+    /**
+     * 边民或组长取消订单(0=未取消,1=已取消)
+     */
+    private Integer cancelPeople;
+
+    public Integer getCancelPeople() {
+        return cancelPeople;
+    }
+
+    public void setCancelPeople(Integer cancelPeople) {
+        this.cancelPeople = cancelPeople;
+    }
+
+    public OrderDto() {
+    }
+
+    public OrderDto(Integer cancelPeople, Long id, Long tradeAreaId, String tradeAreaName, String addressIds, Long saleMainId, Long groupId, Long goodsId, String tradeNo, Long buyUserId, String buyUserName, String buyUserType, Long enterpriseId, String enterpriseName, Double totalWeight, Double totalPrice, Date tradeTime, Integer tradeStatus, String payType, String settleTime, Double realPrice, Double shouldPrice, Long settleUserId, Long recordUserId, String recordTime, String record, String refundReason, String refundTime, String receiveName, String receivePhone, String receiveAddress, String outTime, String goodsNames, Integer apply, String applyTime, String applyResult, String applyFailReason, String distribution, Integer peopleConfirm, Integer enterpriseConfirm, String pick, Date pickTime, Long shopId, String shopName, Integer send, String sendTime, Long levelTwoOrderId, Date createTime, Long createBy, String createName, Date updateTime, Long updateBy, String updateName, Integer deleteStatus, Integer finishStatus, Integer resaleStatus) {
+        this.cancelPeople = cancelPeople;
+        this.id = id;
+        this.tradeAreaId = tradeAreaId;
+        this.tradeAreaName = tradeAreaName;
+        this.addressIds = addressIds;
+        this.saleMainId = saleMainId;
+        this.groupId = groupId;
+        this.goodsId = goodsId;
+        this.tradeNo = tradeNo;
+        this.buyUserId = buyUserId;
+        this.buyUserName = buyUserName;
+        this.buyUserType = buyUserType;
+        this.enterpriseId = enterpriseId;
+        this.enterpriseName = enterpriseName;
+        this.totalWeight = totalWeight;
+        this.totalPrice = totalPrice;
+        this.tradeTime = tradeTime;
+        this.tradeStatus = tradeStatus;
+        this.payType = payType;
+        this.settleTime = settleTime;
+        this.realPrice = realPrice;
+        this.shouldPrice = shouldPrice;
+        this.settleUserId = settleUserId;
+        this.recordUserId = recordUserId;
+        this.recordTime = recordTime;
+        this.record = record;
+        this.refundReason = refundReason;
+        this.refundTime = refundTime;
+        this.receiveName = receiveName;
+        this.receivePhone = receivePhone;
+        this.receiveAddress = receiveAddress;
+        this.outTime = outTime;
+        this.goodsNames = goodsNames;
+        this.apply = apply;
+        this.applyTime = applyTime;
+        this.applyResult = applyResult;
+        this.applyFailReason = applyFailReason;
+        this.distribution = distribution;
+        this.peopleConfirm = peopleConfirm;
+        this.enterpriseConfirm = enterpriseConfirm;
+        this.pick = pick;
+        this.pickTime = pickTime;
+        this.shopId = shopId;
+        this.shopName = shopName;
+        this.send = send;
+        this.sendTime = sendTime;
+        this.levelTwoOrderId = levelTwoOrderId;
+        this.createTime = createTime;
+        this.createBy = createBy;
+        this.createName = createName;
+        this.updateTime = updateTime;
+        this.updateBy = updateBy;
+        this.updateName = updateName;
+        this.deleteStatus = deleteStatus;
+        this.finishStatus = finishStatus;
+        this.resaleStatus = resaleStatus;
+    }
 
     private Long id;
 

+ 1 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_goods_transit/MethodGoodsTransitService.java

@@ -116,6 +116,7 @@ public class MethodGoodsTransitService {
         tbOrder.setEnterpriseName(tbGoodsTransit.getMerchantName());
         tbOrder.setTotalWeight(tbGoodsTransit.getGrossWeight());
         tbOrder.setTotalPrice(tbGoodsTransit.getPrice());
+        tbOrder.setCancelPeople(0); // 0=订单未取消,默认状态
 //		tbOrder.setTradeTime();  // 交易时间
 //		tbOrder.setPayType();  //交易类型
 //		tbOrder.setRealPrice();  // 当前结算金额

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

@@ -132,6 +132,11 @@ public class TbOrder extends Model<TbOrder> implements Serializable {
 	private Integer tradeStatus;
 
 	/**
+	 * 边民或组长取消订单(0=未取消,1=已取消)
+	 */
+	private Integer cancelPeople;
+
+	/**
 	 * 支付方式(0=金融互助,1=现金刷卡)
 	 */
 	private String payType;

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

@@ -84,6 +84,17 @@ public class TbOrderAppController {
 		return AjaxJson.getError();
 	}
 
+	/**
+	 * 组长或者边民取消订单
+	 * @param orderId  一级市场订单ID
+	 */
+	@RequestMapping("cancelOrder")
+	public AjaxJson cancelOrder(Long orderId) {
+		boolean result = tbOrderService.cancelOrder(orderId);
+		if(result) return AjaxJson.getSuccess();
+		return AjaxJson.getError();
+	}
+
 	/*-----           正常业务逻辑👆👆    rpc远程调用👇👇 -----*/
 
 	/** 改 转售状态:根据订单Id把订单改为已转售 */

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

@@ -15,6 +15,8 @@ import com.pj.enummj.ApplyStatus;
 import com.pj.enummj.DeleteStatus;
 import com.pj.enummj.TradeStatus;
 import com.pj.enummj.UserType;
+import com.pj.tb_goods_transit.TbGoodsTransit;
+import com.pj.tb_goods_transit.TbGoodsTransitMapper;
 import com.pj.tb_people.TbPeople;
 import com.pj.tb_people.TbPeopleMapper;
 import com.pj.utils.so.SoMap;
@@ -44,6 +46,9 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
 	@Autowired
 	private MethodOrderService methodOrderService;
 
+	@Autowired
+	private TbGoodsTransitMapper tbGoodsTransitMapper;
+
 	/**  app端: 生成一级市场订单 */
 	void appAdd(TbOrder t){
 		//获取当前登陆人
@@ -111,6 +116,38 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
 		return tbOrderMapper.getList(so);
 	}
 
+	/**
+	 * 组长或者边民取消订单
+	 * @param orderId  一级市场订单ID
+	 */
+	public boolean cancelOrder(Long orderId){
+		//获取登录用户
+		APPLoginUserInfo appLoginInfo = StpAPPUserUtil.getAPPLoginInfo();
+		if(appLoginInfo == null || appLoginInfo.getLoginId() == null)
+			throw new RuntimeException("当前登录账号信息已失效!");
+		//查询订单
+		TbOrder tbOrder = tbOrderMapper.selectById(orderId);
+		if(tbOrder == null)throw new ServiceException("订单状态异常!");
+		//将状态设置已取消
+		tbOrder.setCancelPeople(1);
+		//执行保存
+		int updateById = tbOrderMapper.updateById(tbOrder);
+		//将goodstransit放开
+		if(updateById == 1){
+			//获取goods TransitID
+			Long goodsId = tbOrder.getGoodsId();
+			TbGoodsTransit tbGoodsTransit = tbGoodsTransitMapper.selectById(goodsId);
+			if(tbGoodsTransit == null)throw new RuntimeException("商品发布信息异常!");
+			//将商品发布修改成可接单状态
+			tbGoodsTransit.setIsOrders(0); // 未被下单
+			tbGoodsTransit.setEnterpriseConfirm(0); // 修改商户确认状态为未确认
+			//执行保存
+			int updated = tbGoodsTransitMapper.updateById(tbGoodsTransit);
+			return updated == 1;
+		}
+		return false;
+	}
+
 
 	/**
 	 * 查集合 - 根据条件(参数为空时代表忽略指定条件)

+ 2 - 2
sp-service/level-two-server/src/main/java/com/pj/tb_goods_demand/TbGoodsDemandService.java

@@ -117,8 +117,8 @@ public class TbGoodsDemandService extends ServiceImpl<TbGoodsDemandMapper, TbGoo
 	public boolean disposeOrders(Integer disposeStatus,Long goodsDemandId,Long demandQuotationId,String purchaserRemark)  {
 		//获取并判断当前登陆人
 		APPLoginUserInfo appLoginInfo = StpAPPUserUtil.getAPPLoginInfo();
-		if(appLoginInfo == null || appLoginInfo.getLoginId() == null)
-			throw new ServiceException("当前登录账号信息已失效!");
+		if(appLoginInfo == null || appLoginInfo.getLoginId() == null) throw new ServiceException("当前登录账号信息已失效!");
+
 		//同意则开始创建订单,不同意则修改报价表和需求表状态
 		if(disposeStatus == 1){
 			return methodGoodsDemandService.agreeQuotation(appLoginInfo,goodsDemandId,demandQuotationId,purchaserRemark);