| @@ -114,15 +114,24 @@ public class VideoSchedule { | |||||
| if (StringUtils.isBlank(video.getVideoTime())) { | if (StringUtils.isBlank(video.getVideoTime())) { | ||||
| break; | break; | ||||
| } | } | ||||
| CreateBilling cb = null; | |||||
| if (null == video.getCostPoints() || video.getCostPoints() <= 0) { | if (null == video.getCostPoints() || video.getCostPoints() <= 0) { | ||||
| CreateBilling cb = projectFactory.getProjectService(EnumProject.PROJECT_2.getCode()) | |||||
| cb = projectFactory.getProjectService(EnumProject.PROJECT_2.getCode()) | |||||
| .handleCreateVideoBilling(video.getUserId(), video.getFinalTenantId(), video.getVideoTime(), video.getVideoSize()); | .handleCreateVideoBilling(video.getUserId(), video.getFinalTenantId(), video.getVideoTime(), video.getVideoSize()); | ||||
| if (null != cb) { | if (null != cb) { | ||||
| video.setCostPoints(cb.getTotalCostPoins()); | video.setCostPoints(cb.getTotalCostPoins()); | ||||
| video.setCostPointsDetail(cb.getDetail()); | video.setCostPointsDetail(cb.getDetail()); | ||||
| } | } | ||||
| } | } | ||||
| userMouldVideoService.updateById(video); | |||||
| try { | |||||
| userMouldVideoService.updateById(video); | |||||
| }catch(Exception e1) { | |||||
| logger.error("TtCouponVideoSchedule error.couponVideoSchedule:"+video.getId(),e1); | |||||
| if (null != cb ) { | |||||
| projectFactory.getProjectService(EnumProject.PROJECT_2.getCode()). | |||||
| rollbackCreateVideoBilling(video.getUserId(), video.getFinalTenantId(), cb); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("TtCouponVideoSchedule error.couponVideoSchedule:"+video.getId(),e); | logger.error("TtCouponVideoSchedule error.couponVideoSchedule:"+video.getId(),e); | ||||
| @@ -23,6 +23,7 @@ public interface ProjectService { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| public CreateBilling handleCreateVideoBilling(Long cUserId,String cUserFinalTenantId,String videoTimes,Long videoSize); | public CreateBilling handleCreateVideoBilling(Long cUserId,String cUserFinalTenantId,String videoTimes,Long videoSize); | ||||
| public void rollbackCreateVideoBilling(Long cUserId,String cUserFinalTenantId,CreateBilling billing); | |||||
| /** | /** | ||||
| * 处理用户注册后事项 | * 处理用户注册后事项 | ||||
| @@ -27,6 +27,12 @@ public class CommonProjectService extends BaseProjectService implements ProjectS | |||||
| // TODO Auto-generated method stub | // TODO Auto-generated method stub | ||||
| return null; | return null; | ||||
| } | } | ||||
| @Override | |||||
| public void rollbackCreateVideoBilling(Long cUserId,String cUserFinalTenantId,CreateBilling billing) { | |||||
| // TODO Auto-generated method stub | |||||
| } | |||||
| @Override | @Override | ||||
| public void handleAfterRegeister(WxCUserBasicInfo cUser) { | public void handleAfterRegeister(WxCUserBasicInfo cUser) { | ||||
| @@ -36,4 +42,6 @@ public class CommonProjectService extends BaseProjectService implements ProjectS | |||||
| } | } | ||||
| @@ -27,6 +27,12 @@ public class HBProjectService extends BaseProjectService implements ProjectServi | |||||
| return null; | return null; | ||||
| } | } | ||||
| @Override | |||||
| public void rollbackCreateVideoBilling(Long cUserId,String cUserFinalTenantId,CreateBilling billing) { | |||||
| // TODO Auto-generated method stub | |||||
| } | |||||
| @Override | @Override | ||||
| public void handleAfterRegeister(WxCUserBasicInfo cUser) { | public void handleAfterRegeister(WxCUserBasicInfo cUser) { | ||||
| // TODO Auto-generated method stub | // TODO Auto-generated method stub | ||||
| @@ -35,4 +41,6 @@ public class HBProjectService extends BaseProjectService implements ProjectServi | |||||
| } | } | ||||
| @@ -27,6 +27,12 @@ public class HKProjectService extends BaseProjectService implements ProjectServi | |||||
| // TODO Auto-generated method stub | // TODO Auto-generated method stub | ||||
| return null; | return null; | ||||
| } | } | ||||
| @Override | |||||
| public void rollbackCreateVideoBilling(Long cUserId,String cUserFinalTenantId,CreateBilling billing) { | |||||
| // TODO Auto-generated method stub | |||||
| } | |||||
| @Override | @Override | ||||
| public void handleAfterRegeister(WxCUserBasicInfo cUser) { | public void handleAfterRegeister(WxCUserBasicInfo cUser) { | ||||
| @@ -36,4 +42,6 @@ public class HKProjectService extends BaseProjectService implements ProjectServi | |||||
| } | } | ||||
| @@ -50,8 +50,15 @@ public class HYProjectService extends BaseProjectService implements ProjectServi | |||||
| return cb; | return cb; | ||||
| } | } | ||||
| @Override | |||||
| public void rollbackCreateVideoBilling(Long cUserId,String cUserFinalTenantId,CreateBilling cb) { | |||||
| wxCUserBasicInfoService.addPoints(cUserId, cUserFinalTenantId,cb.getTotalCostPoins()); | |||||
| } | |||||
| @Override | @Override | ||||
| public void handleAfterRegeister(WxCUserBasicInfo cUser) { | public void handleAfterRegeister(WxCUserBasicInfo cUser) { | ||||
| wxCUserBasicInfoService.addPoints(cUser.getId(), cUser.getFinalTenantId(),Constant.hyRegeisterPoins); | wxCUserBasicInfoService.addPoints(cUser.getId(), cUser.getFinalTenantId(),Constant.hyRegeisterPoins); | ||||
| } | } | ||||
| } | } | ||||
| @@ -27,6 +27,12 @@ public class HYuProjectService extends BaseProjectService implements ProjectServ | |||||
| // TODO Auto-generated method stub | // TODO Auto-generated method stub | ||||
| return null; | return null; | ||||
| } | } | ||||
| @Override | |||||
| public void rollbackCreateVideoBilling(Long cUserId,String cUserFinalTenantId,CreateBilling billing) { | |||||
| // TODO Auto-generated method stub | |||||
| } | |||||
| @Override | @Override | ||||
| public void handleAfterRegeister(WxCUserBasicInfo cUser) { | public void handleAfterRegeister(WxCUserBasicInfo cUser) { | ||||
| @@ -36,4 +42,6 @@ public class HYuProjectService extends BaseProjectService implements ProjectServ | |||||
| } | } | ||||
| @@ -27,6 +27,12 @@ public class ZXProjectService extends BaseProjectService implements ProjectServi | |||||
| // TODO Auto-generated method stub | // TODO Auto-generated method stub | ||||
| return null; | return null; | ||||
| } | } | ||||
| @Override | |||||
| public void rollbackCreateVideoBilling(Long cUserId,String cUserFinalTenantId,CreateBilling billing) { | |||||
| // TODO Auto-generated method stub | |||||
| } | |||||
| @Override | @Override | ||||
| public void handleAfterRegeister(WxCUserBasicInfo cUser) { | public void handleAfterRegeister(WxCUserBasicInfo cUser) { | ||||
| @@ -34,6 +40,4 @@ public class ZXProjectService extends BaseProjectService implements ProjectServi | |||||
| } | } | ||||
| } | } | ||||
| @@ -517,22 +517,28 @@ public class UserMouldVideoServiceImpl implements UserMouldVideoService { | |||||
| videoUpd.setVideoStatus(EnumVideoStatus.upload_success.getCode()); | videoUpd.setVideoStatus(EnumVideoStatus.upload_success.getCode()); | ||||
| videoUpd.setVideoMsg("视频上传成功"); | videoUpd.setVideoMsg("视频上传成功"); | ||||
| videoUpd.setUpdateDate(new Date()); | videoUpd.setUpdateDate(new Date()); | ||||
| logger.debug(" >>>>>>>>>>>>>> finisedAndCost:"+finisedAndCost); | |||||
| CreateBilling cb = null; | |||||
| if (finisedAndCost && (null == mouldVideo.getCostPoints() || mouldVideo.getCostPoints() <= 0)) { | if (finisedAndCost && (null == mouldVideo.getCostPoints() || mouldVideo.getCostPoints() <= 0)) { | ||||
| //设置扣费,当前方法是慧影项目专用的 | //设置扣费,当前方法是慧影项目专用的 | ||||
| if (StringUtils.isBlank(videoUpd.getVideoTime())) { | if (StringUtils.isBlank(videoUpd.getVideoTime())) { | ||||
| logger.debug(" >>>>>>>>>>>>>> videoUpd no time:"+videoUpd.getVideoTime()); | |||||
| break; | break; | ||||
| } | } | ||||
| CreateBilling cb = projectFactory.getProjectService(EnumProject.PROJECT_2.getCode()) | |||||
| cb = projectFactory.getProjectService(EnumProject.PROJECT_2.getCode()) | |||||
| .handleCreateVideoBilling(userMouldVideo.getUserId(), userMouldVideo.getFinalTenantId(), videoUpd.getVideoTime(), videoUpd.getVideoSize()); | .handleCreateVideoBilling(userMouldVideo.getUserId(), userMouldVideo.getFinalTenantId(), videoUpd.getVideoTime(), videoUpd.getVideoSize()); | ||||
| logger.info(">>>>>>>>>> CreateBilling :"+JSON.toJSONString(cb)); | |||||
| if (null != cb) { | if (null != cb) { | ||||
| videoUpd.setCostPoints(cb.getTotalCostPoins()); | videoUpd.setCostPoints(cb.getTotalCostPoins()); | ||||
| videoUpd.setCostPointsDetail(cb.getDetail()); | videoUpd.setCostPointsDetail(cb.getDetail()); | ||||
| } | } | ||||
| } | } | ||||
| this.updateById(videoUpd); | |||||
| try { | |||||
| this.updateById(videoUpd); | |||||
| }catch(Exception e) { | |||||
| logger.error("uploadVideo updateById error.",e); | |||||
| if (null != cb) { | |||||
| projectFactory.getProjectService(EnumProject.PROJECT_2.getCode()). | |||||
| rollbackCreateVideoBilling(userMouldVideo.getUserId(), userMouldVideo.getFinalTenantId(), cb); | |||||
| } | |||||
| } | |||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| @@ -541,7 +547,7 @@ public class UserMouldVideoServiceImpl implements UserMouldVideoService { | |||||
| } | } | ||||
| }catch(Exception e){ | }catch(Exception e){ | ||||
| logger.error("uploadVideo error.",e); | |||||
| }finally{ | }finally{ | ||||
| redisLock.unlock(lockKey, timeStr); | redisLock.unlock(lockKey, timeStr); | ||||
| } | } | ||||