Просмотр исходного кода

Merge remote-tracking branch 'origin/zx_saas_goods' into zx_saas_goods

# Conflicts:
#	mec-client-api/src/main/java/com/ym/mec/web/WebFeignService.java
yuanliang 1 год назад
Родитель
Сommit
e7e54befc0

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderAddress.java

@@ -42,6 +42,10 @@ public class MusicGroupPaymentCalenderAddress implements Serializable {
     @ApiModelProperty(value = "区")
     private String region;
 
+    @TableField("post_code_")
+    @ApiModelProperty(value = "邮编")
+    private String postCode;
+
     @TableField("address_")
     @ApiModelProperty(value = "详细地址")
     private String address;

+ 20 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -19,6 +19,7 @@ import com.ym.mec.biz.event.source.SendSeoMessageSource;
 import com.ym.mec.biz.service.*;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.dto.OrderCreate;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
@@ -1032,6 +1033,25 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
                         , studentIds, courseIds, classGroupStudents, allLockCourseIds, batchNo, adjust.getMasterTotalPrice());
             } else if (calender.getPaymentType() == GOODS_PURCHASE) {
                 //TODO 推送订单到商城
+                OrderCreate orderCreate = new OrderCreate();
+                String orderNo = idGeneratorService.generatorId("payment") + "";
+                orderCreate.setOrderNo(orderNo);
+                orderCreate.setOrchestraId(musicGroup.getId());
+                orderCreate.setMemberId(musicGroup.getSchoolId().longValue());
+                orderCreate.setTotalAmount(calender.getCurrentTotalAmount());
+                orderCreate.setOrderFormType("MEC");
+                orderCreate.setPlatformType("SCHOOL");
+                MusicGroupPaymentCalenderAddress address = musicGroupPaymentCalenderAddressService.lambdaQuery()
+                        .eq(MusicGroupPaymentCalenderAddress::getCalenderId, calender.getId()).one();
+                if (address != null) {
+                    orderCreate.setReceiverName(address.getName());
+                    orderCreate.setReceiverPostCode(address.getPostCode());
+                    orderCreate.setReceiverPhone(address.getPhone());
+                    orderCreate.setReceiverProvince(address.getProvince());
+                    orderCreate.setReceiverCity(address.getCity());
+                    orderCreate.setReceiverRegion(address.getRegion());
+                    orderCreate.setReceiverDetailAddress(address.getAddress());
+                }
             }
             for (MusicGroupPaymentCalender musicGroupPaymentCalender : musicGroupPaymentCalenders) {
                 //将0元未缴费学员缴费状态更新为已缴费

+ 5 - 0
mec-client-api/src/main/java/com/ym/mec/web/WebFeignService.java

@@ -1,6 +1,7 @@
 package com.ym.mec.web;
 
 import com.ym.mec.common.config.FeignConfiguration;
+import com.ym.mec.common.dto.SchoolDto;
 import com.ym.mec.common.entity.GoodsSubModel;
 import com.ym.mec.common.entity.GoodsSubStockModel;
 import com.ym.mec.common.entity.HttpResponseResult;
@@ -96,4 +97,8 @@ public interface WebFeignService {
 	// 商城商品库存更新,同步商品库存
 	@PostMapping("/api/goodsStockCountSynchronize")
 	HttpResponseResult<Boolean> goodsStockCountSynchronize(@RequestBody List<GoodsSubStockModel> goodsSubStockModels);
+
+	// 商城商品库存更新,同步商品库存
+	@PostMapping("/api/schoolListByIds")
+	HttpResponseResult<SchoolDto> schoolListByIds(List<Long> schoolIds);
 }

+ 6 - 0
mec-client-api/src/main/java/com/ym/mec/web/fallback/WebFeignServiceFallback.java

@@ -1,5 +1,6 @@
 package com.ym.mec.web.fallback;
 
+import com.ym.mec.common.dto.SchoolDto;
 import com.ym.mec.common.entity.GoodsSubModel;
 import com.ym.mec.common.entity.GoodsSubStockModel;
 import com.ym.mec.common.entity.HttpResponseResult;
@@ -126,4 +127,9 @@ public class WebFeignServiceFallback implements WebFeignService {
 	public HttpResponseResult<Boolean> goodsStockCountSynchronize(List<GoodsSubStockModel> goodsSubStockModels) {
 		return null;
 	}
+
+    @Override
+    public HttpResponseResult<SchoolDto> schoolListByIds(List<Long> schoolIds) {
+        return null;
+    }
 }

+ 23 - 0
mec-common/common-core/src/main/java/com/ym/mec/common/dto/SchoolDto.java

@@ -0,0 +1,23 @@
+package com.ym.mec.common.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author liujunchi
+ * @date 2023-01-10
+ */
+@Data
+public class SchoolDto {
+
+    // 学校ID
+    private Long id;
+
+    // 学校名称
+    private String name;
+}

+ 4 - 1
mec-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/service/impl/OmsOrderServiceImpl.java

@@ -75,7 +75,10 @@ public class OmsOrderServiceImpl implements OmsOrderService {
     @Override
     public List<OrderVo> list(OmsOrderQueryParam queryParam, Integer pageSize, Integer pageNum) {
         PageHelper.startPage(pageNum, pageSize);
-        return orderDao.getList(queryParam);
+        List<OrderVo> list = orderDao.getList(queryParam);
+
+
+        return list;
     }
 
     @Override

+ 21 - 0
mec-mall/mall-mbg/src/main/java/com/yonge/cooleshow/mbg/model/OmsOrder.java

@@ -11,11 +11,17 @@ public class OmsOrder implements Serializable {
 
     private Long memberId;
 
+    private Long orchestraId;
+
     private String couponId;
 
     @ApiModelProperty("下单平台 STUDENT TEACHER")
     private String platformType;
 
+
+    @ApiModelProperty(value = "订单来源 ")
+    private String orderFormType;
+
     @ApiModelProperty(value = "订单编号")
     private String orderSn;
 
@@ -147,6 +153,21 @@ public class OmsOrder implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
+    public Long getOrchestraId() {
+        return orchestraId;
+    }
+
+    public void setOrchestraId(Long orchestraId) {
+        this.orchestraId = orchestraId;
+    }
+
+    public String getOrderFormType() {
+        return orderFormType;
+    }
+
+    public void setOrderFormType(String orderFormType) {
+        this.orderFormType = orderFormType;
+    }
 
     public int getAfterSale() {
         return afterSale;

+ 33 - 3
mec-mall/mall-mbg/src/main/resources/config/mybatis/OmsOrderMapper.xml

@@ -4,6 +4,7 @@
   <resultMap id="BaseResultMap" type="com.yonge.cooleshow.mbg.model.OmsOrder">
     <id column="id" jdbcType="BIGINT" property="id" />
     <result column="member_id" jdbcType="BIGINT" property="memberId" />
+    <result column="orchestra_id" jdbcType="BIGINT" property="orchestraId" />
     <result column="coupon_id" property="couponId" />
     <result column="order_sn" jdbcType="VARCHAR" property="orderSn" />
     <result column="cart_ids" jdbcType="VARCHAR" property="cartIds" />
@@ -48,6 +49,7 @@
     <result column="comment_time" jdbcType="TIMESTAMP" property="commentTime" />
     <result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime" />
     <result column="platform_type" jdbcType="TIMESTAMP" property="platformType" />
+    <result column="order_form_type" jdbcType="TIMESTAMP" property="orderFormType" />
     <result column="after_sale"  property="afterSale" />
   </resultMap>
   <sql id="Example_Where_Clause">
@@ -115,7 +117,7 @@
     integration, growth, promotion_info, bill_type, bill_header, bill_content, bill_receiver_phone, 
     bill_receiver_email, receiver_name, receiver_phone, receiver_post_code, receiver_province, 
     receiver_city, receiver_region, receiver_detail_address, note, confirm_status, delete_status, 
-    use_integration, payment_time, delivery_time, receive_time, comment_time, modify_time,cart_ids,platform_type,after_sale
+    use_integration, payment_time, delivery_time, receive_time, comment_time, modify_time,cart_ids,platform_type,after_sale,orchestra_id,order_form_type
   </sql>
   <select id="selectByExample" parameterType="com.yonge.cooleshow.mbg.model.OmsOrderExample" resultMap="BaseResultMap">
     select
@@ -165,7 +167,7 @@
       receiver_detail_address, note, confirm_status, 
       delete_status, use_integration, payment_time, 
       delivery_time, receive_time, comment_time, 
-      modify_time,cart_ids,platform_type,after_sale)
+      modify_time,cart_ids,platform_type,after_sale,orchestra_id,order_form_type
     values (#{memberId,jdbcType=BIGINT}, #{couponId}, #{orderSn,jdbcType=VARCHAR},
       #{createTime,jdbcType=TIMESTAMP}, #{memberUsername,jdbcType=VARCHAR}, #{totalAmount,jdbcType=DECIMAL}, 
       #{payAmount,jdbcType=DECIMAL}, #{freightAmount,jdbcType=DECIMAL}, #{promotionAmount,jdbcType=DECIMAL}, 
@@ -180,7 +182,7 @@
       #{receiverDetailAddress,jdbcType=VARCHAR}, #{note,jdbcType=VARCHAR}, #{confirmStatus,jdbcType=INTEGER}, 
       #{deleteStatus,jdbcType=INTEGER}, #{useIntegration,jdbcType=INTEGER}, #{paymentTime,jdbcType=TIMESTAMP}, 
       #{deliveryTime,jdbcType=TIMESTAMP}, #{receiveTime,jdbcType=TIMESTAMP}, #{commentTime,jdbcType=TIMESTAMP}, 
-      #{modifyTime,jdbcType=TIMESTAMP},#{cartIds},#{platformType},#{afterSale})
+      #{modifyTime,jdbcType=TIMESTAMP},#{cartIds},#{platformType},#{afterSale},#{orchestraId},#{orderFormType})
   </insert>
   <insert id="insertSelective" parameterType="com.yonge.cooleshow.mbg.model.OmsOrder">
     <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
@@ -326,6 +328,12 @@
       <if test="afterSale != null">
         after_sale,
       </if>
+        <if test="orchestraId != null">
+            orchestra_id,
+        </if>
+        <if test="orderFormType != null">
+            order_form_type,
+        </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="memberId != null">
@@ -466,6 +474,12 @@
       <if test="afterSale != null">
         #{afterSale},
       </if>
+        <if test="orchestraId != null">
+            #{orchestraId},
+        </if>
+        <if test="orderFormType != null">
+            #{orderFormType},
+        </if>
     </trim>
   </insert>
   <select id="countByExample" parameterType="com.yonge.cooleshow.mbg.model.OmsOrderExample" resultType="java.lang.Long">
@@ -618,6 +632,12 @@
       <if test="record.afterSale != null">
         after_sale = #{record.afterSale},
       </if>
+        <if test="record.orchestraId != null">
+            orchestra_id = #{record.orchestraId},
+        </if>
+        <if test="record.orderFormType != null">
+            order_form_type = #{record.orderFormType},
+        </if>
     </set>
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
@@ -671,6 +691,8 @@
       cart_ids = #{record.cartIds},
       platform_type = #{record.platformType},
       after_sale = #{record.afterSale},
+        orchestra_id = #{record.orchestraId},
+        order_form_type = #{record.orderFormType},
       modify_time = #{record.modifyTime,jdbcType=TIMESTAMP}
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
@@ -817,6 +839,12 @@
       <if test="afterSale != null">
         after_sale = #{afterSale},
       </if>
+        <if test="orchestraId != null">
+            orchestra_id = #{orchestraId},
+        </if>
+        <if test="orderFormType != null">
+            order_form_type = #{orderFormType},
+        </if>
     </set>
     where id = #{id,jdbcType=BIGINT}
   </update>
@@ -867,6 +895,8 @@
       cart_ids = #{cartIds},
       platform_type = #{platformType},
       after_sale = #{afterSale},
+        orchestra_id = #{orchestraId},
+        order_form_type = #{orderFormType},
       modify_time = #{modifyTime,jdbcType=TIMESTAMP}
     where id = #{id,jdbcType=BIGINT}
   </update>

+ 15 - 1
mec-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/controller/open/OpenShareController.java

@@ -69,11 +69,25 @@ public class OpenShareController extends BaseController {
     @PostMapping(value = "/product/orderCreate", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
     public R<Boolean> productOrderCreate(@RequestBody OrderCreate order) {
 
-        log.info("创建管乐订单:{}", JSON.toJSONString(order));
+        log.info("创建管乐订单:{}", JSON.toJSONString(order));
 
         portalOrderService.mecProductOrderCreate(order);
 
 
         return R.ok(true);
     }
+
+
+    // 同步订单状态,
+    /**
+     * 查询商品订单状态
+     * @param orderNo 订单编号
+     * @return status 订单状态  0->待付款;1->待发货;2->已发货;3->已完成;4->已关闭;5->无效订单
+     */
+    @GetMapping(value = "/product/updateOrderStatus", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
+    public boolean productUpdateOrderStatus(@RequestParam("orderNo") String orderNo,@RequestParam("status") Integer status) {
+        log.info("同步订单状态:{},{}", orderNo, status);
+        // 已发货订单不可修改状态
+        return portalOrderService.productUpdateOrderStatus(orderNo, status);
+    }
 }

+ 4 - 2
mec-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/dto/OrderCreate.java

@@ -17,7 +17,7 @@ import java.util.List;
 public class OrderCreate {
 
     @ApiModelProperty("乐团ID")
-    private Long orchestraId;
+    private String orchestraId;
 
     @ApiModelProperty("用户ID/学校ID")
     private Long memberId;
@@ -53,11 +53,13 @@ public class OrderCreate {
     private String orderFormType = "MEC";
 
 
-    @ApiModelProperty(value = "订单来源 SCHOOL:学校")
+    @ApiModelProperty(value = "订单来源 SCHOOL:学校,STUDENT:学生,TEACHER:老师")
     private String platformType = "SCHOOL";
 
     @ApiModelProperty(value = "详细地址")
     private String receiverDetailAddress;
+    @ApiModelProperty(value = "订单来源:0->PC订单;1->app订单 2->学校采购")
+    private Integer sourceType;
 
     @ApiModelProperty("商品详情")
     private List<OrderItem> orderItemList;

+ 3 - 0
mec-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/service/OmsPortalOrderService.java

@@ -118,4 +118,7 @@ public interface OmsPortalOrderService {
     void paymentRefundFailedHandle(String payTransNo, String msg, String refundTransNo);
 
     void mecProductOrderCreate(OrderCreate order);
+
+    // 同步订单状态,
+    boolean productUpdateOrderStatus(String orderNo, Integer status);
 }

+ 21 - 2
mec-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/service/impl/OmsPortalOrderServiceImpl.java

@@ -1439,7 +1439,7 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
 
 
     @Override
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     public void mecProductOrderCreate(OrderCreate order) {
 
 
@@ -1459,6 +1459,8 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
 
 
         detail = new OmsOrder();
+        detail.setOrchestraId(order.getOrchestraId());
+        detail.setOrderFormType(order.getOrderFormType());
         detail.setMemberId(order.getMemberId());
         detail.setPlatformType(order.getPlatformType());
         detail.setOrderSn(order.getOrderNo());
@@ -1475,7 +1477,7 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
         detail.setDiscountAmount(BigDecimal.ZERO);
         detail.setPayType(order.getPayType());
         detail.setConfirmStatus(0);
-        detail.setSourceType(1);
+        detail.setSourceType(order.getSourceType());
         detail.setStatus(1);
         detail.setOrderType(0);
         if (CollUtil.isNotEmpty(orderSettings)) {
@@ -1536,9 +1538,26 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
         if (!CollectionUtils.isEmpty(orderItemList)) {
             orderItemDao.insertList(orderItemList);
         }
+    }
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean productUpdateOrderStatus(String orderNo, Integer status) {
 
+        OmsOrderDetail detail = detail(orderNo);
+        if (detail == null) {
+            throw new BizException("订单不存在");
+        }
+        if (detail.getStatus() != 1 ) {
+            throw new BizException("当前订单状态不允许修改");
+        }
+        OmsOrder omsOrder = new OmsOrder();
+        omsOrder.setId(detail.getId());
+        omsOrder.setStatus(status);
+        omsOrder.setModifyTime(new Date());
+        orderMapper.updateByPrimaryKeySelective(omsOrder);
 
 
+        return true;
     }
 }