Browse Source

wx_profit_sharing_order添加分表

release_toaliyun_real
xiaohanzi 5 years ago
parent
commit
e961b6a4a7
7 changed files with 82 additions and 51 deletions
  1. +1
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxProfitSharingOrderController.java
  2. +52
    -40
      mallinkSchedule/src/main/java/com/iformall/schedule/SharingOrderRedoSchedule.java
  3. +17
    -2
      mallinkSchedule/src/main/java/com/iformall/schedule/SharingOrderRedoScheduletttttttttttttttttttttttttt.java
  4. +3
    -1
      mallinkService/src/main/java/com/iformall/mapper/WxProfitSharingOrderMapper.java
  5. +2
    -2
      mallinkService/src/main/java/com/iformall/service/WxProfitSharingOrderService.java
  6. +5
    -3
      mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingOrderServiceImpl.java
  7. +2
    -2
      mallinkService/src/main/resources/mapper/WxProfitSharingOrderMapper.xml

+ 1
- 1
mallinkAdmin/src/main/java/com/iformall/controller/market/WxProfitSharingOrderController.java View File

@@ -64,7 +64,7 @@ public class WxProfitSharingOrderController extends BaseController {
@SystemControllerLog(description = "分账订单-分账详情")
public ResultData findOrderDetails(Long id) {
logger.debug("[" + getIpAddr() + "] WxProfitSharingOrderController::findOrderDetails");
return wxProfitSharingOrderService.findOrderDetails(id);
return wxProfitSharingOrderService.findOrderDetails(id,getTenantInfo().getTenantId());
}




+ 52
- 40
mallinkSchedule/src/main/java/com/iformall/schedule/SharingOrderRedoSchedule.java View File

@@ -3,10 +3,12 @@ package com.iformall.schedule;
import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
import com.iformall.domain.dto.WxSharingOrderDto;
import com.iformall.domain.po.WxMall;
import com.iformall.domain.po.WxProfitSharingOrder;
import com.iformall.enums.EnumPayWay;
import com.iformall.enums.EnumProfitSharingOrderStatus;
import com.iformall.enums.EnumProfitSharingOrderType;
import com.iformall.mapper.WxMallMapper;
import com.iformall.mapper.WxPayOrderMapper;
import com.iformall.mapper.WxProfitSharingOrderMapper;
import com.iformall.service.WxProfitSharingOrderService;
@@ -30,49 +32,59 @@ public class SharingOrderRedoSchedule {
private WxProfitSharingOrderMapper wxProfitSharingOrderMapper;


@Autowired
WxMallMapper wxMallMapper;

private List<WxMall> getMalls() {
WxMall wxMall =new WxMall();
return wxMallMapper.findList(wxMall);
}
@Scheduled(cron = "0 0 2 * * ?") // 每天凌晨02:00分账重试
//@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次
public void sharingOrderResultSchedule() {

WxProfitSharingOrder wxProfitSharingOrder = new WxProfitSharingOrder();

wxProfitSharingOrder.setType(EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getCode());
wxProfitSharingOrder.setSharingStatus(EnumProfitSharingOrderStatus.PROFIT_SHARING_APPLY_FAILED.getCode());
List<WxProfitSharingOrder> list = wxProfitSharingOrderMapper.findList(wxProfitSharingOrder);
list.stream().forEach(sharingOrder->{
try {
ResultData result = wxProfitSharingOrderService.redoSharingOrder(sharingOrder);
if (result.code != ResultData.SUCCESS) {
logger.error("分账重试失败:" + EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getMessage()
+ " ID:" +sharingOrder.getId()
+ " RES:" + result.message);
}

} catch (Exception e){
logger.error("分账重试失败:" + EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getMessage()
+ " ID:" +sharingOrder.getId()
+ " MSG:" + e.getMessage());
}
});


wxProfitSharingOrder.setType(EnumProfitSharingOrderType.PROFIT_SHARING_MULTI.getCode());
wxProfitSharingOrder.setSharingStatus(EnumProfitSharingOrderStatus.PROFIT_SHARING_APPLY_FAILED.getCode());
list = wxProfitSharingOrderMapper.findList(wxProfitSharingOrder);
list.stream().forEach(sharingOrder->{
try {
ResultData result = wxProfitSharingOrderService.redoSharingOrder(sharingOrder);
if (result.code != ResultData.SUCCESS) {
logger.error("分账重试失败:" + EnumProfitSharingOrderType.PROFIT_SHARING_MULTI.getMessage()
+ " ID:" +sharingOrder.getId()
+ " RES:" + result.message);
}
} catch (Exception e){
logger.error("分账重试失败:" + EnumProfitSharingOrderType.PROFIT_SHARING_MULTI.getMessage()
+ " ID:" +sharingOrder.getId()
+ " MSG:" + e.getMessage());
}
});
List<WxMall> malls = getMalls();
for (WxMall mall: malls) {
WxProfitSharingOrder wxProfitSharingOrder = new WxProfitSharingOrder();
wxProfitSharingOrder.setTenantId(mall.getTenantId());
wxProfitSharingOrder.setType(EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getCode());
wxProfitSharingOrder.setSharingStatus(EnumProfitSharingOrderStatus.PROFIT_SHARING_APPLY_FAILED.getCode());
List<WxProfitSharingOrder> list = wxProfitSharingOrderMapper.findList(wxProfitSharingOrder);
list.stream().forEach(sharingOrder->{
try {
ResultData result = wxProfitSharingOrderService.redoSharingOrder(sharingOrder);
if (result.code != ResultData.SUCCESS) {
logger.error("分账重试失败:" + EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getMessage()
+ " ID:" +sharingOrder.getId()
+ " RES:" + result.message);
}
} catch (Exception e){
logger.error("分账重试失败:" + EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getMessage()
+ " ID:" +sharingOrder.getId()
+ " MSG:" + e.getMessage());
}
});
wxProfitSharingOrder.setType(EnumProfitSharingOrderType.PROFIT_SHARING_MULTI.getCode());
wxProfitSharingOrder.setSharingStatus(EnumProfitSharingOrderStatus.PROFIT_SHARING_APPLY_FAILED.getCode());
list = wxProfitSharingOrderMapper.findList(wxProfitSharingOrder);
list.stream().forEach(sharingOrder->{
try {
ResultData result = wxProfitSharingOrderService.redoSharingOrder(sharingOrder);
if (result.code != ResultData.SUCCESS) {
logger.error("分账重试失败:" + EnumProfitSharingOrderType.PROFIT_SHARING_MULTI.getMessage()
+ " ID:" +sharingOrder.getId()
+ " RES:" + result.message);
}
} catch (Exception e){
logger.error("分账重试失败:" + EnumProfitSharingOrderType.PROFIT_SHARING_MULTI.getMessage()
+ " ID:" +sharingOrder.getId()
+ " MSG:" + e.getMessage());
}
});
}

}
}

+ 17
- 2
mallinkSchedule/src/main/java/com/iformall/schedule/SharingOrderRedoScheduletttttttttttttttttttttttttt.java View File

@@ -3,10 +3,12 @@ package com.iformall.schedule;
import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
import com.iformall.domain.dto.WxSharingOrderDto;
import com.iformall.domain.po.WxMall;
import com.iformall.domain.po.WxProfitSharingOrder;
import com.iformall.enums.EnumPayWay;
import com.iformall.enums.EnumProfitSharingOrderStatus;
import com.iformall.enums.EnumProfitSharingOrderType;
import com.iformall.mapper.WxMallMapper;
import com.iformall.mapper.WxPayOrderMapper;
import com.iformall.mapper.WxProfitSharingOrderMapper;
import com.iformall.service.WxProfitSharingOrderService;
@@ -28,13 +30,26 @@ public class SharingOrderRedoScheduletttttttttttttttttttttttttt {

@Autowired
private WxProfitSharingOrderMapper wxProfitSharingOrderMapper;
@Autowired
WxMallMapper wxMallMapper;

private List<WxMall> getMalls() {
WxMall wxMall =new WxMall();
return wxMallMapper.findList(wxMall);
}

@Scheduled(cron = "0 5 0 * * ?") // 每天凌晨02:00分账重试
//@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次
public void sharingOrderResultSchedule() {

wxProfitSharingOrderService.updatetttttttttttttt();
List<WxMall> malls = getMalls();
for (WxMall mall: malls) {
try {
wxProfitSharingOrderService.updatetttttttttttttt(mall.getTenantId());
}catch(Exception e) {
logger.error("sharingOrderResultScheduletttttttt error",e);
}
}

}
}

+ 3
- 1
mallinkService/src/main/java/com/iformall/mapper/WxProfitSharingOrderMapper.java View File

@@ -9,6 +9,8 @@ import com.iformall.domain.vo.WxProfitSharingOrderVo;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

public interface WxProfitSharingOrderMapper extends CommonMapper<WxProfitSharingOrder, Long> {

List<WxProfitSharingOrder> findList(WxProfitSharingOrder wxProfitSharingOrder);
@@ -19,6 +21,6 @@ public interface WxProfitSharingOrderMapper extends CommonMapper<WxProfitSharing

Long queryOrderForMerchantCount(Map<String,Object> params);

List<WxProfitSharingOrderDetailsVo> findOrderDetails(Long id);
List<WxProfitSharingOrderDetailsVo> findOrderDetails(@Param("id")Long id,@Param("tenantId")String tenantId);

}

+ 2
- 2
mallinkService/src/main/java/com/iformall/service/WxProfitSharingOrderService.java View File

@@ -39,9 +39,9 @@ public interface WxProfitSharingOrderService {

Map<String,Object> queryOrderSummary(TenantEntity tenantEntity);

ResultData findOrderDetails(Long id);
ResultData findOrderDetails(Long id,String tenantId);
void updatetttttttttttttt();
void updatetttttttttttttt(String tenantId);

}

+ 5
- 3
mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingOrderServiceImpl.java View File

@@ -509,12 +509,13 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ
}

