feat:设备状态字段调整,删除状态字段,改为json字段保存
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
package com.zt.plat.module.qms.resource.device.controller.admin;
|
package com.zt.plat.module.qms.resource.device.controller.admin;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
|
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
import com.zt.plat.framework.business.annotation.FileUploadController;
|
import com.zt.plat.framework.business.annotation.FileUploadController;
|
||||||
import com.zt.plat.framework.business.controller.AbstractFileUploadController;
|
import com.zt.plat.framework.business.controller.AbstractFileUploadController;
|
||||||
@@ -11,12 +13,10 @@ import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
|
|||||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||||
import com.zt.plat.framework.datapermission.core.annotation.DeptDataPermissionIgnore;
|
import com.zt.plat.framework.datapermission.core.annotation.DeptDataPermissionIgnore;
|
||||||
import com.zt.plat.framework.excel.core.util.ExcelUtils;
|
import com.zt.plat.framework.excel.core.util.ExcelUtils;
|
||||||
import com.zt.plat.module.qms.core.constant.DataTypeConstant;
|
|
||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationPageReqVO;
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationPageReqVO;
|
||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationRespVO;
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationRespVO;
|
||||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationSaveReqVO;
|
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationSaveReqVO;
|
||||||
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceInfomationDO;
|
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceInfomationDO;
|
||||||
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceProductDO;
|
|
||||||
import com.zt.plat.module.qms.resource.device.service.DeviceInfomationService;
|
import com.zt.plat.module.qms.resource.device.service.DeviceInfomationService;
|
||||||
import com.zt.plat.module.qms.resource.device.service.DeviceProductService;
|
import com.zt.plat.module.qms.resource.device.service.DeviceProductService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@@ -26,6 +26,7 @@ import jakarta.annotation.Resource;
|
|||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -53,6 +54,28 @@ public class DeviceInfomationController extends AbstractFileUploadController imp
|
|||||||
@Resource private DeviceInfomationService deviceInfomationService;
|
@Resource private DeviceInfomationService deviceInfomationService;
|
||||||
@Resource private DeviceProductService deviceProductService;
|
@Resource private DeviceProductService deviceProductService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新设备状态
|
||||||
|
* 参数举例:
|
||||||
|
* 维修:{"deviceId": "XX","bizType": "Accept","switchState": "1"}
|
||||||
|
* 维修完成:{"deviceId": "XX","bizType": "Accept","switchState": "0"}
|
||||||
|
* 验收:{"deviceId": "XX","bizType": "Accept","switchState": "1"}
|
||||||
|
* 取消验收:{"deviceId": "XX","bizType": "Accept","switchState": "0"}
|
||||||
|
* 启用:{"deviceId": "XX","bizType": "Enable","switchState": "1"}
|
||||||
|
* 停用:{"deviceId": "XX","bizType": "Enable","switchState": "0"}
|
||||||
|
* 降级:{"deviceId": "XX","bizType": "Demote","switchState": "1"}
|
||||||
|
* (降级)还原:{"deviceId": "XX","bizType": "Demote","switchState": "0"}
|
||||||
|
* 报废:{"deviceId": "XX","bizType": "Scrap","switchState": "1"}
|
||||||
|
* (报废)还原:{"deviceId": "XX","bizType": "Scrap","switchState": "0"}
|
||||||
|
* */
|
||||||
|
@PostMapping("/updateDeviceStatus")
|
||||||
|
@Operation(summary = "更新设备状态")
|
||||||
|
public CommonResult<DeviceInfomationRespVO> updateDeviceStatus(@RequestBody JSONObject param) {
|
||||||
|
return deviceInfomationService.updateDeviceStatus(param);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/saveDevice")
|
@PostMapping("/saveDevice")
|
||||||
@Operation(summary = "创建设备-设备信息")
|
@Operation(summary = "创建设备-设备信息")
|
||||||
// @PreAuthorize("@ss.hasPermission('resource:device-infomation:create')")
|
// @PreAuthorize("@ss.hasPermission('resource:device-infomation:create')")
|
||||||
@@ -114,6 +137,11 @@ public class DeviceInfomationController extends AbstractFileUploadController imp
|
|||||||
pageReqVO.setProductId(null);
|
pageReqVO.setProductId(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
String deviceStatus = pageReqVO.getDeviceStatus();
|
||||||
|
if("0".equals(deviceStatus))
|
||||||
|
deviceStatus = "{\"Enable\":\"1\"}";
|
||||||
|
if(!ObjectUtils.isEmpty(deviceStatus))
|
||||||
|
pageReqVO.setDeviceStatusJson(JSON.parseObject(deviceStatus));
|
||||||
PageResult<DeviceInfomationDO> pageResult = deviceInfomationService.getDeviceInfomationPage(pageReqVO);
|
PageResult<DeviceInfomationDO> pageResult = deviceInfomationService.getDeviceInfomationPage(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, DeviceInfomationRespVO.class));
|
return success(BeanUtils.toBean(pageResult, DeviceInfomationRespVO.class));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.zt.plat.module.qms.resource.device.controller.vo;
|
package com.zt.plat.module.qms.resource.device.controller.vo;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.zt.plat.framework.common.pojo.PageParam;
|
import com.zt.plat.framework.common.pojo.PageParam;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -27,24 +28,6 @@ public class DeviceInfomationPageReqVO extends PageParam {
|
|||||||
@Schema(description = "设备状态", example = "2")
|
@Schema(description = "设备状态", example = "2")
|
||||||
private String deviceStatus;
|
private String deviceStatus;
|
||||||
|
|
||||||
@Schema(description = "维修状态")
|
|
||||||
private String repairFlag;
|
|
||||||
|
|
||||||
@Schema(description = "降级状态")
|
|
||||||
private String demoteFlag;
|
|
||||||
|
|
||||||
@Schema(description = "报废状态")
|
|
||||||
private String scrapFlag;
|
|
||||||
|
|
||||||
@Schema(description = "停用状态")
|
|
||||||
private String disableFlag;
|
|
||||||
|
|
||||||
@Schema(description = "验收状态")
|
|
||||||
private String acceptanceFlag;
|
|
||||||
|
|
||||||
@Schema(description = "外借状态")
|
|
||||||
private String lendFlag;
|
|
||||||
|
|
||||||
@Schema(description = "使用中状态")
|
@Schema(description = "使用中状态")
|
||||||
private String inUseFlag;
|
private String inUseFlag;
|
||||||
|
|
||||||
@@ -135,4 +118,8 @@ public class DeviceInfomationPageReqVO extends PageParam {
|
|||||||
//===================扩展属性==============
|
//===================扩展属性==============
|
||||||
@Schema(description = "大类ids")
|
@Schema(description = "大类ids")
|
||||||
List<Long> productIds;
|
List<Long> productIds;
|
||||||
|
|
||||||
|
@Schema(description = "设备状态JSON")
|
||||||
|
JSONObject deviceStatusJson;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@ package com.zt.plat.module.qms.resource.device.controller.vo;
|
|||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -33,30 +34,6 @@ public class DeviceInfomationRespVO {
|
|||||||
@ExcelProperty("设备状态")
|
@ExcelProperty("设备状态")
|
||||||
private String deviceStatus;
|
private String deviceStatus;
|
||||||
|
|
||||||
@Schema(description = "维修状态")
|
|
||||||
@ExcelProperty("维修状态")
|
|
||||||
private String repairFlag;
|
|
||||||
|
|
||||||
@Schema(description = "降级状态")
|
|
||||||
@ExcelProperty("降级状态")
|
|
||||||
private String demoteFlag;
|
|
||||||
|
|
||||||
@Schema(description = "报废状态")
|
|
||||||
@ExcelProperty("报废状态")
|
|
||||||
private String scrapFlag;
|
|
||||||
|
|
||||||
@Schema(description = "停用状态")
|
|
||||||
@ExcelProperty("停用状态")
|
|
||||||
private String disableFlag;
|
|
||||||
|
|
||||||
@Schema(description = "验收状态")
|
|
||||||
@ExcelProperty("验收状态")
|
|
||||||
private String acceptanceFlag;
|
|
||||||
|
|
||||||
@Schema(description = "外借状态")
|
|
||||||
@ExcelProperty("外借状态")
|
|
||||||
private String lendFlag;
|
|
||||||
|
|
||||||
@Schema(description = "使用中状态")
|
@Schema(description = "使用中状态")
|
||||||
@ExcelProperty("使用中状态")
|
@ExcelProperty("使用中状态")
|
||||||
private String inUseFlag;
|
private String inUseFlag;
|
||||||
|
|||||||
@@ -28,24 +28,6 @@ public class DeviceInfomationSaveReqVO {
|
|||||||
@Schema(description = "设备状态", example = "2")
|
@Schema(description = "设备状态", example = "2")
|
||||||
private String deviceStatus;
|
private String deviceStatus;
|
||||||
|
|
||||||
@Schema(description = "维修状态")
|
|
||||||
private String repairFlag;
|
|
||||||
|
|
||||||
@Schema(description = "降级状态")
|
|
||||||
private String demoteFlag;
|
|
||||||
|
|
||||||
@Schema(description = "报废状态")
|
|
||||||
private String scrapFlag;
|
|
||||||
|
|
||||||
@Schema(description = "停用状态")
|
|
||||||
private String disableFlag;
|
|
||||||
|
|
||||||
@Schema(description = "验收状态")
|
|
||||||
private String acceptanceFlag;
|
|
||||||
|
|
||||||
@Schema(description = "外借状态")
|
|
||||||
private String lendFlag;
|
|
||||||
|
|
||||||
@Schema(description = "使用中状态")
|
@Schema(description = "使用中状态")
|
||||||
private String inUseFlag;
|
private String inUseFlag;
|
||||||
|
|
||||||
|
|||||||
@@ -53,38 +53,8 @@ public class DeviceInfomationDO extends BusinessBaseDO {
|
|||||||
@TableField("DEV_STS")
|
@TableField("DEV_STS")
|
||||||
private String deviceStatus;
|
private String deviceStatus;
|
||||||
/**
|
/**
|
||||||
* 维修状态
|
* 使用中状态
|
||||||
*/
|
*/
|
||||||
@TableField("RPR_FLG")
|
|
||||||
private String repairFlag;
|
|
||||||
/**
|
|
||||||
* 降级状态
|
|
||||||
*/
|
|
||||||
@TableField("DMOT_FLG")
|
|
||||||
private String demoteFlag;
|
|
||||||
/**
|
|
||||||
* 报废状态
|
|
||||||
*/
|
|
||||||
@TableField("SCR_FLG")
|
|
||||||
private String scrapFlag;
|
|
||||||
/**
|
|
||||||
* 停用状态
|
|
||||||
*/
|
|
||||||
@TableField("DSBL_FLG")
|
|
||||||
private String disableFlag;
|
|
||||||
/**
|
|
||||||
* 验收状态
|
|
||||||
*/
|
|
||||||
@TableField("ACPT_FLG")
|
|
||||||
private String acceptanceFlag;
|
|
||||||
/**
|
|
||||||
* 外借状态
|
|
||||||
*/
|
|
||||||
@TableField("LND_FLG")
|
|
||||||
private String lendFlag;
|
|
||||||
/**
|
|
||||||
* 使用中状态
|
|
||||||
*/
|
|
||||||
@TableField("IN_USE_FLG")
|
@TableField("IN_USE_FLG")
|
||||||
private String inUseFlag;
|
private String inUseFlag;
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.zt.plat.module.qms.resource.device.dal.mapper;
|
package com.zt.plat.module.qms.resource.device.dal.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.zt.plat.framework.common.pojo.PageResult;
|
import com.zt.plat.framework.common.pojo.PageResult;
|
||||||
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
@@ -24,47 +26,7 @@ import static com.zt.plat.module.qms.enums.QmsPermissionConstant.DEVICE_MANAGER;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface DeviceInfomationMapper extends BaseMapperX<DeviceInfomationDO> {
|
public interface DeviceInfomationMapper extends BaseMapperX<DeviceInfomationDO> {
|
||||||
|
|
||||||
// @QmsPermission(deptDataRoleCodes = DEPT_DATA_AND_SUB, moduleDataRoleCodes = DEVICE_MANAGER)
|
Page<DeviceInfomationDO> selectPage(IPage<?> page, @Param("param") DeviceInfomationPageReqVO param);
|
||||||
default PageResult<DeviceInfomationDO> selectPage(DeviceInfomationPageReqVO reqVO) {
|
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<DeviceInfomationDO>()
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getProductId, reqVO.getProductId())
|
|
||||||
.inIfPresent(DeviceInfomationDO::getProductId, reqVO.getProductIds())
|
|
||||||
.likeIfPresent(DeviceInfomationDO::getDeviceName, reqVO.getDeviceName())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getAlias, reqVO.getAlias())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getDeviceStatus, reqVO.getDeviceStatus())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getRepairFlag, reqVO.getRepairFlag())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getDemoteFlag, reqVO.getDemoteFlag())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getScrapFlag, reqVO.getScrapFlag())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getDisableFlag, reqVO.getDisableFlag())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getAcceptanceFlag, reqVO.getAcceptanceFlag())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getLendFlag, reqVO.getLendFlag())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getInUseFlag, reqVO.getInUseFlag())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getGradeCategory, reqVO.getGradeCategory())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getDeviceNumber, reqVO.getDeviceNumber())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getDeviceCode, reqVO.getDeviceCode())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getAssetCode, reqVO.getAssetCode())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getFactoryCode, reqVO.getFactoryCode())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getPosition, reqVO.getPosition())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getPurchasePrice, reqVO.getPurchasePrice())
|
|
||||||
.betweenIfPresent(DeviceInfomationDO::getPurchaseDate, reqVO.getPurchaseDate())
|
|
||||||
.betweenIfPresent(DeviceInfomationDO::getProductiveDate, reqVO.getProductiveDate())
|
|
||||||
.betweenIfPresent(DeviceInfomationDO::getDeployDate, reqVO.getDeployDate())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getDeployEngineer, reqVO.getDeployEngineer())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getDeployLocation, reqVO.getDeployLocation())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getAcceptanceUserId, reqVO.getAcceptanceUserId())
|
|
||||||
.likeIfPresent(DeviceInfomationDO::getAcceptanceUserName, reqVO.getAcceptanceUserName())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getManagerUserId, reqVO.getManagerUserId())
|
|
||||||
.likeIfPresent(DeviceInfomationDO::getManagerUserName, reqVO.getManagerUserName())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getCustomFormData, reqVO.getCustomFormData())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getPhoto, reqVO.getPhoto())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getDeviceParameter, reqVO.getDeviceParameter())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getStateShow, reqVO.getStateShow())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getStateStack, reqVO.getStateStack())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
|
|
||||||
.eqIfPresent(DeviceInfomationDO::getRemark, reqVO.getRemark())
|
|
||||||
.betweenIfPresent(DeviceInfomationDO::getCreateTime, reqVO.getCreateTime())
|
|
||||||
.orderByDesc(DeviceInfomationDO::getId));
|
|
||||||
}
|
|
||||||
|
|
||||||
//查询需要“某个业务类型”的设备列表
|
//查询需要“某个业务类型”的设备列表
|
||||||
List<DeviceInfoWithBizConfigVO> getListNeedByRule(@Param("param") Map<String, Object> param);
|
List<DeviceInfoWithBizConfigVO> getListNeedByRule(@Param("param") Map<String, Object> param);
|
||||||
|
|||||||
@@ -1,16 +1,22 @@
|
|||||||
package com.zt.plat.module.qms.resource.device.enums;
|
package com.zt.plat.module.qms.resource.device.enums;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public enum DeviceBizEnum {
|
public enum DeviceBizEnum {
|
||||||
|
|
||||||
accept("Accept", "验收"),
|
accept("Accept", "验收"),
|
||||||
repair("Repair", "维修"),
|
repair("Repair", "维修"),
|
||||||
demote("Demote", "降级"),
|
demote("Demote", "降级"),
|
||||||
scrap("Scrap", "报废"),
|
scrap("Scrap", "报废"),
|
||||||
disable("Disable", "停用"),
|
// disable("Disable", "停用"),
|
||||||
enable("Enable", "启用"),
|
enable("Enable", "启用"),
|
||||||
borrow("Borrow", "借用"),
|
borrow("Borrow", "借用");
|
||||||
giveback("Giveback", "归还");
|
// giveback("Giveback", "归还");
|
||||||
|
|
||||||
|
public static final Integer switchOn = 1;
|
||||||
|
public static final Integer switchOff = 0;
|
||||||
|
|
||||||
private String code;
|
private String code;
|
||||||
private String describe;
|
private String describe;
|
||||||
@@ -48,6 +54,65 @@ public enum DeviceBizEnum {
|
|||||||
return describe;
|
return describe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 根据业务类型、开关状态,获取状态值
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
public static JSONObject getStateBySwitch(String code, Integer switchState){
|
||||||
|
DeviceBizEnum biz = getByCode(code);
|
||||||
|
String flag = "";
|
||||||
|
boolean updateStateShow = false;
|
||||||
|
if(biz == null)
|
||||||
|
return null;
|
||||||
|
switch (biz){
|
||||||
|
case accept:
|
||||||
|
flag = String.valueOf(switchState);
|
||||||
|
updateStateShow = false;
|
||||||
|
break;
|
||||||
|
case repair:
|
||||||
|
flag = String.valueOf(switchState);
|
||||||
|
updateStateShow = true;
|
||||||
|
break;
|
||||||
|
case demote:
|
||||||
|
flag = String.valueOf(switchState);
|
||||||
|
updateStateShow = true;
|
||||||
|
break;
|
||||||
|
case scrap:
|
||||||
|
flag = String.valueOf(switchState);
|
||||||
|
updateStateShow = true;
|
||||||
|
break;
|
||||||
|
// case disable:
|
||||||
|
// flag = String.valueOf(switchState);
|
||||||
|
// updateStateShow = true;
|
||||||
|
// break;
|
||||||
|
case enable:
|
||||||
|
if(Objects.equals(switchState, switchOn))
|
||||||
|
flag = "0";
|
||||||
|
else
|
||||||
|
flag = "1";
|
||||||
|
updateStateShow = true;
|
||||||
|
break;
|
||||||
|
case borrow:
|
||||||
|
flag = String.valueOf(switchState);
|
||||||
|
updateStateShow = true;
|
||||||
|
break;
|
||||||
|
// case giveback:
|
||||||
|
// if(Objects.equals(switchState, DeviceBizEnum.switchOn))
|
||||||
|
// flag = "0";
|
||||||
|
// else
|
||||||
|
// flag = "1";
|
||||||
|
// updateStateShow = true;
|
||||||
|
// break;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("flag", flag);
|
||||||
|
json.put("updateStateShow", updateStateShow);
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getCode() {
|
public String getCode() {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,8 +72,6 @@ public class DeviceApplyServiceImpl implements DeviceApplyService, BMPCallbackIn
|
|||||||
@Resource private DataKeyCheckService dataKeyCheckService;
|
@Resource private DataKeyCheckService dataKeyCheckService;
|
||||||
@Resource private DataOpinionService dataOpinionService;
|
@Resource private DataOpinionService dataOpinionService;
|
||||||
private final String titleKey = "title";
|
private final String titleKey = "title";
|
||||||
private final Integer switchOn = 1;
|
|
||||||
private final Integer switchOff = 0;
|
|
||||||
private final String borrowConfirmKey = "borrowConfirm";
|
private final String borrowConfirmKey = "borrowConfirm";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -259,7 +257,7 @@ public class DeviceApplyServiceImpl implements DeviceApplyService, BMPCallbackIn
|
|||||||
|
|
||||||
//设备维修流程,修改设备状态为维修中
|
//设备维修流程,修改设备状态为维修中
|
||||||
if(DeviceBizEnum.repair.getCode().equals(businessCode)){
|
if(DeviceBizEnum.repair.getCode().equals(businessCode)){
|
||||||
updateDeviceStateByApply(entity, switchOn);
|
updateDeviceStateByApply(entity, DeviceBizEnum.switchOn);
|
||||||
}
|
}
|
||||||
|
|
||||||
return CommonResult.success(respVO);
|
return CommonResult.success(respVO);
|
||||||
@@ -425,11 +423,11 @@ public class DeviceApplyServiceImpl implements DeviceApplyService, BMPCallbackIn
|
|||||||
if("1".equals(lastActivityFlag)){
|
if("1".equals(lastActivityFlag)){
|
||||||
entity.setBusinessStatus(QmsCommonConstant.COMPLETED); //结束审批
|
entity.setBusinessStatus(QmsCommonConstant.COMPLETED); //结束审批
|
||||||
//更新设备状态
|
//更新设备状态
|
||||||
updateDeviceStateByApply(entity, switchOff);
|
updateDeviceStateByApply(entity, DeviceBizEnum.switchOff);
|
||||||
}
|
}
|
||||||
if("1".equals(borrowConfirm)){
|
if("1".equals(borrowConfirm)){
|
||||||
//更新设备状态
|
//更新设备状态
|
||||||
updateDeviceStateByApply(entity, switchOn);
|
updateDeviceStateByApply(entity, DeviceBizEnum.switchOn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
deviceApplyMapper.updateById(entity);
|
deviceApplyMapper.updateById(entity);
|
||||||
@@ -437,57 +435,21 @@ public class DeviceApplyServiceImpl implements DeviceApplyService, BMPCallbackIn
|
|||||||
return CommonResult.success(ret);
|
return CommonResult.success(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 修改设备状态
|
||||||
|
* switchState: 切换状态(switchOn(1): 切换为开, switchOff(0):切换为关。 按bizType判断要更新的字段。按bizType语义判断更新的值。)
|
||||||
|
* */
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void updateDeviceStateByApply(DeviceApplyDO entity, Integer switchState){
|
public void updateDeviceStateByApply(DeviceApplyDO entity, Integer switchState){
|
||||||
List<DeviceInfomationDO> deviceList = new ArrayList<>();
|
List<DeviceInfomationDO> deviceList = new ArrayList<>();
|
||||||
List<DeviceApplyDetailDO> detailList = deviceApplyDetailService.selectListByApplyId(entity.getId());
|
List<DeviceApplyDetailDO> detailList = deviceApplyDetailService.selectListByApplyId(entity.getId());
|
||||||
String bizType = entity.getBusinessCode();
|
String bizType = entity.getBusinessCode();
|
||||||
String flag = "";
|
// String flag = json.getString("flag");
|
||||||
boolean updateStateShow = false;
|
// boolean updateStateShow = json.getBoolean("updateStateShow");
|
||||||
DeviceBizEnum biz = DeviceBizEnum.getByCode(bizType);
|
|
||||||
if(biz == null)
|
|
||||||
throw exception0(DEVICE_INFOMATION_NOT_EXISTS.getCode(), "更新设备状态时发生错误,业务类型不存在:" + bizType);
|
|
||||||
if (bizType.equals(DeviceBizEnum.accept.getCode())) {
|
|
||||||
flag = String.valueOf(switchState);
|
|
||||||
updateStateShow = false;
|
|
||||||
}
|
|
||||||
if (bizType.equals(DeviceBizEnum.repair.getCode())) {
|
|
||||||
flag = String.valueOf(switchState);
|
|
||||||
updateStateShow = true;
|
|
||||||
}
|
|
||||||
if (bizType.equals(DeviceBizEnum.demote.getCode())) {
|
|
||||||
flag = String.valueOf(switchState);
|
|
||||||
updateStateShow = true;
|
|
||||||
}
|
|
||||||
if (bizType.equals(DeviceBizEnum.scrap.getCode())) {
|
|
||||||
flag = String.valueOf(switchState);
|
|
||||||
updateStateShow = true;
|
|
||||||
}
|
|
||||||
if (bizType.equals(DeviceBizEnum.disable.getCode())) {
|
|
||||||
flag = String.valueOf(switchState);
|
|
||||||
updateStateShow = true;
|
|
||||||
}
|
|
||||||
if(bizType.equals(DeviceBizEnum.enable.getCode())){
|
|
||||||
if(Objects.equals(switchState, switchOn))
|
|
||||||
flag = "0";
|
|
||||||
else
|
|
||||||
flag = "1";
|
|
||||||
updateStateShow = true;
|
|
||||||
}
|
|
||||||
if (bizType.equals(DeviceBizEnum.borrow.getCode())) {
|
|
||||||
flag = String.valueOf(switchState);
|
|
||||||
updateStateShow = true;
|
|
||||||
}
|
|
||||||
if(bizType.equals(DeviceBizEnum.giveback.getCode())){
|
|
||||||
if(Objects.equals(switchState, switchOn))
|
|
||||||
flag = "0";
|
|
||||||
else
|
|
||||||
flag = "1";
|
|
||||||
updateStateShow = true;
|
|
||||||
}
|
|
||||||
for(DeviceApplyDetailDO detail : detailList){
|
for(DeviceApplyDetailDO detail : detailList){
|
||||||
DeviceInfomationDO device = deviceInfomationService.getDeviceInfomation(detail.getDeviceInfomationId());
|
DeviceInfomationDO device = deviceInfomationService.getDeviceInfomation(detail.getDeviceInfomationId());
|
||||||
device = deviceInfomationService.initDeviceStatusByBizType(device, bizType, flag, updateStateShow).getData();
|
device = deviceInfomationService.initDeviceStatusByBizType(device, bizType, switchState).getData();
|
||||||
deviceList.add(device);
|
deviceList.add(device);
|
||||||
}
|
}
|
||||||
deviceInfomationService.updateBatch(deviceList);
|
deviceInfomationService.updateBatch(deviceList);
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ public interface DeviceInfomationService {
|
|||||||
|
|
||||||
CommonResult<DeviceInfomationRespVO> saveDevice(@Valid DeviceInfomationSaveReqVO reqVO);
|
CommonResult<DeviceInfomationRespVO> saveDevice(@Valid DeviceInfomationSaveReqVO reqVO);
|
||||||
|
|
||||||
|
//更新设备状态
|
||||||
|
CommonResult<DeviceInfomationRespVO> updateDeviceStatus(JSONObject param);
|
||||||
|
|
||||||
CommonResult<Boolean> checkDeviceUsable(Long id );
|
CommonResult<Boolean> checkDeviceUsable(Long id );
|
||||||
|
|
||||||
DeviceInfomationDO getByCode(String code);
|
DeviceInfomationDO getByCode(String code);
|
||||||
@@ -35,7 +38,7 @@ public interface DeviceInfomationService {
|
|||||||
List<DeviceInfoWithBizConfigVO> getListNeedByRule(JSONObject params);
|
List<DeviceInfoWithBizConfigVO> getListNeedByRule(JSONObject params);
|
||||||
|
|
||||||
// 更新设备的生命周期状态
|
// 更新设备的生命周期状态
|
||||||
CommonResult<DeviceInfomationDO> initDeviceStatusByBizType(DeviceInfomationDO info, String bizType, String flag, boolean updateStateShow);
|
CommonResult<DeviceInfomationDO> initDeviceStatusByBizType(DeviceInfomationDO info, String bizType, Integer switchState);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user