feat():新增轧辊相关枚举
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
package com.fizz.business.constants.enums;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IEnum;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
|
||||||
|
public enum RollerPositionEnum{
|
||||||
|
TOP("TOP","上辊"),
|
||||||
|
BOTTOM("BOTTOM","下辊");
|
||||||
|
|
||||||
|
|
||||||
|
private final String value;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.fizz.business.constants.enums;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IEnum;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
|
||||||
|
public enum RollerTypeEnum {
|
||||||
|
WORK("WORK","工作辊"),
|
||||||
|
INTERMEDIATE("INTERMEDIATE","中间辊"),
|
||||||
|
BACKUP("BACKUP","支撑辊");
|
||||||
|
|
||||||
|
|
||||||
|
private final String value;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -20,6 +20,7 @@ import java.util.List;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/roller")
|
@RequestMapping("/roller")
|
||||||
@Api("南钢轧辊接口")
|
@Api("南钢轧辊接口")
|
||||||
|
@Anonymous
|
||||||
public class RollerController {
|
public class RollerController {
|
||||||
@Resource
|
@Resource
|
||||||
RollHistoryService rollHistoryService;
|
RollHistoryService rollHistoryService;
|
||||||
@@ -27,10 +28,10 @@ public class RollerController {
|
|||||||
@Resource
|
@Resource
|
||||||
RollDataService rollDataService;
|
RollDataService rollDataService;
|
||||||
|
|
||||||
@GetMapping("/data/backup")
|
@GetMapping("/data/standby")
|
||||||
@ApiOperation("轧辊数据-获取当前备辊信息")
|
@ApiOperation("轧辊数据-获取当前备辊信息")
|
||||||
public R<List<ReadyRollDataVO> > getReadyRollList() {
|
public R<List<ReadyRollDataVO> > getReadyRollList() {
|
||||||
return R.ok(rollDataService.getReadyRollList(null,null,"BACKUP"));
|
return R.ok(rollDataService.getReadyRollList(null,null,"STANDBY"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/data/ready/{position}/{type}")
|
@GetMapping("/data/ready/{position}/{type}")
|
||||||
@@ -45,13 +46,13 @@ public class RollerController {
|
|||||||
return R.ok(rollDataService.getOnlineRollList());
|
return R.ok(rollDataService.getOnlineRollList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/change/backup")
|
@PostMapping("/change/standby")
|
||||||
@ApiOperation("轧辊操作-备辊")
|
@ApiOperation("轧辊操作-备辊")
|
||||||
public R<List<String>> backupRoll(@RequestBody List<ReadyRollDataVO> rollList) {
|
public R<List<String>> backupRoll(@RequestBody List<ReadyRollDataVO> rollList) {
|
||||||
return R.ok(rollDataService.BackupRoll(rollList));
|
return R.ok(rollDataService.BackupRoll(rollList));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/change/online")
|
@PostMapping("/change/online")
|
||||||
@ApiOperation("轧辊操作-上线")
|
@ApiOperation("轧辊操作-上线")
|
||||||
public R<List<OnlineRollDataVO>> onlineRoll() {
|
public R<List<OnlineRollDataVO>> onlineRoll() {
|
||||||
return R.ok(rollDataService.onlineRoll());
|
return R.ok(rollDataService.onlineRoll());
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.fizz.business.constants.enums.RollerPositionEnum;
|
||||||
|
import com.fizz.business.constants.enums.RollerTypeEnum;
|
||||||
import com.fizz.business.domain.PlantConfig;
|
import com.fizz.business.domain.PlantConfig;
|
||||||
import com.fizz.business.domain.RollData;
|
import com.fizz.business.domain.RollData;
|
||||||
import com.fizz.business.domain.RollHistory;
|
import com.fizz.business.domain.RollHistory;
|
||||||
@@ -67,6 +69,8 @@ public class RollDataServiceImpl extends ServiceImpl<RollDataMapper, RollData> i
|
|||||||
ReadyRollDataVO readyRollDataVO = new ReadyRollDataVO();
|
ReadyRollDataVO readyRollDataVO = new ReadyRollDataVO();
|
||||||
// 使用 BeanUtils 复制属性
|
// 使用 BeanUtils 复制属性
|
||||||
BeanUtils.copyProperties(rollData, readyRollDataVO);
|
BeanUtils.copyProperties(rollData, readyRollDataVO);
|
||||||
|
readyRollDataVO.setPosition(RollerPositionEnum.valueOf(rollData.getPosition()));
|
||||||
|
readyRollDataVO.setType(RollerTypeEnum.valueOf(rollData.getType()));
|
||||||
readyRollDataVOList.add(readyRollDataVO);
|
readyRollDataVOList.add(readyRollDataVO);
|
||||||
}
|
}
|
||||||
return readyRollDataVOList;
|
return readyRollDataVOList;
|
||||||
@@ -82,6 +86,9 @@ public class RollDataServiceImpl extends ServiceImpl<RollDataMapper, RollData> i
|
|||||||
OnlineRollDataVO onlineRollDataVO = new OnlineRollDataVO();
|
OnlineRollDataVO onlineRollDataVO = new OnlineRollDataVO();
|
||||||
// 使用 BeanUtils 复制属性
|
// 使用 BeanUtils 复制属性
|
||||||
BeanUtils.copyProperties(rollData, onlineRollDataVO);
|
BeanUtils.copyProperties(rollData, onlineRollDataVO);
|
||||||
|
onlineRollDataVO.setPosition(RollerPositionEnum.valueOf(rollData.getPosition()));
|
||||||
|
onlineRollDataVO.setType(RollerTypeEnum.valueOf(rollData.getType()));
|
||||||
|
|
||||||
String lengthKey="";
|
String lengthKey="";
|
||||||
String weightKey="";
|
String weightKey="";
|
||||||
switch(rollData.getType()){
|
switch(rollData.getType()){
|
||||||
@@ -144,7 +151,7 @@ public class RollDataServiceImpl extends ServiceImpl<RollDataMapper, RollData> i
|
|||||||
//清楚所有已有备辊,添加新备辊,有则更新数据,没有则新增
|
//清楚所有已有备辊,添加新备辊,有则更新数据,没有则新增
|
||||||
if(ObjectUtil.isEmpty(result)){
|
if(ObjectUtil.isEmpty(result)){
|
||||||
lambdaUpdate().set(RollData::getStatus,"OFFLINE")
|
lambdaUpdate().set(RollData::getStatus,"OFFLINE")
|
||||||
.eq(RollData::getStatus,"BACKUP")
|
.eq(RollData::getStatus,"STANDBY")
|
||||||
.update();
|
.update();
|
||||||
|
|
||||||
List<RollData> newDataList = Lists.newArrayList();
|
List<RollData> newDataList = Lists.newArrayList();
|
||||||
@@ -153,8 +160,8 @@ public class RollDataServiceImpl extends ServiceImpl<RollDataMapper, RollData> i
|
|||||||
RollData temp = rollDataList.stream().filter(n->n.getRollid().equals(item.getRollid()))
|
RollData temp = rollDataList.stream().filter(n->n.getRollid().equals(item.getRollid()))
|
||||||
.findFirst().orElse(RollData.builder()
|
.findFirst().orElse(RollData.builder()
|
||||||
.rollid(item.getRollid())
|
.rollid(item.getRollid())
|
||||||
.position(item.getPosition())
|
.position(item.getPosition().getValue())
|
||||||
.type(item.getType())
|
.type(item.getType().getValue())
|
||||||
.seton("CRM")
|
.seton("CRM")
|
||||||
.standid(1)
|
.standid(1)
|
||||||
.grindCount(0)
|
.grindCount(0)
|
||||||
@@ -163,7 +170,7 @@ public class RollDataServiceImpl extends ServiceImpl<RollDataMapper, RollData> i
|
|||||||
temp.setDiameter(temp.getDiameter());
|
temp.setDiameter(temp.getDiameter());
|
||||||
temp.setCrown(temp.getCrown());
|
temp.setCrown(temp.getCrown());
|
||||||
temp.setRough(temp.getRough());
|
temp.setRough(temp.getRough());
|
||||||
|
temp.setStatus("STANDBY");
|
||||||
newDataList.add(temp);
|
newDataList.add(temp);
|
||||||
});
|
});
|
||||||
this.saveOrUpdateBatch(newDataList);
|
this.saveOrUpdateBatch(newDataList);
|
||||||
@@ -174,9 +181,9 @@ public class RollDataServiceImpl extends ServiceImpl<RollDataMapper, RollData> i
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<OnlineRollDataVO> onlineRoll() {
|
public List<OnlineRollDataVO> onlineRoll() {
|
||||||
List<RollData> backupRollList = getList(null, null,"BACKUP");
|
List<RollData> standByRollList = getList(null, null,"STANDBY");
|
||||||
List<RollData> onlineRollList = getList(null, null,"ONLINE");
|
List<RollData> onlineRollList = getList(null, null,"ONLINE");
|
||||||
if(ObjectUtil.isEmpty(backupRollList)){
|
if(ObjectUtil.isEmpty(standByRollList)){
|
||||||
return getOnlineRollList();
|
return getOnlineRollList();
|
||||||
}
|
}
|
||||||
ShiftHistory shiftHistory = shiftHistoryService.getCurrent();
|
ShiftHistory shiftHistory = shiftHistoryService.getCurrent();
|
||||||
@@ -185,7 +192,7 @@ public class RollDataServiceImpl extends ServiceImpl<RollDataMapper, RollData> i
|
|||||||
List<RollHistory> rollHistoryList =Lists.newArrayList();
|
List<RollHistory> rollHistoryList =Lists.newArrayList();
|
||||||
List<RollData> changeRollList =Lists.newArrayList();
|
List<RollData> changeRollList =Lists.newArrayList();
|
||||||
//更换轧辊
|
//更换轧辊
|
||||||
backupRollList.forEach(item->{
|
standByRollList.forEach(item->{
|
||||||
//上线卷
|
//上线卷
|
||||||
item.setStatus("ONLINE");
|
item.setStatus("ONLINE");
|
||||||
item.setGrindCount(item.getGrindCount()+1);
|
item.setGrindCount(item.getGrindCount()+1);
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.fizz.business.vo;
|
package com.fizz.business.vo;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fizz.business.constants.enums.RollerPositionEnum;
|
||||||
|
import com.fizz.business.constants.enums.RollerTypeEnum;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -13,10 +15,10 @@ public class OnlineRollDataVO {
|
|||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "类型")
|
@ApiModelProperty(value = "类型")
|
||||||
private String type;
|
private RollerTypeEnum type;
|
||||||
|
|
||||||
@ApiModelProperty(value = "位置")
|
@ApiModelProperty(value = "位置")
|
||||||
private String position;
|
private RollerPositionEnum position;
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "直径")
|
@ApiModelProperty(value = "直径")
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.fizz.business.vo;
|
package com.fizz.business.vo;
|
||||||
|
|
||||||
|
import com.fizz.business.constants.enums.RollerPositionEnum;
|
||||||
|
import com.fizz.business.constants.enums.RollerTypeEnum;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -9,10 +11,10 @@ public class ReadyRollDataVO {
|
|||||||
private String rollid;
|
private String rollid;
|
||||||
|
|
||||||
@ApiModelProperty(value = "类型")
|
@ApiModelProperty(value = "类型")
|
||||||
private String type;
|
private RollerTypeEnum type;
|
||||||
|
|
||||||
@ApiModelProperty(value = "位置")
|
@ApiModelProperty(value = "位置")
|
||||||
private String position;
|
private RollerPositionEnum position;
|
||||||
|
|
||||||
@ApiModelProperty(value = "直径")
|
@ApiModelProperty(value = "直径")
|
||||||
private Double diameter;
|
private Double diameter;
|
||||||
|
|||||||
@@ -1,24 +1,9 @@
|
|||||||
Application Version: ${ruoyi.version}
|
Application Version: ${ruoyi.version}
|
||||||
Spring Boot Version: ${spring-boot.version}
|
Spring Boot Version: ${spring-boot.version}
|
||||||
////////////////////////////////////////////////////////////////////
|
________ ___ ________ ________
|
||||||
// _ooOoo_ //
|
|\ _____\|\ \ |\_____ \ |\_____ \
|
||||||
// o8888888o //
|
\ \ \__/ \ \ \ \|___/ /| \|___/ /|
|
||||||
// 88" . "88 //
|
\ \ __\ \ \ \ / / / / / /
|
||||||
// (| ^_^ |) //
|
\ \ \_| \ \ \ / /_/__ / /_/__
|
||||||
// O\ = /O //
|
\ \__\ \ \__\|\________\|\________\
|
||||||
// ____/`---'\____ //
|
\|__| \|__| \|_______| \|_______|
|
||||||
// .' \\| |// `. //
|
|
||||||
// / \\||| : |||// \ //
|
|
||||||
// / _||||| -:- |||||- \ //
|
|
||||||
// | | \\\ - /// | | //
|
|
||||||
// | \_| ''\---/'' | | //
|
|
||||||
// \ .-\__ `-` ___/-. / //
|
|
||||||
// ___`. .' /--.--\ `. . ___ //
|
|
||||||
// ."" '< `.___\_<|>_/___.' >'"". //
|
|
||||||
// | | : `- \`.;`\ _ /`;.`/ - ` : | | //
|
|
||||||
// \ \ `-. \_ __\ /__ _/ .-` / / //
|
|
||||||
// ========`-.____`-.___\_____/___.-`____.-'======== //
|
|
||||||
// `=---=' //
|
|
||||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
|
|
||||||
// 佛祖保佑 永不宕机 永无BUG //
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
Reference in New Issue
Block a user