|
@@ -93,6 +93,10 @@ public class UserIncrementServiceImpl extends ServiceImpl<IUserIncrementMapper,
|
|
|
vo.setSnCode(camera.getSnCode());
|
|
|
}
|
|
|
}
|
|
|
+ if(record.getIncrementTypeId()!= null){
|
|
|
+ IncrementType incrementType = incrementTypeService.getById(record.getIncrementTypeId());
|
|
|
+ vo.setValidTimeType(incrementType.getValidTimeType());
|
|
|
+ }
|
|
|
voList.add(vo);
|
|
|
}
|
|
|
Page<UserIncrementVo> voPage = new Page<>(pageNum, pageSize);
|
|
@@ -107,18 +111,32 @@ public class UserIncrementServiceImpl extends ServiceImpl<IUserIncrementMapper,
|
|
|
if(userIncrement == null){
|
|
|
throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
}
|
|
|
+ IncrementType incrementType = incrementTypeService.getById(userIncrement.getIncrementTypeId());
|
|
|
+
|
|
|
userIncrement.setIsExpired(0);
|
|
|
Date date = DateUtil.string2Date(userIncrement.getIncrementEndTime(), DateUtil.DEFAULT_DATE_FORMAT);
|
|
|
- Date delay = DateUtil.delay(date, 1, 1);
|
|
|
+ Date delay = null;
|
|
|
+ switch (incrementType.getValidTimeType()){
|
|
|
+ case 0 : delay = DateUtil.delay(date, 1, 1); break;
|
|
|
+ case 1 : delay = DateUtil.delay(date, 1, 2); break;
|
|
|
+ case 2 : delay = DateUtil.delay(date, 1, 5); break;
|
|
|
+ default: throw new BusinessException(ResultCode.INCREMENT_TYPE_ERROR);
|
|
|
+ }
|
|
|
+
|
|
|
userIncrement.setIncrementEndTime(DateUtil.date2String(delay,DateUtil.DEFAULT_DATE_FORMAT));
|
|
|
userIncrement.setUpdateTime(null);
|
|
|
this.updateById(userIncrement);
|
|
|
agentNewLogService.addByUserIncrement(userIncrement);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
public void add(UserIncrementParam param) {
|
|
|
List<UserIncrement> userIncrementList = new ArrayList<>();
|
|
|
+ IncrementType incrementType = incrementTypeService.getById(param.getIncrementTypeId());
|
|
|
+ if(incrementType == null){
|
|
|
+ throw new BusinessException(ResultCode.INCREMENT_TYPE_EMPTY);
|
|
|
+ }
|
|
|
for (int i = 0 ; i<param.getCount() ;i++) {
|
|
|
UserIncrement userIncrement = new UserIncrement();
|
|
|
String date = DateUtil.date2String(new Date(), DateUtil.DEFAULT_DATE_FORMAT);
|
|
@@ -130,15 +148,20 @@ public class UserIncrementServiceImpl extends ServiceImpl<IUserIncrementMapper,
|
|
|
userIncrement.setIncrementStartTime(date);
|
|
|
userIncrement.setIncrementEndTime(param.getIncrementEndTime());
|
|
|
userIncrement.setIncrementTypeId(param.getIncrementTypeId());
|
|
|
+ if(incrementType.getValidTimeType() == 0){
|
|
|
+ userIncrement.setMemberLevels("PR");
|
|
|
+ }
|
|
|
+ if(incrementType.getValidTimeType() == 1){
|
|
|
+ userIncrement.setMemberLevels("SE");
|
|
|
+ }
|
|
|
+ if(param.getMonthQy() != null){
|
|
|
+ userIncrement.setMonthQy(param.getMonthQy());
|
|
|
+ }
|
|
|
userIncrementList.add(userIncrement);
|
|
|
}
|
|
|
|
|
|
if(userIncrementList.size() >0){
|
|
|
this.saveBatch(userIncrementList);
|
|
|
- IncrementType incrementType = incrementTypeService.getById(param.getIncrementTypeId());
|
|
|
- if(incrementType == null){
|
|
|
- throw new BusinessException(ResultCode.INCREMENT_TYPE_EMPTY);
|
|
|
- }
|
|
|
User user = userService.getById(param.getUserId());
|
|
|
if(user == null){
|
|
|
throw new BusinessException(ResultCode.USER_NOT_EXIST);
|