022d350a lauka

菠萝派接口-发货接口,统一使用writeDao,防止数据不一致,修改已有快单就不允许重复添加

1 个父辈 eb01643e
......@@ -43,4 +43,11 @@ public interface MemberWriteDao {
*/
int updateProductStock(Map<String,Object> params);
/**
* 查询该订单是否有该快递单号
* @param params
* @return
*/
int checkLogisticsNumber(Map<String,Object> params);
}
......
......@@ -4,6 +4,56 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sibu.orderHelper.mall.member.write.MemberWriteDao">
<!-- 订单实体 -->
<resultMap id="orders" type="com.sibu.orderHelper.integral.pineapple.model.Orders">
<result property="id" column="id" />
<result property="sellerId" column="seller_id" />
<result property="sellerName" column="seller_name" />
<result property="orderId" column="order_id" />
<result property="orderSn" column="order_sn" />
<result property="orderProductId" column="order_product_id" />
<result property="productId" column="product_id" />
<result property="productName" column="product_name" />
<result property="memberId" column="member_id" />
<result property="memberName" column="member_name" />
<result property="provinceId" column="province_id" />
<result property="cityId" column="city_id" />
<result property="areaId" column="area_id" />
<result property="addressAll" column="address_all" />
<result property="addressInfo" column="address_info" />
<result property="zipCode" column="zip_code" />
<result property="changeName" column="change_name" />
<result property="phone" column="phone" />
<result property="logisticsId" column="logistics_id" />
<result property="logisticsName" column="logistics_name" />
<result property="logisticsMark" column="logistics_mark" />
<result property="logisticsNumber" column="logistics_number" />
<result property="number" column="number" />
<result property="question" column="question" />
<result property="image" column="image" />
<result property="name" column="name" />
<result property="state" column="state" />
<result property="optId" column="opt_id" />
<result property="optName" column="opt_name" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="regionName1" column="regionName1" />
<result property="regionName2" column="regionName2" />
<result property="regionName3" column="regionName3" />
<result property="orderState" column="order_state" />
<result property="moneyOrder" column="money_order" />
<result property="moneyPaidBalance" column="money_paid_balance" />
<result property="moneyCoupon" column="money_coupon" />
<result property="moneyLogistics" column="money_logistics" />
<result property="moneyProduct" column="money_product" />
<result property="moneyActFull" column="money_act_full" />
<result property="moneyDiscount" column="money_discount" />
<result property="moneyBack" column="money_back" />
<result property="moneyIntegral" column="money_integral" />
<result property="payTime" column="pay_time" />
</resultMap>
<select id="count" resultType="java.lang.Integer">
select count(*) from member
</select>
......@@ -18,6 +68,12 @@
UPDATE orders SET remark = #{remark},update_time = now() WHERE order_sn = #{orderSn} AND seller_id = #{sellerId}
</update>
<!-- 订单发货-->
<!-- 验证订单号是否已存在-->
<select id="checkLogisticsNumber" parameterType="java.util.Map" resultType="java.lang.Integer">
select count(*) from orders where order_sn = #{orderSn} AND seller_id = #{sellerId} and logistics_number like concat(concat('%',#{logisticsNumber},'%'))
</select>
<!--更改订单状态、电话、地址、发货时间、收货人姓名,快递单号 -->
<update id="updateOrdersState">
......
......@@ -41,17 +41,16 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen
params.put("orderSn",callRequest.getBizModel().getPlatOrderNo());
params.put("sellerId",callRequest.getSupplier().getId());
Orders orders = memberReadDao.getOrdersByMap(params);
Orders orders = memberWriteDao.getOrdersByMap(params);
if(StringUtil.isNull(orders)){
log.error(String.format("订单发货,获取订单数据业务异常:[%s]",callRequest.getBizModel().getPlatOrderNo()));
throw new BizException(String.format("订单发货,获取订单数据业务异常:[%s]",callRequest.getBizModel().getPlatOrderNo()));
}
//只有订单状态为12345可以允许修改快递单号,其中状态为123可以修改地址,发货时间,订单状态,其他订单状态直接报业务异常
if(orders.getOrderState().intValue() != EJavaShopOrderStateEnum.RefundFail.getCode() && orders.getOrderState().intValue() != EJavaShopOrderStateEnum.WaitPay.getCode()){
if(orders.getOrderState().intValue() == EJavaShopOrderStateEnum.WaitConfirmed.getCode()
|| orders.getOrderState().intValue() == EJavaShopOrderStateEnum.WaitShip.getCode()){
//只有订单状态为345可以允许操作该接口,其中状态为3才可以修改地址,发货时间,订单状态,其他订单状态直接报业务异常,4、5只允许添加快递单号
if(orders.getOrderState().intValue() != EJavaShopOrderStateEnum.RefundFail.getCode() && orders.getOrderState().intValue() != EJavaShopOrderStateEnum.WaitPay.getCode()
&& orders.getOrderState().intValue() != EJavaShopOrderStateEnum.WaitConfirmed.getCode()){
if( orders.getOrderState().intValue() == EJavaShopOrderStateEnum.WaitShip.getCode()){
//订单状态
params.put("state",EJavaShopOrderStateEnum.HasReceived.getCode());
//收货人名字
......@@ -62,21 +61,25 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen
if(!StringUtil.isNull(callRequest.getBizModel().getSenderTel())){
params.put("mobile",callRequest.getBizModel().getSenderTel());
}
//地址、快递信息
this.gainInfo(params,callRequest,orders);
//地址、快递信息 建议去除
//this.gainInfo(params,callRequest,orders);
}
if(!StringUtil.isNull(callRequest.getBizModel().getLogisticNo())){
//判断该快递订单号是否存在,已存在就不允许把该快递订单号添加进去
int num = memberReadDao.checkLogisticsNumber(params);
if(num == 0){
if(StringUtil.isNull(orders.getLogisticsNumber())){
params.put("logisticsNumber",callRequest.getBizModel().getLogisticNo());
}else{
params.put("logisticsNumber",orders.getLogisticsNumber()+";"+callRequest.getBizModel().getLogisticNo());
}
}
Map<String,Object> checkMap = new HashMap<>();
checkMap.put("logisticsNumber",callRequest.getBizModel().getLogisticNo());
checkMap.put("orderSn",callRequest.getBizModel().getPlatOrderNo());
checkMap.put("sellerId",callRequest.getSupplier().getId());
int num = memberWriteDao.checkLogisticsNumber(checkMap);
if(num == 0){
if(StringUtil.isNull(orders.getLogisticsNumber())){
params.put("logisticsNumber",callRequest.getBizModel().getLogisticNo());
}else{
params.put("logisticsNumber",orders.getLogisticsNumber()+";"+callRequest.getBizModel().getLogisticNo());
}
}
}
}else{
......