fix():轧辊配辊接口
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package com.fizz.business.controller;
|
package com.fizz.business.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.fizz.business.domain.CrmPdiPlan;
|
import com.fizz.business.domain.CrmPdiPlan;
|
||||||
import com.fizz.business.domain.RollData;
|
import com.fizz.business.domain.RollData;
|
||||||
import com.fizz.business.domain.RollHistory;
|
import com.fizz.business.domain.RollHistory;
|
||||||
@@ -8,6 +9,7 @@ import com.fizz.business.service.RollDataService;
|
|||||||
import com.fizz.business.service.RollHistoryService;
|
import com.fizz.business.service.RollHistoryService;
|
||||||
import com.fizz.business.vo.OnlineRollDataVO;
|
import com.fizz.business.vo.OnlineRollDataVO;
|
||||||
import com.fizz.business.vo.ReadyRollDataVO;
|
import com.fizz.business.vo.ReadyRollDataVO;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.ruoyi.common.annotation.Anonymous;
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.domain.R;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@@ -16,6 +18,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/roller")
|
@RequestMapping("/roller")
|
||||||
@@ -30,8 +33,8 @@ public class RollerController {
|
|||||||
|
|
||||||
@GetMapping("/data/standby")
|
@GetMapping("/data/standby")
|
||||||
@ApiOperation("轧辊数据-获取当前备辊信息")
|
@ApiOperation("轧辊数据-获取当前备辊信息")
|
||||||
public R<List<ReadyRollDataVO> > getReadyRollList() {
|
public R<Map<String,ReadyRollDataVO>> getReadyRollList() {
|
||||||
return R.ok(rollDataService.getReadyRollList(null,null,"STANDBY"));
|
return R.ok(rollDataService.getAllReadyRollList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/data/ready/{position}/{type}")
|
@GetMapping("/data/ready/{position}/{type}")
|
||||||
@@ -48,8 +51,14 @@ public class RollerController {
|
|||||||
|
|
||||||
@PostMapping("/change/standby")
|
@PostMapping("/change/standby")
|
||||||
@ApiOperation("轧辊操作-备辊")
|
@ApiOperation("轧辊操作-备辊")
|
||||||
public R<List<String>> backupRoll(@RequestBody List<ReadyRollDataVO> rollList) {
|
public R<String> backupRoll(@RequestBody List<ReadyRollDataVO> rollList) {
|
||||||
return R.ok(rollDataService.BackupRoll(rollList));
|
String msg = rollDataService.BackupRoll(rollList);
|
||||||
|
if(ObjectUtil.isEmpty(msg)){
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return R.fail(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/change/online")
|
@PostMapping("/change/online")
|
||||||
@@ -70,9 +79,9 @@ public class RollerController {
|
|||||||
return R.ok(rollHistoryService.getRollIdList());
|
return R.ok(rollHistoryService.getRollIdList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/history/list")
|
@PostMapping("/history/list")
|
||||||
@ApiOperation("轧辊历史-获取换辊记录")
|
@ApiOperation("轧辊历史-获取换辊记录")
|
||||||
public R<List<RollHistory>> getRollHistorytList(@RequestBody RollHistoryForm rollHistoryForm) {
|
public R<PageInfo<RollHistory>> getRollHistorytList(@RequestBody RollHistoryForm rollHistoryForm) {
|
||||||
return R.ok(rollHistoryService.getRollHistory(rollHistoryForm));
|
return R.ok(rollHistoryService.getRollHistory(rollHistoryForm));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,4 +21,8 @@ public class RollHistoryForm {
|
|||||||
|
|
||||||
@ApiModelProperty(value = "轧辊号")
|
@ApiModelProperty(value = "轧辊号")
|
||||||
private String rollid;
|
private String rollid;
|
||||||
|
|
||||||
|
private int pageNum;
|
||||||
|
|
||||||
|
private int pageSize;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,15 +6,18 @@ import com.fizz.business.vo.OnlineRollDataVO;
|
|||||||
import com.fizz.business.vo.ReadyRollDataVO;
|
import com.fizz.business.vo.ReadyRollDataVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface RollDataService extends IService<RollData> {
|
public interface RollDataService extends IService<RollData> {
|
||||||
List<RollData> getList(String position,String type,String status);
|
List<RollData> getList(String position,String type,String status);
|
||||||
|
|
||||||
List<ReadyRollDataVO> getReadyRollList(String position,String type,String status);
|
List<ReadyRollDataVO> getReadyRollList(String position,String type,String status);
|
||||||
|
|
||||||
|
Map<String,ReadyRollDataVO> getAllReadyRollList();
|
||||||
|
|
||||||
List<OnlineRollDataVO> getOnlineRollList();
|
List<OnlineRollDataVO> getOnlineRollList();
|
||||||
|
|
||||||
List<String> BackupRoll(List<ReadyRollDataVO> rollList);
|
String BackupRoll(List<ReadyRollDataVO> rollList);
|
||||||
|
|
||||||
List<OnlineRollDataVO> onlineRoll();
|
List<OnlineRollDataVO> onlineRoll();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.fizz.business.service;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.fizz.business.domain.RollHistory;
|
import com.fizz.business.domain.RollHistory;
|
||||||
import com.fizz.business.form.RollHistoryForm;
|
import com.fizz.business.form.RollHistoryForm;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -11,5 +12,5 @@ public interface RollHistoryService extends IService<RollHistory> {
|
|||||||
|
|
||||||
List<String> getRollIdList();
|
List<String> getRollIdList();
|
||||||
|
|
||||||
List<RollHistory> getRollHistory(RollHistoryForm rollHistoryForm);
|
PageInfo<RollHistory> getRollHistory(RollHistoryForm rollHistoryForm);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,6 +76,25 @@ public class RollDataServiceImpl extends ServiceImpl<RollDataMapper, RollData> i
|
|||||||
return readyRollDataVOList;
|
return readyRollDataVOList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String,ReadyRollDataVO> getAllReadyRollList() {
|
||||||
|
List<ReadyRollDataVO> readyRollDataVOList = new ArrayList<>();
|
||||||
|
List<RollData> rollDataList = getList(null,null,"STANDBY");
|
||||||
|
for (RollData rollData : rollDataList) {
|
||||||
|
ReadyRollDataVO readyRollDataVO = new ReadyRollDataVO();
|
||||||
|
// 使用 BeanUtils 复制属性
|
||||||
|
BeanUtils.copyProperties(rollData, readyRollDataVO);
|
||||||
|
readyRollDataVO.setPosition(RollerPositionEnum.valueOf(rollData.getPosition()));
|
||||||
|
readyRollDataVO.setType(RollerTypeEnum.valueOf(rollData.getType()));
|
||||||
|
readyRollDataVOList.add(readyRollDataVO);
|
||||||
|
}
|
||||||
|
//补充6个位置
|
||||||
|
return readyRollDataVOList.stream()
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
ReadyRollDataVO->ReadyRollDataVO.getPosition().getValue()+ReadyRollDataVO.getType().getValue()
|
||||||
|
, obj -> obj,(key1, key2)->key1));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<OnlineRollDataVO> getOnlineRollList() {
|
public List<OnlineRollDataVO> getOnlineRollList() {
|
||||||
Map<String, PlantConfig> plantConfigMap = plantConfigService.getAllConfig();
|
Map<String, PlantConfig> plantConfigMap = plantConfigService.getAllConfig();
|
||||||
@@ -124,9 +143,9 @@ public class RollDataServiceImpl extends ServiceImpl<RollDataMapper, RollData> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> BackupRoll(List<ReadyRollDataVO> rollList) {
|
public String BackupRoll(List<ReadyRollDataVO> rollList) {
|
||||||
if(ObjectUtil.isEmpty(rollList)){
|
if(ObjectUtil.isEmpty(rollList)){
|
||||||
return Arrays.asList("轧辊数量为空,无法备辊");
|
return "轧辊数量为空,无法备辊";
|
||||||
}
|
}
|
||||||
//统一检查所有轧辊状态
|
//统一检查所有轧辊状态
|
||||||
List<String> rollidList = rollList.stream()
|
List<String> rollidList = rollList.stream()
|
||||||
@@ -136,7 +155,7 @@ public class RollDataServiceImpl extends ServiceImpl<RollDataMapper, RollData> i
|
|||||||
|
|
||||||
if(rollDataList.stream()
|
if(rollDataList.stream()
|
||||||
.anyMatch(item->item.getStatus().equals("ONLINE"))){
|
.anyMatch(item->item.getStatus().equals("ONLINE"))){
|
||||||
return Arrays.asList("存在轧辊已在线,无法备辊");
|
return "存在轧辊已在线,无法备辊";
|
||||||
}
|
}
|
||||||
Map<String, PlantConfig> plantConfigMap = plantConfigService.getAllConfig();
|
Map<String, PlantConfig> plantConfigMap = plantConfigService.getAllConfig();
|
||||||
//检查是否成对
|
//检查是否成对
|
||||||
@@ -149,15 +168,15 @@ public class RollDataServiceImpl extends ServiceImpl<RollDataMapper, RollData> i
|
|||||||
checkRollDia( plantConfigMap,rollList,result,"BACKUP");
|
checkRollDia( plantConfigMap,rollList,result,"BACKUP");
|
||||||
|
|
||||||
//清楚所有已有备辊,添加新备辊,有则更新数据,没有则新增
|
//清楚所有已有备辊,添加新备辊,有则更新数据,没有则新增
|
||||||
if(ObjectUtil.isEmpty(result)){
|
if(ObjectUtil.isEmpty(result)) {
|
||||||
lambdaUpdate().set(RollData::getStatus,"OFFLINE")
|
lambdaUpdate().set(RollData::getStatus, "OFFLINE")
|
||||||
.eq(RollData::getStatus,"STANDBY")
|
.eq(RollData::getStatus, "STANDBY")
|
||||||
.update();
|
.update();
|
||||||
|
|
||||||
List<RollData> newDataList = Lists.newArrayList();
|
List<RollData> newDataList = Lists.newArrayList();
|
||||||
rollList.forEach(item->{
|
rollList.forEach(item -> {
|
||||||
|
|
||||||
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().getValue())
|
.position(item.getPosition().getValue())
|
||||||
@@ -176,7 +195,7 @@ public class RollDataServiceImpl extends ServiceImpl<RollDataMapper, RollData> i
|
|||||||
this.saveOrUpdateBatch(newDataList);
|
this.saveOrUpdateBatch(newDataList);
|
||||||
|
|
||||||
}
|
}
|
||||||
return result;
|
return String.join(",",result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -248,13 +267,13 @@ public class RollDataServiceImpl extends ServiceImpl<RollDataMapper, RollData> i
|
|||||||
maxValueKey = "MAX_BR_DIA";
|
maxValueKey = "MAX_BR_DIA";
|
||||||
minValueKey = "MIN_BR_DIA";
|
minValueKey = "MIN_BR_DIA";
|
||||||
diffValueKey = "MAX_BR_DIA_DIFF";
|
diffValueKey = "MAX_BR_DIA_DIFF";
|
||||||
name = "工作辊";
|
name = "支撑辊";
|
||||||
break;
|
break;
|
||||||
case "INTERMEDIATE":
|
case "INTERMEDIATE":
|
||||||
maxValueKey = "MAX_IR_DIA";
|
maxValueKey = "MAX_IR_DIA";
|
||||||
minValueKey = "MIN_IR_DIA";
|
minValueKey = "MIN_IR_DIA";
|
||||||
diffValueKey = "MAX_IR_DIA_DIFF";
|
diffValueKey = "MAX_IR_DIA_DIFF";
|
||||||
name = "工作辊";
|
name = "中间辊";
|
||||||
break;
|
break;
|
||||||
case "WORK":
|
case "WORK":
|
||||||
maxValueKey = "MAX_WR_DIA";
|
maxValueKey = "MAX_WR_DIA";
|
||||||
@@ -265,7 +284,7 @@ public class RollDataServiceImpl extends ServiceImpl<RollDataMapper, RollData> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<ReadyRollDataVO> rolls = rollList.stream()
|
List<ReadyRollDataVO> rolls = rollList.stream()
|
||||||
.filter(item->item.getType().equals(type))
|
.filter(item->item.getType().getValue().equals(type)&&ObjectUtil.isNotEmpty(item.getRollid()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
if(rolls.size()>0){
|
if(rolls.size()>0){
|
||||||
//工作辊成对更换
|
//工作辊成对更换
|
||||||
@@ -273,11 +292,11 @@ public class RollDataServiceImpl extends ServiceImpl<RollDataMapper, RollData> i
|
|||||||
double rollDia2;
|
double rollDia2;
|
||||||
if(type.equals("WORK")||type.equals("INTERMEDIATE")) {
|
if(type.equals("WORK")||type.equals("INTERMEDIATE")) {
|
||||||
if (rolls.size() != 2) {
|
if (rolls.size() != 2) {
|
||||||
result.add(String.format("{0}必须成对更换", name));
|
result.add(String.format("%s必须成对更换", name));
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if (rolls.get(0).getPosition().equals(rolls.get(1).getPosition())) {
|
if (rolls.get(0).getPosition().equals(rolls.get(1).getPosition())) {
|
||||||
result.add(String.format("{0}备辊位置重复", name));
|
result.add(String.format("%s备辊位置重复", name));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rollDia1 = rolls.get(0).getDiameter();
|
rollDia1 = rolls.get(0).getDiameter();
|
||||||
@@ -286,13 +305,13 @@ public class RollDataServiceImpl extends ServiceImpl<RollDataMapper, RollData> i
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(rolls.size()>2){
|
if(rolls.size()>2){
|
||||||
result.add(String.format("{0}备辊数量错误",name));
|
result.add(String.format("%s备辊数量错误",name));
|
||||||
return;
|
return;
|
||||||
}else {
|
}else {
|
||||||
rollDia1 = rolls.get(0).getDiameter();
|
rollDia1 = rolls.get(0).getDiameter();
|
||||||
if(rolls.size()==2) {
|
if(rolls.size()==2) {
|
||||||
if (rolls.get(0).getPosition().equals(rolls.get(1).getPosition())) {
|
if (rolls.get(0).getPosition().equals(rolls.get(1).getPosition())) {
|
||||||
result.add(String.format("{0}备辊位置重复", name));
|
result.add(String.format("%s备辊位置重复", name));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rollDia2 = rolls.get(1).getDiameter();
|
rollDia2 = rolls.get(1).getDiameter();
|
||||||
@@ -311,21 +330,21 @@ public class RollDataServiceImpl extends ServiceImpl<RollDataMapper, RollData> i
|
|||||||
if(plantConfigMap.containsKey(maxValueKey)){
|
if(plantConfigMap.containsKey(maxValueKey)){
|
||||||
double value = Double.parseDouble(plantConfigMap.get(maxValueKey).getValue());
|
double value = Double.parseDouble(plantConfigMap.get(maxValueKey).getValue());
|
||||||
if(rollDia1>value||rollDia2>value){
|
if(rollDia1>value||rollDia2>value){
|
||||||
result.add(String.format("{0}径超限[max:{1}]",name,value));
|
result.add(String.format("%s辊径超限[max:{1}]",name,value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//最小值
|
//最小值
|
||||||
if(plantConfigMap.containsKey(minValueKey)){
|
if(plantConfigMap.containsKey(minValueKey)){
|
||||||
double value = Double.parseDouble(plantConfigMap.get(minValueKey).getValue());
|
double value = Double.parseDouble(plantConfigMap.get(minValueKey).getValue());
|
||||||
if(rollDia1<value||rollDia2<value){
|
if(rollDia1<value||rollDia2<value){
|
||||||
result.add(String.format("{0}径超限[min:{1}]",name,value));
|
result.add(String.format("%s辊径超限[min:{1}]",name,value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//差值
|
//差值
|
||||||
if(plantConfigMap.containsKey(diffValueKey)){
|
if(plantConfigMap.containsKey(diffValueKey)){
|
||||||
double value = Double.parseDouble(plantConfigMap.get(diffValueKey).getValue());
|
double value = Double.parseDouble(plantConfigMap.get(diffValueKey).getValue());
|
||||||
if(Math.abs(rollDia1-rollDia2)>value){
|
if(Math.abs(rollDia1-rollDia2)>value){
|
||||||
result.add(String.format("{0}径超限[diff:{1}]",name,value));
|
result.add(String.format("{%s辊径超限[diff:{1}]",name,value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import com.fizz.business.domain.RollHistory;
|
|||||||
import com.fizz.business.form.RollHistoryForm;
|
import com.fizz.business.form.RollHistoryForm;
|
||||||
import com.fizz.business.mapper.RollHistoryMapper;
|
import com.fizz.business.mapper.RollHistoryMapper;
|
||||||
import com.fizz.business.service.RollHistoryService;
|
import com.fizz.business.service.RollHistoryService;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -25,7 +27,11 @@ public class RollHistoryServiceImpl extends ServiceImpl<RollHistoryMapper, RollH
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<RollHistory> getRollHistory(RollHistoryForm rollHistoryForm) {
|
public PageInfo<RollHistory> getRollHistory(RollHistoryForm rollHistoryForm) {
|
||||||
|
|
||||||
|
// 调用分页查询方法,获取EventRecords的分页结果
|
||||||
|
PageHelper.startPage(rollHistoryForm.getPageNum(), rollHistoryForm.getPageSize());
|
||||||
|
|
||||||
LambdaQueryWrapper<RollHistory> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RollHistory> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
if(ObjectUtil.isNotEmpty(rollHistoryForm.getStartTime())){
|
if(ObjectUtil.isNotEmpty(rollHistoryForm.getStartTime())){
|
||||||
queryWrapper.ge(RollHistory::getChangeTime,rollHistoryForm.getStartTime());
|
queryWrapper.ge(RollHistory::getChangeTime,rollHistoryForm.getStartTime());
|
||||||
@@ -40,7 +46,11 @@ public class RollHistoryServiceImpl extends ServiceImpl<RollHistoryMapper, RollH
|
|||||||
queryWrapper.eq(RollHistory::getRollid,rollHistoryForm.getRollid());
|
queryWrapper.eq(RollHistory::getRollid,rollHistoryForm.getRollid());
|
||||||
}
|
}
|
||||||
queryWrapper.orderByDesc(RollHistory::getChangeTime);
|
queryWrapper.orderByDesc(RollHistory::getChangeTime);
|
||||||
return this.list(queryWrapper);
|
|
||||||
|
List<RollHistory> list = this.list(queryWrapper);
|
||||||
|
PageInfo<RollHistory> pageInfo = new PageInfo<>(list);
|
||||||
|
|
||||||
|
return pageInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<mapper namespace="com.fizz.business.mapper.RollHistoryMapper">
|
<mapper namespace="com.fizz.business.mapper.RollHistoryMapper">
|
||||||
<select id="getChangeIdList" resultType="String">
|
<select id="getChangeIdList" resultType="String">
|
||||||
select distinct change_id from roll_history
|
select distinct changeid from roll_history
|
||||||
</select>
|
</select>
|
||||||
<select id="getRollIdList" resultType="String">
|
<select id="getRollIdList" resultType="String">
|
||||||
select distinct rollid from roll_history
|
select distinct rollid from roll_history
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<mapper namespace="com.fizz.business.mapper.RollHistoryMapper">
|
<mapper namespace="com.fizz.business.mapper.RollHistoryMapper">
|
||||||
<select id="getChangeIdList" resultType="String">
|
<select id="getChangeIdList" resultType="String">
|
||||||
select distinct change_id from roll_history
|
select distinct changeid from roll_history
|
||||||
</select>
|
</select>
|
||||||
<select id="getRollIdList" resultType="String">
|
<select id="getRollIdList" resultType="String">
|
||||||
select distinct rollid from roll_history
|
select distinct rollid from roll_history
|
||||||
|
|||||||
Reference in New Issue
Block a user