|
@@ -3,9 +3,12 @@ package com.fdkankan.manage.controller;
|
|
|
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import com.fdkankan.manage.common.ResultCode;
|
|
|
+import com.fdkankan.manage.entity.IncrementType;
|
|
|
+import com.fdkankan.manage.entity.User;
|
|
|
import com.fdkankan.manage.exception.BusinessException;
|
|
|
import com.fdkankan.common.response.ResultData;
|
|
|
import com.fdkankan.manage.service.ICameraService;
|
|
|
+import com.fdkankan.manage.service.IIncrementTypeService;
|
|
|
import com.fdkankan.manage.service.IUserIncrementService;
|
|
|
import com.fdkankan.manage.service.IUserService;
|
|
|
import com.fdkankan.manage.vo.request.CameraParam;
|
|
@@ -27,6 +30,8 @@ public class UserController {
|
|
|
@Autowired
|
|
|
IUserIncrementService userIncrementService;
|
|
|
@Autowired
|
|
|
+ IIncrementTypeService incrementTypeService;
|
|
|
+ @Autowired
|
|
|
ICameraService cameraService;
|
|
|
|
|
|
/**
|
|
@@ -78,6 +83,15 @@ public class UserController {
|
|
|
throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
}
|
|
|
userIncrementService.add(param);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ user.setDownloadNumTotal(user.getDownloadNumTotal() + incrementType.getDownloadNum());
|
|
|
return ResultData.ok();
|
|
|
}
|
|
|
|