yonge 2 năm trước cách đây
mục cha
commit
5b653b2cbf

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TenantOrderRecordDao.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ym.mec.biz.dal.dto.TenantOrderRecordDto;
 import com.ym.mec.biz.dal.entity.TenantOrderRecord;
+
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -21,6 +22,8 @@ public interface TenantOrderRecordDao extends BaseMapper<TenantOrderRecord> {
     int insertBatch(@Param("entities") List<TenantOrderRecord> entities);
 
     <T> IPage<T> queryPage(Page<T> page, @Param("param") TenantOrderRecordDto dto);
+    
+    TenantOrderRecord getLockedById(Integer id);
 
 }
 

+ 1 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java

@@ -356,6 +356,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     public void updateOrder(Map<String, String> rpMap) throws Exception {
         DealStatusEnum status = rpMap.get("tradeState").equals("1") ? DealStatusEnum.SUCCESS : DealStatusEnum.FAILED;
         StudentPaymentOrder order = findOrderByOrderNo(rpMap.get("merOrderNo"));
+        order = studentPaymentOrderDao.lockOrder(order.getId());
         //关闭或失败的订单查询订单成功,订单改成成功,钱退到余额
         if (order != null && (order.getStatus().equals(DealStatusEnum.CLOSE) || order.getStatus().equals(DealStatusEnum.FAILED)) && status.equals(DealStatusEnum.SUCCESS)) {
             String memo = order.getStatus().equals(DealStatusEnum.CLOSE) ? "关闭订单" : "失败订单";

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantInfoServiceImpl.java

@@ -1109,10 +1109,10 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
 
     @Override
     public Map<String, Object> recharge(Integer tenantId, BigDecimal amount) throws Exception {
-        SysConfig config = sysConfigService.findByParamName("platform_collection_organ");
+        /*SysConfig config = sysConfigService.findByParamName("platform_collection_organ");
         if (Objects.isNull(config)) {
             throw new BizException("未查询到机构收款分部信息!");
-        }
+        }*/
         log.error("机构 " + tenantId.toString() + "充值");
         Optional.of(tenantId)
                 .map(baseMapper::selectById)

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantOrderRecordServiceImpl.java

@@ -106,6 +106,9 @@ public class TenantOrderRecordServiceImpl extends ServiceImpl<TenantOrderRecordD
 
     @Autowired
     private HfMerchantConfigService hfMerchantConfigService;
+    
+    @Autowired
+    private TenantOrderRecordDao tenantOrderRecordDao;
 
     //订单不存在
     private static final String PAYMENT_ID_NOT_EXISTS = "payment_id_not_exists";
@@ -459,6 +462,7 @@ public class TenantOrderRecordServiceImpl extends ServiceImpl<TenantOrderRecordD
                     log.error("error tenant callback request orderNo is null param:{}", data);
                     return "failed";
                 }
+                record = tenantOrderRecordDao.getLockedById(record.getId());
                 //只处理未支付状态的订单
                 if(!record.getOrderState().equals(0)){
                     return "succeeded";

+ 4 - 0
mec-biz/src/main/resources/config/mybatis/TenantOrderRecordMapper.xml

@@ -22,6 +22,10 @@
         id_
         , tenant_id_, order_no_, trans_no_, order_type_, payment_channel_, pay_channel_, expect_amount, actual_amount, mer_nos_, order_state_, pay_date_, pay_time_, created_time_
     </sql>
+    
+    <select id="getLockedById" resultMap="BaseResultMap">
+    	select * from tenant_order_record where id_ = #{id} for update
+    </select>
 
     <insert id="insertBatch" keyColumn="id_" keyProperty="id" useGeneratedKeys="true"
             parameterType="com.ym.mec.biz.dal.entity.TenantOrderRecord">