|
@@ -12,6 +12,7 @@ import cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenanceR
|
|
|
import cn.com.ty.lift.business.maintenance.dao.entity.model.response.MaintenanceAppResponse;
|
|
|
import cn.com.ty.lift.business.maintenance.dao.mapper.MaintenancePlanMapper;
|
|
|
import cn.com.ty.lift.business.maintenance.dao.mapper.MaintenanceRecordMapper;
|
|
|
+import cn.com.ty.lift.business.maintenance.service.MaintenanceService;
|
|
|
import cn.com.ty.lift.business.project.dao.entity.Project;
|
|
|
import cn.com.ty.lift.business.project.dao.entity.ProjectLiftRelevance;
|
|
|
import cn.com.ty.lift.business.project.dao.entity.model.ProjectAppUser;
|
|
@@ -53,6 +54,9 @@ public class ProjectAppService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
@Resource
|
|
|
private LiftService liftService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private ProjectService projectService;
|
|
|
+
|
|
|
@Resource
|
|
|
private ProjectUserMapper projectUserMapper;
|
|
|
|
|
@@ -71,6 +75,9 @@ public class ProjectAppService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
@Resource
|
|
|
private ProjectLiftRelevanceService projectLiftRelevanceService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private MaintenanceService maintenanceService;
|
|
|
+
|
|
|
@Resource
|
|
|
private RedisTemplate redisTemplate;
|
|
|
|
|
@@ -122,6 +129,22 @@ public class ProjectAppService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
}
|
|
|
Long liftId = lift.getId();
|
|
|
Long mtCompanyId = request.getMtCompanyId();
|
|
|
+ Long projectId = request.getProjectId();
|
|
|
+ Optional<Project> optional = projectService.getOne(projectId);
|
|
|
+ int num = 0;
|
|
|
+ if (optional.isPresent()) {
|
|
|
+ Project project = optional.get();
|
|
|
+ num = project.getNum();
|
|
|
+ }
|
|
|
+ //判断当前项目下实际台量是否大于项目里设置的台量
|
|
|
+ int currentNum = projectLiftRelevanceService.countLiftNum(mtCompanyId, projectId);
|
|
|
+ if (currentNum >= num) {
|
|
|
+ return RestResponse.fail(MessageUtils.get("msg.project.limit.num"));
|
|
|
+ }
|
|
|
+ //判断当前公司台量是否大于企业设置的台量
|
|
|
+ if (maintenanceService.judge(mtCompanyId))
|
|
|
+ return RestResponse.fail(MessageUtils.get("msg.limit.num"));
|
|
|
+
|
|
|
PlatformCompanyLiftRelevance companyLiftEntry = liftService.saveCompanyLiftInfo(liftId, mtCompanyId);
|
|
|
if (Objects.isNull(companyLiftEntry)) {
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|