Commit c21bad93 authored by liuyang's avatar liuyang

修改企业会员领取BUG

parent c9f41961
......@@ -63,19 +63,24 @@ public class OrgUserReceiveRecordService extends ServiceImpl<OrgUserReceiveRecor
po.setCourseId(model.getCourseId());
poList.add(po);
}
//保存领取记录
saveBatch(poList);
//同步减少企业剩余数量
validateAndSave(poList);
addUserCourseAuth(poList);
//更新用户vip或课程授权
updateUserAuth(poList);
}
/**
* 分配企业课程时,添加用户课程授权记录
* 更新用户vip或课程授权
* @param poList
*/
private void addUserCourseAuth(List<OrgUserReceiveRecordPO> poList) {
private void updateUserAuth(List<OrgUserReceiveRecordPO> poList) {
for (OrgUserReceiveRecordPO po : poList){
if (po.getProductType() == ProductTypeEnum.ENTERPRISE_COURSE_BUY){
userCourseAuthService.updateAuth(po.getUserId(),po.getCourseId(), LocalDateTime.now());
}else if (po.getProductType() == ProductTypeEnum.ENTERPRISE_VIP){
sysUserService.updateVIPTimeLimit(po.getUserId(),po.getCreateTime(),po.getCount());
}
}
}
......
......@@ -255,6 +255,10 @@ public class SysUserService extends BaseServiceImpl<SysUserMapper, SysUserPO> {
orgUserReceiveRecordPO.setCount(1);
orgUserReceiveRecordPO.setProductType(ProductTypeEnum.ENTERPRISE_VIP);
orgUserReceiveRecordService.validateAndSave(Lists.newArrayList(orgUserReceiveRecordPO));
//更新用户vip时间
LocalDateTime startTime = orgUserReceiveRecordPO.getCreateTime();//领取时间,即生效时间
int month = orgUserReceiveRecordPO.getCount();//领取几个月的会员
updateVIPTimeLimit(userInfo.getId(),startTime,month);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment