| @@ -64,7 +64,7 @@ public class WxProfitSharingOrderController extends BaseController { | |||||
| @SystemControllerLog(description = "分账订单-分账详情") | @SystemControllerLog(description = "分账订单-分账详情") | ||||
| public ResultData findOrderDetails(Long id) { | public ResultData findOrderDetails(Long id) { | ||||
| logger.debug("[" + getIpAddr() + "] WxProfitSharingOrderController::findOrderDetails"); | logger.debug("[" + getIpAddr() + "] WxProfitSharingOrderController::findOrderDetails"); | ||||
| return wxProfitSharingOrderService.findOrderDetails(id); | |||||
| return wxProfitSharingOrderService.findOrderDetails(id,getTenantInfo().getTenantId()); | |||||
| } | } | ||||
| @@ -3,10 +3,12 @@ package com.iformall.schedule; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.dto.WxSharingOrderDto; | import com.iformall.domain.dto.WxSharingOrderDto; | ||||
| import com.iformall.domain.po.WxMall; | |||||
| import com.iformall.domain.po.WxProfitSharingOrder; | import com.iformall.domain.po.WxProfitSharingOrder; | ||||
| import com.iformall.enums.EnumPayWay; | import com.iformall.enums.EnumPayWay; | ||||
| import com.iformall.enums.EnumProfitSharingOrderStatus; | import com.iformall.enums.EnumProfitSharingOrderStatus; | ||||
| import com.iformall.enums.EnumProfitSharingOrderType; | import com.iformall.enums.EnumProfitSharingOrderType; | ||||
| import com.iformall.mapper.WxMallMapper; | |||||
| import com.iformall.mapper.WxPayOrderMapper; | import com.iformall.mapper.WxPayOrderMapper; | ||||
| import com.iformall.mapper.WxProfitSharingOrderMapper; | import com.iformall.mapper.WxProfitSharingOrderMapper; | ||||
| import com.iformall.service.WxProfitSharingOrderService; | import com.iformall.service.WxProfitSharingOrderService; | ||||
| @@ -30,49 +32,59 @@ public class SharingOrderRedoSchedule { | |||||
| private WxProfitSharingOrderMapper wxProfitSharingOrderMapper; | 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 = "0 0 2 * * ?") // 每天凌晨02:00分账重试 | ||||
| //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | ||||
| public void sharingOrderResultSchedule() { | 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()); | |||||
| } | |||||
| }); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -3,10 +3,12 @@ package com.iformall.schedule; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.dto.WxSharingOrderDto; | import com.iformall.domain.dto.WxSharingOrderDto; | ||||
| import com.iformall.domain.po.WxMall; | |||||
| import com.iformall.domain.po.WxProfitSharingOrder; | import com.iformall.domain.po.WxProfitSharingOrder; | ||||
| import com.iformall.enums.EnumPayWay; | import com.iformall.enums.EnumPayWay; | ||||
| import com.iformall.enums.EnumProfitSharingOrderStatus; | import com.iformall.enums.EnumProfitSharingOrderStatus; | ||||
| import com.iformall.enums.EnumProfitSharingOrderType; | import com.iformall.enums.EnumProfitSharingOrderType; | ||||
| import com.iformall.mapper.WxMallMapper; | |||||
| import com.iformall.mapper.WxPayOrderMapper; | import com.iformall.mapper.WxPayOrderMapper; | ||||
| import com.iformall.mapper.WxProfitSharingOrderMapper; | import com.iformall.mapper.WxProfitSharingOrderMapper; | ||||
| import com.iformall.service.WxProfitSharingOrderService; | import com.iformall.service.WxProfitSharingOrderService; | ||||
| @@ -28,13 +30,26 @@ public class SharingOrderRedoScheduletttttttttttttttttttttttttt { | |||||
| @Autowired | @Autowired | ||||
| private WxProfitSharingOrderMapper wxProfitSharingOrderMapper; | 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 = "0 5 0 * * ?") // 每天凌晨02:00分账重试 | ||||
| //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | ||||
| public void sharingOrderResultSchedule() { | 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); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -9,6 +9,8 @@ import com.iformall.domain.vo.WxProfitSharingOrderVo; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| import org.apache.ibatis.annotations.Param; | |||||
| public interface WxProfitSharingOrderMapper extends CommonMapper<WxProfitSharingOrder, Long> { | public interface WxProfitSharingOrderMapper extends CommonMapper<WxProfitSharingOrder, Long> { | ||||
| List<WxProfitSharingOrder> findList(WxProfitSharingOrder wxProfitSharingOrder); | List<WxProfitSharingOrder> findList(WxProfitSharingOrder wxProfitSharingOrder); | ||||
| @@ -19,6 +21,6 @@ public interface WxProfitSharingOrderMapper extends CommonMapper<WxProfitSharing | |||||
| Long queryOrderForMerchantCount(Map<String,Object> params); | Long queryOrderForMerchantCount(Map<String,Object> params); | ||||
| List<WxProfitSharingOrderDetailsVo> findOrderDetails(Long id); | |||||
| List<WxProfitSharingOrderDetailsVo> findOrderDetails(@Param("id")Long id,@Param("tenantId")String tenantId); | |||||
| } | } | ||||
| @@ -39,9 +39,9 @@ public interface WxProfitSharingOrderService { | |||||
| Map<String,Object> queryOrderSummary(TenantEntity tenantEntity); | Map<String,Object> queryOrderSummary(TenantEntity tenantEntity); | ||||
| ResultData findOrderDetails(Long id); | |||||
| ResultData findOrderDetails(Long id,String tenantId); | |||||
| void updatetttttttttttttt(); | |||||
| void updatetttttttttttttt(String tenantId); | |||||
| } | } | ||||
| @@ -509,12 +509,13 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData findOrderDetails(Long id) { | |||||
| public ResultData findOrderDetails(Long id,String tenantId) { | |||||
| Map<String,Object> result=new HashMap<>(2); | Map<String,Object> result=new HashMap<>(2); | ||||
| WxProfitSharingOrderQueryVo wxProfitSharingOrderQueryVo = new WxProfitSharingOrderQueryVo(); | WxProfitSharingOrderQueryVo wxProfitSharingOrderQueryVo = new WxProfitSharingOrderQueryVo(); | ||||
| wxProfitSharingOrderQueryVo.setId(id); | wxProfitSharingOrderQueryVo.setId(id); | ||||
| wxProfitSharingOrderQueryVo.setTenantId(tenantId); | |||||
| WxProfitSharingOrderVo wxProfitSharingOrderVo = wxProfitSharingOrderMapper.findOrderList(wxProfitSharingOrderQueryVo).get(0); | 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("order",wxProfitSharingOrderVo); | ||||
| result.put("details",orderDetails); | result.put("details",orderDetails); | ||||
| return new ResultData(result); | return new ResultData(result); | ||||
| @@ -619,8 +620,9 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||||
| //更新以前分账用户绑定微信号的分账数据,微信已经停止了微信号分账 | //更新以前分账用户绑定微信号的分账数据,微信已经停止了微信号分账 | ||||
| @Override | @Override | ||||
| @Deprecated | @Deprecated | ||||
| public void updatetttttttttttttt() { | |||||
| public void updatetttttttttttttt(String tenantId) { | |||||
| WxProfitSharingOrder wxProfitSharingOrder = new WxProfitSharingOrder(); | WxProfitSharingOrder wxProfitSharingOrder = new WxProfitSharingOrder(); | ||||
| wxProfitSharingOrder.setTenantId(tenantId); | |||||
| wxProfitSharingOrder.setType(EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getCode()); | wxProfitSharingOrder.setType(EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getCode()); | ||||
| wxProfitSharingOrder.setSharingStatus(EnumProfitSharingOrderStatus.PROFIT_SHARING_APPLY_FAILED.getCode()); | wxProfitSharingOrder.setSharingStatus(EnumProfitSharingOrderStatus.PROFIT_SHARING_APPLY_FAILED.getCode()); | ||||
| List<WxProfitSharingOrder> list = wxProfitSharingOrderMapper.findList(wxProfitSharingOrder); | List<WxProfitSharingOrder> list = wxProfitSharingOrderMapper.findList(wxProfitSharingOrder); | ||||
| @@ -219,11 +219,11 @@ | |||||
| </resultMap> | </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, | 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` | 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 | 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> | </select> | ||||
| </mapper> | </mapper> | ||||