@Override
public ResultData findOrderDetails(Long id) {
public ResultData findOrderDetails(Long id,String tenantId) {
Map<String,Object> result=new HashMap<>(2);
WxProfitSharingOrderQueryVo wxProfitSharingOrderQueryVo = new WxProfitSharingOrderQueryVo();
wxProfitSharingOrderQueryVo.setId(id);
wxProfitSharingOrderQueryVo.setTenantId(tenantId);
WxProfitSharingOrderVo wxProfitSharingOrderVo = wxProfitSharingOrderMapper.findOrderList(wxProfitSharingOrderQueryVo).get(0);
List<WxProfitSharingOrderDetailsVo> orderDetails = wxProfitSharingOrderMapper.findOrderDetails(id);
List<WxProfitSharingOrderDetailsVo> orderDetails = wxProfitSharingOrderMapper.findOrderDetails(id,tenantId);
result.put("order",wxProfitSharingOrderVo);
result.put("details",orderDetails);
return new ResultData(result);
@@ -619,8 +620,9 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ
//更新以前分账用户绑定微信号的分账数据,微信已经停止了微信号分账
@Override
@Deprecated
public void updatetttttttttttttt() {
public void updatetttttttttttttt(String tenantId) {
WxProfitSharingOrder wxProfitSharingOrder = new WxProfitSharingOrder();
wxProfitSharingOrder.setTenantId(tenantId);
wxProfitSharingOrder.setType(EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getCode());
wxProfitSharingOrder.setSharingStatus(EnumProfitSharingOrderStatus.PROFIT_SHARING_APPLY_FAILED.getCode());
List<WxProfitSharingOrder> list = wxProfitSharingOrderMapper.findList(wxProfitSharingOrder);


+ 2
- 2
mallinkService/src/main/resources/mapper/WxProfitSharingOrderMapper.xml View File

@@ -219,11 +219,11 @@
</resultMap>
<select id="findOrderDetails" resultMap="orderDetailsMap">
<select id="findOrderDetails" parameterType="java.util.HashMap" resultMap="orderDetailsMap">
select psr.id,psr.tenant_id,psr.parent_tenant_id,psr.pay_amount,psr.create_time,sharing_status,finish_time,failed_reason,description,
psre.receiver_type,psre.receiver_account,psre.receiver_comments,psre.sharing_type,psre.`status`
from wx_profit_sharing_result psr left join wx_profit_sharing_receiver psre on psr.sharing_receiver_id=psre.id
where psr.sharing_order_id=#{value} and psr.sharing_receiver_id!=0
where psr.sharing_order_id=#{id} and psr.tenant_id=#{tenantId} and psr.sharing_receiver_id!=0
</select>

</mapper>

Loading…
Cancel
Save