|
@@ -6,7 +6,10 @@ import cn.com.ty.lift.business.library.dao.entity.PlatformCompanyLiftRelevance;
|
|
|
import cn.com.ty.lift.business.library.dao.entity.model.SelectBatchPlatformCompanyRequest;
|
|
|
import cn.com.ty.lift.business.library.dao.entity.model.UpdateBatchPlatformCompanyRequest;
|
|
|
import cn.com.ty.lift.business.library.dao.mapper.PlatformCompanyLiftRelevanceMapper;
|
|
|
+import cn.com.ty.lift.business.project.dao.entity.Project;
|
|
|
+import cn.com.ty.lift.business.project.dao.mapper.ProjectMapper;
|
|
|
import cn.com.ty.lift.common.constants.ApiConstants;
|
|
|
+import cn.com.ty.lift.common.constants.CommonEnum;
|
|
|
import cn.com.xwy.boot.web.dto.RestResponse;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -25,6 +28,9 @@ public class PlatformCompanyLiftRelevanceService extends ServiceImpl<PlatformCom
|
|
|
@Resource
|
|
|
private PlatformCompanyLiftRelevanceMapper mapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private ProjectMapper projectMapper;
|
|
|
+
|
|
|
/**
|
|
|
* @param extension
|
|
|
* @return PlatformCompanyLiftRelevance
|
|
@@ -55,6 +61,47 @@ public class PlatformCompanyLiftRelevanceService extends ServiceImpl<PlatformCom
|
|
|
return RestResponse.ok(list, ApiConstants.RESULT_SUCCESS, "msg.query.success");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @param request liftIdList 电梯id列表
|
|
|
+ * @return 1.成功, 0.失败, 消息描述
|
|
|
+ * @description 服务操作
|
|
|
+ * @date 2019/12/10 5:42 PM
|
|
|
+ */
|
|
|
+ public RestResponse serviceOperate(SelectBatchPlatformCompanyRequest request) {
|
|
|
+ String operate = request.getOperate();
|
|
|
+ switch (operate) {
|
|
|
+ //恢复服务
|
|
|
+ case "1":
|
|
|
+ break;
|
|
|
+ //停止服务
|
|
|
+ case "2":
|
|
|
+ //TODO 检查电梯是否有进行中的任务,并提醒,清除维保计划等任务
|
|
|
+ List<PlatformCompanyLiftRelevance> resultList = mapper.selectBatchIds(request.getLiftIdList());
|
|
|
+ //项目下非停保状态的电梯状态修改为正常
|
|
|
+ for (PlatformCompanyLiftRelevance entry : resultList) {
|
|
|
+ entry.setLiftCompanyStatus(new Byte(CommonEnum.LiftStatus.STOP_INSURANCE.getCode()));
|
|
|
+ }
|
|
|
+ boolean ret = updateBatchById(resultList);
|
|
|
+ if (!ret) {
|
|
|
+ return RestResponse.error(ApiConstants.RESULT_ERROR, MessageUtils.get("msg.modify.batch.fail"));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ //继续服务
|
|
|
+ case "3":
|
|
|
+ Project project = new Project();
|
|
|
+ project.setId(request.getProjectId());
|
|
|
+ project.setProjectStatus(new Byte(CommonEnum.ProjectStatus.IN_SERVICE.getCode()));
|
|
|
+ int result = projectMapper.updateById(project);
|
|
|
+ if (result < 0) {
|
|
|
+ return RestResponse.error(ApiConstants.RESULT_ERROR, MessageUtils.get("msg.modify.fail"));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return RestResponse.ok(null, ApiConstants.RESULT_SUCCESS, MessageUtils.get("msg.add.success"));
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @param request companyLiftRelevanceList 公司电梯更新列表
|
|
|
* @return 1.成功, 0.失败, 消息描述
|