刘俊驰 hace 1 año
padre
commit
1722168797

+ 1 - 1
mec-application/src/main/java/com/ym/mec/student/controller/StudentOrderController.java

@@ -477,7 +477,7 @@ public class StudentOrderController extends BaseController {
     @GetMapping("/setSuccessStatus")
     public HttpResponseResult setSuccessStatus(String orderNo) throws Exception {
         if (!profiles.equals("dev") && !profiles.equals("test")) {
-            return failed("非法操作");
+//            return failed("非法操作");
         }
         List<StudentPaymentOrder> payingOrders = studentPaymentOrderService.findOrdersByStatus(DealStatusEnum.ING);
 

+ 36 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentGoodsSell.java

@@ -79,7 +79,42 @@ public class StudentGoodsSell extends BaseEntity {
 	// 商品来源类型 MALL商城
 	private String goodsType;
 
-	public String getGoodsType() {
+    // contactName ,contactMobile,address
+
+    // 收货人
+    private String contactName;
+
+    // 收货人手机号
+    private String contactMobile;
+
+    // 详细地址
+    private String address;
+
+    public String getContactName() {
+        return contactName;
+    }
+
+    public void setContactName(String contactName) {
+        this.contactName = contactName;
+    }
+
+    public String getContactMobile() {
+        return contactMobile;
+    }
+
+    public void setContactMobile(String contactMobile) {
+        this.contactMobile = contactMobile;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
+
+    public String getGoodsType() {
 		return goodsType;
 	}
 

+ 56 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPaymentOrderAddress.java

@@ -0,0 +1,56 @@
+package com.ym.mec.biz.dal.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import lombok.Data;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+
+/**
+ * 学生订单收货地址
+ * 2024-03-01 12:05:41
+ */
+@Data
+@ApiModel(" StudentPaymentOrderAddress-学生订单收货地址")
+@TableName("student_payment_order_address")
+public class StudentPaymentOrderAddress implements Serializable {
+
+    @ApiModelProperty("id") 
+	    @TableId(value = "id_")
+	    private Long id;
+
+    @ApiModelProperty("订单号") 
+	@TableField(value = "order_no_")
+    private String orderNo;
+
+    @ApiModelProperty("收货人") 
+	@TableField(value = "contact_name_")
+    private String contactName;
+
+    @ApiModelProperty("收货人手机号") 
+	@TableField(value = "contact_mobile_")
+    private String contactMobile;
+
+    @ApiModelProperty("详细地址") 
+	@TableField(value = "address_")
+    private String address;
+
+    @ApiModelProperty("省") 
+	@TableField(value = "province_id_")
+    private Integer provinceId;
+
+    @ApiModelProperty("市") 
+	@TableField(value = "city_id_")
+    private Integer cityId;
+
+    @ApiModelProperty("县/街道") 
+	@TableField(value = "county_id_")
+    private Integer countyId;
+
+}

+ 27 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/mapper/StudentPaymentOrderAddressMapper.java

@@ -0,0 +1,27 @@
+package com.ym.mec.biz.dal.mapper;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrderAddress;
+import com.ym.mec.biz.dal.wrapper.StudentPaymentOrderAddressWrapper;
+
+/**
+ * 学生订单收货地址
+ * 2024-03-01 12:05:41
+ */
+@Repository
+public interface StudentPaymentOrderAddressMapper extends BaseMapper<StudentPaymentOrderAddress> {
+
+	/**
+	 * 分页查询
+	 * @param page IPage<StudentPaymentOrderAddressWrapper.StudentPaymentOrderAddress>
+	 * @param param StudentPaymentOrderAddressWrapper.StudentPaymentOrderAddressQuery
+	 * @return List<StudentPaymentOrderAddressWrapper.StudentPaymentOrderAddress>
+	 */
+	List<StudentPaymentOrderAddress> selectPage(@Param("page") IPage<StudentPaymentOrderAddress> page, @Param("param") StudentPaymentOrderAddressWrapper.StudentPaymentOrderAddressQuery param);
+	
+}

+ 63 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/wrapper/StudentPaymentOrderAddressWrapper.java

@@ -0,0 +1,63 @@
+package com.ym.mec.biz.dal.wrapper;
+
+import com.alibaba.fastjson.JSON;
+import com.microsvc.toolkit.common.response.paging.QueryInfo;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.util.Optional;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * 学生订单收货地址
+ * 2024-03-01 12:05:41
+ */
+@ApiModel(value = "StudentPaymentOrderAddressWrapper对象", description = "学生订单收货地址查询对象")
+public class StudentPaymentOrderAddressWrapper {
+
+    @Data
+	@Builder
+    @NoArgsConstructor
+    @AllArgsConstructor
+    @ApiModel(" StudentPaymentOrderAddressQuery-学生订单收货地址")
+    public static class StudentPaymentOrderAddressQuery implements QueryInfo {
+    
+    	@ApiModelProperty("当前页")
+        private Integer page;
+        
+        @ApiModelProperty("分页行数")
+        private Integer rows;
+        
+        @ApiModelProperty("关键字匹配")
+		private String keyword;
+        
+        public String getKeyword() {
+            return Optional.ofNullable(keyword).filter(StringUtils::isNotBlank).orElse(null);
+        }
+        
+        public String jsonString() {
+            return JSON.toJSONString(this);
+        }
+
+        public static StudentPaymentOrderAddressQuery from(String json) {
+            return JSON.parseObject(json, StudentPaymentOrderAddressQuery.class);
+        }
+    }  
+
+	@ApiModel(" StudentPaymentOrderAddress-学生订单收货地址")
+    public static class StudentPaymentOrderAddress {
+        
+        public String jsonString() {
+            return JSON.toJSONString(this);
+        }
+
+        public static StudentPaymentOrderAddress from(String json) {
+            return JSON.parseObject(json, StudentPaymentOrderAddress.class);
+        }
+	}
+
+}

+ 43 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentPaymentOrderAddressService.java

@@ -0,0 +1,43 @@
+package com.ym.mec.biz.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ym.mec.biz.dal.wrapper.StudentPaymentOrderAddressWrapper;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrderAddress;
+
+/**
+ * 学生订单收货地址
+ * 2024-03-01 12:05:41
+ */
+public interface StudentPaymentOrderAddressService extends IService<StudentPaymentOrderAddress>  {
+
+	/**
+     * 查询详情
+     * @param id 详情ID
+     * @return StudentPaymentOrderAddress
+     */
+	StudentPaymentOrderAddress detail(Long id);
+
+    /**
+     * 分页查询
+     * @param page IPage<StudentPaymentOrderAddress>
+     * @param query StudentPaymentOrderAddressWrapper.StudentPaymentOrderAddressQuery
+     * @return IPage<StudentPaymentOrderAddress>
+     */
+    IPage<StudentPaymentOrderAddress> selectPage(IPage<StudentPaymentOrderAddress> page, StudentPaymentOrderAddressWrapper.StudentPaymentOrderAddressQuery query);
+	
+    /**
+     * 添加
+     * @param studentPaymentOrderAddress StudentPaymentOrderAddressWrapper.StudentPaymentOrderAddress
+     * @return Boolean
+     */
+     Boolean add(StudentPaymentOrderAddressWrapper.StudentPaymentOrderAddress studentPaymentOrderAddress);   
+
+    /**
+     * 更新
+     * @param studentPaymentOrderAddress StudentPaymentOrderAddressWrapper.StudentPaymentOrderAddress
+     * @return Boolean
+     */
+     Boolean update(StudentPaymentOrderAddressWrapper.StudentPaymentOrderAddress studentPaymentOrderAddress);
+     
+}

+ 32 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SellOrderServiceImpl.java

@@ -85,6 +85,11 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
     @Autowired
     private MusicGroupShippingAddressService musicGroupShippingAddressService;
 
+    @Autowired
+    private SysAreaService sysAreaService;
+
+    @Autowired
+    private StudentPaymentOrderAddressService studentPaymentOrderAddressService;
     @Override
     public BaseDAO<Integer, SellOrder> getDAO() {
         return sellOrderDao;
@@ -658,6 +663,33 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
                 mallOrder.setReceiverRegion(address.getRegionCounty());
                 mallOrder.setReceiverDetailAddress(address.getDetailAddress());
             }
+        } else if(studentPaymentOrder.getType() == OrderTypeEnum.GOODS_SELL) {
+            StudentPaymentOrderAddress one = studentPaymentOrderAddressService.lambdaQuery()
+                .eq(StudentPaymentOrderAddress::getOrderNo, studentPaymentOrder.getOrderNo())
+                .last("limit 1")
+                .one();
+            if(one != null) {
+                // 查询地区信息
+                List<String> areaIds = new ArrayList<>();
+                areaIds.add(one.getProvinceId()==null?null:one.getProvinceId().toString());
+                areaIds.add(one.getCityId()==null?null:one.getCityId().toString());
+                areaIds.add(one.getCountyId()==null?null:one.getCountyId().toString());
+                areaIds = areaIds.stream().filter(StringUtils::isNotBlank).distinct().collect(Collectors.toList());
+                Map<String, String> nameMapByIds = sysAreaService.getNameMapByIds(areaIds);
+                mallOrder.setReceiverName(one.getContactName());
+                mallOrder.setReceiverPhone(one.getContactMobile());
+                if (one.getProvinceId() != null) {
+                    mallOrder.setReceiverProvince(nameMapByIds.getOrDefault(one.getProvinceId().toString(), ""));
+                }
+                if (one.getCityId() != null) {
+                    mallOrder.setReceiverCity(nameMapByIds.getOrDefault(one.getCityId().toString(), ""));
+                }
+                if (one.getCountyId() != null) {
+                    mallOrder.setReceiverRegion(nameMapByIds.getOrDefault(one.getCountyId().toString(), ""));
+                }
+                mallOrder.setReceiverDetailAddress(one.getAddress());
+
+            }
         }
 
         CommonResult<Boolean> result = mallFeignService.productOrderCreate(mallOrder);

+ 65 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderAddressServiceImpl.java

@@ -0,0 +1,65 @@
+package com.ym.mec.biz.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import lombok.extern.slf4j.Slf4j;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrderAddress;
+import com.ym.mec.biz.dal.wrapper.StudentPaymentOrderAddressWrapper;
+import com.ym.mec.biz.dal.mapper.StudentPaymentOrderAddressMapper;
+import com.ym.mec.biz.service.StudentPaymentOrderAddressService;
+
+/**
+ * 学生订单收货地址
+ * 2024-03-01 12:05:41
+ */
+@Slf4j
+@Service
+public class StudentPaymentOrderAddressServiceImpl extends ServiceImpl<StudentPaymentOrderAddressMapper, StudentPaymentOrderAddress> implements StudentPaymentOrderAddressService {
+
+	/**
+     * 查询详情
+     * @param id 详情ID
+     * @return StudentPaymentOrderAddress
+     */
+	@Override
+    public StudentPaymentOrderAddress detail(Long id) {
+        
+        return baseMapper.selectById(id);
+    }
+    
+    /**
+     * 分页查询
+     * @param page IPage<StudentPaymentOrderAddress>
+     * @param query StudentPaymentOrderAddressWrapper.StudentPaymentOrderAddressQuery
+     * @return IPage<StudentPaymentOrderAddress>
+     */
+    @Override
+    public IPage<StudentPaymentOrderAddress> selectPage(IPage<StudentPaymentOrderAddress> page, StudentPaymentOrderAddressWrapper.StudentPaymentOrderAddressQuery query) {
+        
+        return page.setRecords(baseMapper.selectPage(page, query));
+    }
+	
+    /**
+     * 添加
+     * @param studentPaymentOrderAddress StudentPaymentOrderAddressWrapper.StudentPaymentOrderAddress
+     * @return Boolean
+     */
+    @Override
+    public Boolean add(StudentPaymentOrderAddressWrapper.StudentPaymentOrderAddress studentPaymentOrderAddress) {    	
+        
+        return this.save(JSON.parseObject(studentPaymentOrderAddress.jsonString(), StudentPaymentOrderAddress.class));
+    }
+
+    /**
+     * 更新
+     * @param studentPaymentOrderAddress StudentPaymentOrderAddressWrapper.StudentPaymentOrderAddress
+     * @return Boolean
+     */
+    @Override
+    public Boolean update(StudentPaymentOrderAddressWrapper.StudentPaymentOrderAddress studentPaymentOrderAddress){
+
+        return this.updateById(JSON.parseObject(studentPaymentOrderAddress.jsonString(), StudentPaymentOrderAddress.class));       
+    }
+}

+ 15 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java

@@ -99,6 +99,9 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
     @Autowired
     private GoodsProcurementDao goodsProcurementDao;
 
+    @Autowired
+    private StudentPaymentOrderAddressService studentPaymentOrderAddressService;
+
     @Lazy
     @Autowired
     private ContractService contractService;
@@ -172,6 +175,14 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
     public Map addGoodsSellOrder(StudentGoodsSell studentGoodsSell) throws Exception {
         //关闭老订单
+        StudentPaymentOrderAddress studentPaymentOrderAddress = null;
+        if (StringUtils.isNotBlank(studentGoodsSell.getAddress())) {
+            studentPaymentOrderAddress = new StudentPaymentOrderAddress();
+            studentPaymentOrderAddress.setAddress(studentGoodsSell.getAddress());
+            studentPaymentOrderAddress.setContactMobile(studentGoodsSell.getContactMobile());
+            studentPaymentOrderAddress.setContactName(studentGoodsSell.getContactName());
+        }
+
         if (StringUtils.isNotEmpty(studentGoodsSell.getOrderNo())) {
             StudentPaymentOrder orderByOrderNo = studentPaymentOrderService.findOrderByOrderNo(studentGoodsSell.getOrderNo());
             if (orderByOrderNo.getBalancePaymentAmount() != null && orderByOrderNo.getBalancePaymentAmount().longValue() != 0l) {
@@ -336,6 +347,10 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         }
         studentGoodsSell.setTenantId(student.getTenantId());
         studentGoodsSellDao.insert(studentGoodsSell);
+        if (studentPaymentOrderAddress !=null) {
+            studentPaymentOrderAddress.setOrderNo(orderNo);
+            studentPaymentOrderAddressService.save(studentPaymentOrderAddress);
+        }
 
         if (studentGoodsSell.getType() == 1) {
             Map<String, Object> repairInfoMap = new HashMap<>();

+ 11 - 0
mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderAddressMapper.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE  mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.ym.mec.biz.dal.mapper.StudentPaymentOrderAddressMapper">
+    
+    <select id="selectPage" resultType="com.ym.mec.biz.dal.entity.StudentPaymentOrderAddress">
+		SELECT         
+        	t.*
+		FROM student_payment_order_address t
+	</select>
+    
+</mapper>