Compare commits

..

3 Commits

Author SHA1 Message Date
2a8bff7478 Merge branch 'zjw' 2024-10-18 11:07:47 +08:00
943af49e1c Merge branch 'zjw' 2024-10-18 09:42:27 +08:00
a3837a488e 租户传递 2024-10-17 15:29:39 +08:00
9 changed files with 101 additions and 1 deletions

View File

@ -74,5 +74,5 @@ public class CustomerInfoDO extends BaseDO {
/**
* 租户编号
*/
private String tenantId;
private Long tenantId;
}

View File

@ -56,4 +56,9 @@ public class ComponentInfoDO extends BaseDO {
*/
private String remark;
/**
* 租户编号
*/
private Long tenantId;
}

View File

@ -79,5 +79,9 @@ public class EquipInfoDO extends BaseDO {
* 备注
*/
private String remark;
/**
* 租户
*/
private Long tenantId;
}

View File

@ -89,6 +89,10 @@ public class MaintenanceOrderDO extends BaseDO {
* 点检方案
*/
private String patrolPlan;
/**
* 租户编号
*/
private Long tenantId;
@TableField(exist = false)
private String equipNo;

View File

@ -53,5 +53,9 @@ public class MaintenanceReportDO extends BaseDO {
* 备注
*/
private String remark;
/**
* 租户编号
*/
private Long tenantId;
}

View File

@ -1,10 +1,13 @@
package com.inspur.module.system.service.equip;
import cn.hutool.core.util.StrUtil;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.framework.tenant.core.aop.TenantIgnore;
import com.inspur.module.system.controller.equip.vo.ComponentInfoPageReqVO;
import com.inspur.module.system.controller.equip.vo.ComponentInfoSaveReqVO;
import com.inspur.module.system.controller.equip.vo.ComponentSelectionVO;
import com.inspur.module.system.dal.dataobject.equip.ComponentInfoDO;
import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO;
import com.inspur.module.system.dal.mysql.equip.ComponentInfoMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -13,6 +16,7 @@ import com.inspur.framework.common.util.object.BeanUtils;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import static com.inspur.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.inspur.module.system.enums.ErrorCodeConstants.COMPONENT_INFO_NOT_EXISTS;
@ -29,21 +33,40 @@ public class ComponentInfoServiceImpl implements ComponentInfoService {
@Resource
private ComponentInfoMapper componentInfoMapper;
@Resource
private EquipInfoService equipInfoService;
@Override
@TenantIgnore
public String createComponentInfo(ComponentInfoSaveReqVO createReqVO) {
// 插入
ComponentInfoDO componentInfo = BeanUtils.toBean(createReqVO, ComponentInfoDO.class);
//如果机床id不为空进行租户传递
if (StrUtil.isNotBlank(componentInfo.getEquipId())){
EquipInfoDO equipInfo = equipInfoService.getEquipInfo(componentInfo.getEquipId());
if (Objects.nonNull(equipInfo)){
componentInfo.setTenantId(equipInfo.getTenantId());
}
}
componentInfoMapper.insert(componentInfo);
// 返回
return componentInfo.getComponentId();
}
@Override
@TenantIgnore
public void updateComponentInfo(ComponentInfoSaveReqVO updateReqVO) {
// 校验存在
validateComponentInfoExists(updateReqVO.getComponentId());
// 更新
ComponentInfoDO updateObj = BeanUtils.toBean(updateReqVO, ComponentInfoDO.class);
//如果机床id不为空进行租户传递
if (StrUtil.isNotBlank(updateObj.getEquipId())){
EquipInfoDO equipInfo = equipInfoService.getEquipInfo(updateObj.getEquipId());
if (Objects.nonNull(equipInfo)){
updateObj.setTenantId(equipInfo.getTenantId());
}
}
componentInfoMapper.updateById(updateObj);
}

View File

@ -20,6 +20,8 @@ import com.inspur.module.system.service.baseData.ModelInfoService;
import com.inspur.module.system.service.maintenance.MaintenanceOrderService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import com.inspur.framework.common.util.object.BeanUtils;
@ -48,10 +50,18 @@ public class EquipInfoServiceImpl implements EquipInfoService {
@Override
@TenantIgnore
public String createEquipInfo(EquipInfoSaveReqVO createReqVO) {
// 插入
EquipInfoDO equipInfo = BeanUtils.toBean(createReqVO, EquipInfoDO.class);
equipInfo.setRunStatus(0);//新增设备默认正常
//如果有客户id把客户id的租户id传递给机床
if (StrUtil.isNotBlank(createReqVO.getCustomerId())){
CustomerInfoDO customerInfo = customerInfoService.getCustomerInfo(createReqVO.getCustomerId());
if (Objects.nonNull(customerInfo)){
equipInfo.setTenantId(customerInfo.getTenantId());
}
}
equipInfoMapper.insert(equipInfo);
// 返回
return equipInfo.getEquipId();
@ -64,6 +74,13 @@ public class EquipInfoServiceImpl implements EquipInfoService {
validateEquipInfoExists(updateReqVO.getEquipId());
// 更新
EquipInfoDO updateObj = BeanUtils.toBean(updateReqVO, EquipInfoDO.class);
//如果有客户id把客户id的租户id传递给机床
if (StrUtil.isNotBlank(updateObj.getCustomerId())){
CustomerInfoDO customerInfo = customerInfoService.getCustomerInfo(updateObj.getCustomerId());
if (Objects.nonNull(customerInfo)){
updateObj.setTenantId(customerInfo.getTenantId());
}
}
equipInfoMapper.updateById(updateObj);
}

View File

@ -8,12 +8,15 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.inspur.framework.common.enums.CommonStatusEnum;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.framework.tenant.core.aop.TenantIgnore;
import com.inspur.module.bpm.api.task.BpmProcessInstanceApi;
import com.inspur.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
import com.inspur.module.system.controller.baseData.vo.CustomerInfoSelectionVO;
import com.inspur.module.system.controller.equip.vo.ComponentSelectionVO;
import com.inspur.module.system.controller.equip.vo.EquipSelectionVO;
import com.inspur.module.system.controller.maintenance.vo.*;
import com.inspur.module.system.dal.dataobject.baseData.CustomerInfoDO;
import com.inspur.module.system.dal.dataobject.equip.EquipInfoDO;
import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceOrderDO;
import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceReportDO;
import com.inspur.module.system.dal.dataobject.user.AdminUserDO;
@ -88,6 +91,7 @@ public class MaintenanceOrderServiceImpl implements MaintenanceOrderService {
@Override
@Transactional(rollbackFor = Exception.class)
@TenantIgnore
public String createRemoteMaintenanceOrder(MaintenanceOrderSaveReqVO createReqVO) {
// 插入
MaintenanceOrderDO remoteMaintenanceOrder = BeanUtils.toBean(createReqVO, MaintenanceOrderDO.class);
@ -100,6 +104,13 @@ public class MaintenanceOrderServiceImpl implements MaintenanceOrderService {
//设置为待审批
remoteMaintenanceOrder.setApproveStatus(0);
}
//如果设备id不是空进行租户传递
if (StrUtil.isNotBlank(remoteMaintenanceOrder.getEquipId())){
EquipInfoDO equipInfo = equipInfoService.getEquipInfo(remoteMaintenanceOrder.getEquipId());
if (Objects.nonNull(equipInfo)){
remoteMaintenanceOrder.setTenantId(equipInfo.getTenantId());
}
}
maintenanceOrderMapper.insert(remoteMaintenanceOrder);
//等于1的时候是在审批流程那边提交的
if (createReqVO.getStatus() == 1){
@ -121,6 +132,7 @@ public class MaintenanceOrderServiceImpl implements MaintenanceOrderService {
@Override
@Transactional(rollbackFor = Exception.class)
@TenantIgnore
public void updateRemoteMaintenanceOrder(MaintenanceOrderSaveReqVO updateReqVO) {
// 校验存在
validateRemoteMaintenanceOrderExists(updateReqVO.getMaintenanceOrderId());
@ -129,6 +141,13 @@ public class MaintenanceOrderServiceImpl implements MaintenanceOrderService {
if ("0".equals(updateReqVO.getSubmitFlag()) && StrUtil.isNotBlank(updateReqVO.getAlarmId())) {
alarmDataService.closeAllAlarmDataByEquipAlarmId(updateReqVO.getAlarmId());
}
//如果设备id不是空进行租户传递
if (StrUtil.isNotBlank(updateObj.getEquipId())){
EquipInfoDO equipInfo = equipInfoService.getEquipInfo(updateObj.getEquipId());
if (Objects.nonNull(equipInfo)){
updateObj.setTenantId(equipInfo.getTenantId());
}
}
maintenanceOrderMapper.updateById(updateObj);
}

View File

@ -1,8 +1,11 @@
package com.inspur.module.system.service.maintenance;
import cn.hutool.core.util.StrUtil;
import com.inspur.framework.common.pojo.PageResult;
import com.inspur.framework.tenant.core.aop.TenantIgnore;
import com.inspur.module.system.controller.maintenance.vo.MaintenanceReportPageReqVO;
import com.inspur.module.system.controller.maintenance.vo.MaintenanceReportSaveReqVO;
import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceOrderDO;
import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceReportDO;
import com.inspur.module.system.dal.mysql.maintenance.MaintenanceReportMapper;
import org.springframework.stereotype.Service;
@ -12,6 +15,8 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import com.inspur.framework.common.util.object.BeanUtils;
import java.util.Objects;
import static com.inspur.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.inspur.module.system.enums.ErrorCodeConstants.MAINTENANCE_REPORT_NOT_EXISTS;
@ -27,22 +32,41 @@ public class MaintenanceReportServiceImpl implements MaintenanceReportService {
@Resource
private MaintenanceReportMapper maintenanceReportMapper;
@Resource
private MaintenanceOrderService maintenanceOrderService;
@Override
@Transactional(rollbackFor = Exception.class)
@TenantIgnore
public String createMaintenanceReport(MaintenanceReportSaveReqVO createReqVO) {
// 插入
MaintenanceReportDO maintenanceReport = BeanUtils.toBean(createReqVO, MaintenanceReportDO.class);
maintenanceReportMapper.insert(maintenanceReport);
//租户传递
if (StrUtil.isNotBlank(maintenanceReport.getMaintenanceOrderId())){
MaintenanceOrderDO maintenanceOrder = maintenanceOrderService.getRemoteMaintenanceOrder(maintenanceReport.getMaintenanceOrderId());
if (Objects.nonNull(maintenanceOrder)){
maintenanceReport.setTenantId(maintenanceOrder.getTenantId());
}
}
// 返回
return maintenanceReport.getMaintenanceReportId();
}
@Override
@TenantIgnore
public void updateMaintenanceReport(MaintenanceReportSaveReqVO updateReqVO) {
// 校验存在
validateMaintenanceReportExists(updateReqVO.getMaintenanceReportId());
// 更新
MaintenanceReportDO updateObj = BeanUtils.toBean(updateReqVO, MaintenanceReportDO.class);
//租户传递
if (StrUtil.isNotBlank(updateObj.getMaintenanceOrderId())){
MaintenanceOrderDO maintenanceOrder = maintenanceOrderService.getRemoteMaintenanceOrder(updateObj.getMaintenanceOrderId());
if (Objects.nonNull(maintenanceOrder)){
updateObj.setTenantId(maintenanceOrder.getTenantId());
}
}
maintenanceReportMapper.updateById(updateObj);
}