代码优化

master
lulicheng 9 months ago
parent 0712da04ed
commit 3aa4196399

@ -91,7 +91,6 @@
<version>${spring-boot.version}</version>
<configuration>
<mainClass>com.ipsplm.CoscoShippingHeavyApplication</mainClass>
<skip>true</skip>
</configuration>
<executions>
<execution>

@ -6,7 +6,7 @@ import com.ipsplm.service.simulation.ISimulationAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.math.BigInteger;
/**
* @Description 仿Controller
@ -31,57 +31,13 @@ public class SimulationAnalysisController {
}
/**
* OEE
* @return
*/
@GetMapping("/get-oee-bxg")
public ResponseDTO getOeeBxg(){
return ResponseDTO.ok(simulationAnalysisService.getOeeBxg());
}
/**
* 线OEE
* @return
*/
@GetMapping("/get-oee-dj")
public ResponseDTO getOeeDj(){
return ResponseDTO.ok(simulationAnalysisService.getOeeDj());
}
/**
* 线OEE
* @return
*/
@GetMapping("/get-oee-xe")
public ResponseDTO getOeeXe(){
return ResponseDTO.ok(simulationAnalysisService.getOeeXe());
}
/**
* 线OEE
* @return
*/
@GetMapping("/get-oee-xy")
public ResponseDTO getOeeXy(){
return ResponseDTO.ok(simulationAnalysisService.getOeeXy());
}
/**
* 线OEE
* @return
*/
@GetMapping("/get-oee-ze")
public ResponseDTO getOeeZe(){
return ResponseDTO.ok(simulationAnalysisService.getOeeZe());
}
/**
* 线OEE
* OEE
* @param tableCode
* @return
*/
@GetMapping("/get-oee-zy")
public ResponseDTO getOeeZy(){
return ResponseDTO.ok(simulationAnalysisService.getOeeZy());
@GetMapping("/get-oee")
public ResponseDTO getOee(@RequestParam String tableCode){
return ResponseDTO.ok(simulationAnalysisService.getOee(tableCode));
}
/**

@ -4,6 +4,7 @@ import com.ipsplm.entity.simulation.*;
import com.ipsplm.entity.simulation.vo.BufferVO;
import com.ipsplm.entity.simulation.vo.PlantEquipmentUtilizationVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -20,7 +21,7 @@ public interface SimulationAnalysisMapper {
* @param flag
* @return
*/
PlantEquipmentUtilizationVO getPlantEquipmentUtilization(Long flag);
List<PlantEquipmentUtilizationVO> getPlantEquipmentUtilization(Long flag);
/**
* OEE
@ -77,7 +78,7 @@ public interface SimulationAnalysisMapper {
* @param bufferNameList
* @return
*/
List<BufferNumBxg> getBufferNumBxg(List<BufferVO> bufferNameList);
List<BufferNumBxg> getBufferNumBxg(@Param("bufferNameList") List<BufferVO> bufferNameList);
/**
* 线

@ -3,6 +3,8 @@ package com.ipsplm.entity.simulation;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -36,81 +38,81 @@ public class OeeBxg implements Serializable {
/**
*
*/
private String status;
private Integer status;
/**
* 线
*/
private String bxgPkL;
private Double bxgPkL;
/**
* 线
*/
private String bxgZpL;
private Double bxgZpL;
/**
* 线
*/
private String bxgHjL;
private Double bxgHjL;
/**
* 线
*/
private String bxgWgj;
private Double bxgWgj;
/**
* 线
*/
private String bxgZgqd;
private Double bxgZgqd;
/**
* 线
*/
private String bxgXzl;
private Double bxgXzl;
/**
* 线
*/
private String bxgWthj;
private Double bxgWthj;
/**
* 线1
*/
private String bxgZppt1;
private Double bxgZppt1;
/**
* 线2
*/
private String bxgZppt2;
private Double bxgZppt2;
/**
* 线1
*/
private String bxgHjgw1;
private Double bxgHjgw1;
/**
* 线2
*/
private String bxgHjgw2;
private Double bxgHjgw2;
/**
* 线3
*/
private String bxgHjgw3;
private Double bxgHjgw3;
/**
* 线
*/
private String bxgYcwj;
private Double bxgYcwj;
/**
* 线
*/
private String bxgSs;
private Double bxgSs;
/**
*
*/
private String ts;
private Double ts;
}

@ -36,96 +36,96 @@ public class OeeDj implements Serializable {
/**
*
*/
private String status;
private Integer status;
/**
* 线线
*/
private String djJgqgL;
private Double djJgqgL;
/**
* 线线
*/
private String djZpL;
private Double djZpL;
/**
* 线线
*/
private String djHjL;
private Double djHjL;
/**
* 线线
*/
private String djDghjL;
private Double djDghjL;
/**
* 线线
*/
private String djXzl;
private Double djXzl;
/**
* 线线
*/
private String djWthjj;
private Double djWthjj;
/**
* 线
*/
private String djZgqd;
private Double djZgqd;
/**
* 线1
*/
private String djZppt1;
private Double djZppt1;
/**
* 线2
*/
private String djZppt2;
private Double djZppt2;
/**
* 线3
*/
private String djZppt3;
private Double djZppt3;
/**
* 线1
*/
private String djHjgw1;
private Double djHjgw1;
/**
* 线2
*/
private String djHjgw2;
private Double djHjgw2;
/**
* 线3
*/
private String djHjgw3;
private Double djHjgw3;
/**
* 线4
*/
private String djHjgw4;
private Double djHjgw4;
/**
* 线5
*/
private String djHjgw5;
private Double djHjgw5;
/**
* 线6
*/
private String djHjgw6;
private Double djHjgw6;
/**
* 线
*/
private String djYcwj;
private Double djYcwj;
/**
* 线
*/
private String djSs;
private Double djSs;
}

@ -36,101 +36,101 @@ public class OeeXe implements Serializable {
/**
*
*/
private String status;
private Integer status;
/**
* 线线
*/
private String xePkL;
private Double xePkL;
/**
* 线线
*/
private String xeZpL;
private Double xeZpL;
/**
* 线线
*/
private String xeHjL;
private Double xeHjL;
/**
* 线1
*/
private String xeWgj1;
private Double xeWgj1;
/**
* 线2
*/
private String xeWgj2;
private Double xeWgj2;
/**
* 线
*/
private String xeZgqd;
private Double xeZgqd;
/**
* 线1
*/
private String xeZppt1;
private Double xeZppt1;
/**
* 线2
*/
private String xeZppt2;
private Double xeZppt2;
/**
* 线3
*/
private String xeZppt3;
private Double xeZppt3;
/**
* 线4
*/
private String xeZppt4;
private Double xeZppt4;
/**
* 线5
*/
private String xeZppt5;
private Double xeZppt5;
/**
* 线1
*/
private String xeHjgw1;
private Double xeHjgw1;
/**
* 线2
*/
private String xeHjgw2;
private Double xeHjgw2;
/**
* 线3
*/
private String xeHjgw3;
private Double xeHjgw3;
/**
* 线4
*/
private String xeHjgw4;
private Double xeHjgw4;
/**
* 线5
*/
private String xeHjgw5;
private Double xeHjgw5;
/**
* 线
*/
private String xeYcwj;
private Double xeYcwj;
/**
* 线
*/
private String xeSs;
private Double xeSs;
/**
*
*/
private String jjg;
private Double jjg;
}

@ -36,86 +36,86 @@ public class OeeXy implements Serializable {
/**
*
*/
private String status;
private Integer status;
/**
* 线线
*/
private String xyPkL;
private Double xyPkL;
/**
* 线线1
*/
private String xyZp1L;
private Double xyZp1L;
/**
* 线线1
*/
private String xyHj1L;
private Double xyHj1L;
/**
* 线线2
*/
private String xyHj2L;
private Double xyHj2L;
/**
* 线
*/
private String xyWgj;
private Double xyWgj;
/**
* 线
*/
private String xyZgqd;
private Double xyZgqd;
/**
* 线1
*/
private String xyZppt1;
private Double xyZppt1;
/**
* 线2
*/
private String xyZppt2;
private Double xyZppt2;
/**
* 线3
*/
private String xyZppt3;
private Double xyZppt3;
/**
* 线4
*/
private String xyZppt4;
private Double xyZppt4;
/**
* 线1
*/
private String xyHjgw1;
private Double xyHjgw1;
/**
* 线2
*/
private String xyHjgw2;
private Double xyHjgw2;
/**
* 线3
*/
private String xyHjgw3;
private Double xyHjgw3;
/**
* 线4
*/
private String xyHjgw4;
private Double xyHjgw4;
/**
* 线
*/
private String xyYcwj;
private Double xyYcwj;
/**
* 线
*/
private String xySs;
private Double xySs;
}

@ -36,121 +36,121 @@ public class OeeZe implements Serializable {
/**
*
*/
private String status;
private Integer status;
/**
* 线线
*/
private String zeJgqgL;
private Double zeJgqgL;
/**
* 线线
*/
private String zeZpL;
private Double zeZpL;
/**
* 线线
*/
private String zeHjL;
private Double zeHjL;
/**
* 线线
*/
private String zeDghjL;
private Double zeDghjL;
/**
* 线线
*/
private String zeWgj;
private Double zeWgj;
/**
* 线
*/
private String zeZgqd;
private Double zeZgqd;
/**
* 线1
*/
private String zeXzl1;
private Double zeXzl1;
/**
* 线2
*/
private String zeXzl2;
private Double zeXzl2;
/**
* 线
*/
private String zeWthjj;
private Double zeWthjj;
/**
* 线1
*/
private String zeZppt1;
private Double zeZppt1;
/**
* 线2
*/
private String zeZppt2;
private Double zeZppt2;
/**
* 线3
*/
private String zeZppt3;
private Double zeZppt3;
/**
* 线4
*/
private String zeZppt4;
private Double zeZppt4;
/**
* 线1
*/
private String zeHjgw1;
private Double zeHjgw1;
/**
* 线2
*/
private String zeHjgw2;
private Double zeHjgw2;
/**
* 线3
*/
private String zeHjgw3;
private Double zeHjgw3;
/**
* 线4
*/
private String zeHjgw4;
private Double zeHjgw4;
/**
* 线5
*/
private String zeHjgw5;
private Double zeHjgw5;
/**
* 线6
*/
private String zeHjgw6;
private Double zeHjgw6;
/**
* 线7
*/
private String zeHjgw7;
private Double zeHjgw7;
/**
* 线8
*/
private String zeHjgw8;
private Double zeHjgw8;
/**
* 线
*/
private String zeYcwj;
private Double zeYcwj;
/**
* 线
*/
private String zeSs;
private Double zeSs;
}

@ -36,116 +36,116 @@ public class OeeZy implements Serializable {
/**
*
*/
private String status;
private Integer status;
/**
* 线线
*/
private String zyPkL;
private Double zyPkL;
/**
* 线线
*/
private String zyZpL;
private Double zyZpL;
/**
* 线线
*/
private String zyHjL;
private Double zyHjL;
/**
* 线线
*/
private String zyDghjL;
private Double zyDghjL;
/**
* 线1
*/
private String zyWgj1;
private Double zyWgj1;
/**
* 线2
*/
private String zyWgj2;
private Double zyWgj2;
/**
* 线
*/
private String zyXzl;
private Double zyXzl;
/**
* 线
*/
private String zyWthjj;
private Double zyWthjj;
/**
* 线1
*/
private String zyZppt1;
private Double zyZppt1;
/**
* 线2
*/
private String zyZppt2;
private Double zyZppt2;
/**
* 线3
*/
private String zyZppt3;
private Double zyZppt3;
/**
* 线4
*/
private String zyZppt4;
private Double zyZppt4;
/**
* 线5
*/
private String zyZppt5;
private Double zyZppt5;
/**
* 线1
*/
private String zyHjgw1;
private Double zyHjgw1;
/**
* 线2
*/
private String zyHjgw2;
private Double zyHjgw2;
/**
* 线3
*/
private String zyHjgw3;
private Double zyHjgw3;
/**
* 线4
*/
private String zyHjgw4;
private Double zyHjgw4;
/**
* 线5
*/
private String zyHjgw5;
private Double zyHjgw5;
/**
* 线6
*/
private String zyHjgw6;
private Double zyHjgw6;
/**
* 线7
*/
private String zyHjgw7;
private Double zyHjgw7;
/**
* 线
*/
private String zyYcwj;
private Double zyYcwj;
/**
* 线
*/
private String zySs;
private Double zySs;
}

@ -0,0 +1,13 @@
package com.ipsplm.entity.simulation.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class OeeVO implements Serializable {
private String name;
private Object value;
private Object status;
}

@ -13,83 +13,87 @@ import java.io.Serializable;
public class PlantEquipmentUtilizationVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
private Integer status;
/**
* 线
*/
private String bxgZpL;
private Double bxgZpL;
/**
* 线
*/
private String bxgHjL;
private Double bxgHjL;
/**
* 线线1
*/
private String xyZp1L;
private Double xyZp1L;
/**
* 线线1
*/
private String xyHj1L;
private Double xyHj1L;
/**
* 线线2
*/
private String xyHj2L;
private Double xyHj2L;
/**
* 线线
*/
private String xeZpL;
private Double xeZpL;
/**
* 线线
*/
private String xeHjL;
private Double xeHjL;
/**
* 线线
*/
private String zyZpL;
private Double zyZpL;
/**
* 线线
*/
private String zyHjL;
private Double zyHjL;
/**
* 线线
*/
private String zyDghjL;
private Double zyDghjL;
/**
* 线线
*/
private String zeZpL;
private Double zeZpL;
/**
* 线线
*/
private String zeHjL;
private Double zeHjL;
/**
* 线线
*/
private String zeDghjL;
private Double zeDghjL;
/**
* 线线
*/
private String djZpL;
private Double djZpL;
/**
* 线线
*/
private String djHjL;
private Double djHjL;
/**
* 线线
*/
private String djDghjL;
private Double djDghjL;
}

@ -1,6 +1,7 @@
package com.ipsplm.service.simulation;
import com.ipsplm.entity.simulation.*;
import com.ipsplm.entity.simulation.vo.OeeVO;
import com.ipsplm.entity.simulation.vo.PlantEquipmentUtilizationVO;
import java.util.List;
@ -14,46 +15,11 @@ import java.util.List;
public interface ISimulationAnalysisService {
/**
*
*
* @param flag
* @return
*/
PlantEquipmentUtilizationVO getPlantEquipmentUtilization(Long flag);
/**
* OEE
* @return
*/
List<OeeBxg> getOeeBxg();
/**
* 线OEE
* @return
*/
List<OeeDj> getOeeDj();
/**
* 线OEE
* @return
*/
List<OeeXe> getOeeXe();
/**
* 线OEE
* @return
*/
List<OeeXy> getOeeXy();
/**
* 线OEE
* @return
*/
List<OeeZe> getOeeZe();
/**
* 线OEE
* @return
*/
List<OeeZy> getOeeZy();
List<OeeVO> getPlantEquipmentUtilization(Long flag);
/**
*
@ -68,4 +34,11 @@ public interface ISimulationAnalysisService {
* @return
*/
Object getBufferNum(String process);
/**
* OEE
* @param tableCode
* @return
*/
Object getOee(String tableCode);
}

@ -1,16 +1,19 @@
package com.ipsplm.service.simulation.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ipsplm.dao.simulation.SimulationAnalysisMapper;
import com.ipsplm.entity.simulation.*;
import com.ipsplm.entity.simulation.vo.BufferNumVO;
import com.ipsplm.entity.simulation.vo.BufferVO;
import com.ipsplm.entity.simulation.vo.OeeVO;
import com.ipsplm.entity.simulation.vo.PlantEquipmentUtilizationVO;
import com.ipsplm.service.simulation.ISimulationAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @Description 仿
@ -30,68 +33,10 @@ public class SimulationAnalysisServiceImpl implements ISimulationAnalysisService
* @return
*/
@Override
public PlantEquipmentUtilizationVO getPlantEquipmentUtilization(Long flag) {
return simulationAnalysisMapper.getPlantEquipmentUtilization(flag);
}
/**
* OEE
*
* @return
*/
@Override
public List<OeeBxg> getOeeBxg() {
return simulationAnalysisMapper.getOeeBxg();
}
/**
* 线OEE
*
* @return
*/
@Override
public List<OeeDj> getOeeDj() {
return simulationAnalysisMapper.getOeeDj();
}
/**
* 线OEE
*
* @return
*/
@Override
public List<OeeXe> getOeeXe() {
return simulationAnalysisMapper.getOeeXe();
}
/**
* 线OEE
*
* @return
*/
@Override
public List<OeeXy> getOeeXy() {
return simulationAnalysisMapper.getOeeXy();
}
/**
* 线OEE
*
* @return
*/
@Override
public List<OeeZe> getOeeZe() {
return simulationAnalysisMapper.getOeeZe();
}
/**
* 线OEE
*
* @return
*/
@Override
public List<OeeZy> getOeeZy() {
return simulationAnalysisMapper.getOeeZy();
public List<OeeVO> getPlantEquipmentUtilization(Long flag) {
List<PlantEquipmentUtilizationVO> plantEquipmentUtilization = simulationAnalysisMapper.getPlantEquipmentUtilization(flag);
List<OeeVO> oeeVOList = beanToKeyValue(plantEquipmentUtilization);
return oeeVOList;
}
/**
@ -107,6 +52,7 @@ public class SimulationAnalysisServiceImpl implements ISimulationAnalysisService
/**
*
*
* @param process
* @return
*/
@ -144,4 +90,75 @@ public class SimulationAnalysisServiceImpl implements ISimulationAnalysisService
}
return null;
}
/**
* OEE
*
* @param tableCode
* @return
*/
@Override
public Object getOee(String tableCode) {
switch (tableCode) {
case "oee_bxg": {
List<OeeBxg> oeeBxgList = simulationAnalysisMapper.getOeeBxg();
List<OeeVO> oeeVOList = beanToKeyValue(oeeBxgList);
return oeeVOList;
}
case "oee_dj": {
List<OeeDj> oeeDjList = simulationAnalysisMapper.getOeeDj();
List<OeeVO> oeeVOList = beanToKeyValue(oeeDjList);
return oeeVOList;
}
case "oee_xe": {
List<OeeXe> oeeXeList = simulationAnalysisMapper.getOeeXe();
List<OeeVO> oeeVOList = beanToKeyValue(oeeXeList);
return oeeVOList;
}
case "oee_xy": {
List<OeeXy> oeeXyList = simulationAnalysisMapper.getOeeXy();
List<OeeVO> oeeVOList = beanToKeyValue(oeeXyList);
return oeeVOList;
}
case "oee_ze": {
List<OeeZe> oeeZeList = simulationAnalysisMapper.getOeeZe();
List<OeeVO> oeeVOList = beanToKeyValue(oeeZeList);
return oeeVOList;
}
case "oee_zy": {
List<OeeZy> oeeZyList = simulationAnalysisMapper.getOeeZy();
List<OeeVO> oeeVOList = beanToKeyValue(oeeZyList);
return oeeVOList;
}
default:
break;
}
return null;
}
/**
* OeeVO
* @param oeeList
* @return
*/
public List<OeeVO> beanToKeyValue(List oeeList) {
List<OeeVO> oeeVOList = new ArrayList<>();
for (Object object : oeeList) {
JSONObject jsonObject = (JSONObject) JSON.toJSON(object);
Object status = jsonObject.get("status");
for (Map.Entry<String, Object> entry : jsonObject.entrySet()) {
OeeVO oeeVO = new OeeVO();
Object value = entry.getValue();
String key = entry.getKey();
if ("flag".equals(key) || "id".equals(key) || "status".equals(key)) {
continue;
}
oeeVO.setName(key);
oeeVO.setValue(value);
oeeVO.setStatus(status);
oeeVOList.add(oeeVO);
}
}
return oeeVOList;
}
}

@ -25,3 +25,7 @@ plant:
socket:
ip:
port:
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

@ -6,7 +6,10 @@
<!-- 获取厂房设备利用率信息-->
<select id="getPlantEquipmentUtilization"
resultType="com.ipsplm.entity.simulation.vo.PlantEquipmentUtilizationVO">
select bxg.bxg_zp_l,
SELECT
bxg.flag,
bxg.`status`,
bxg.bxg_zp_l,
bxg.bxg_hj_l,
xy.xy_zp1_l,
xy.xy_hj1_l,
@ -22,52 +25,53 @@
dj.dj_zp_l,
dj.dj_hj_l,
dj.dj_dghj_l
from oee_bxg bxg
inner join oee_dj dj on bxg.flag = dj.flag
inner join oee_xe xe on bxg.flag = xe.flag
inner join oee_ze ze on bxg.flag = ze.flag
inner join oee_zy zy on bxg.flag = zy.flag
inner join oee_xy xy on bxg.flag = xy.flag
FROM
oee_bxg bxg
inner JOIN oee_dj dj ON bxg.flag = dj.flag and bxg.`status` = dj.`status`
inner JOIN oee_xe xe ON bxg.flag = xe.flag and bxg.`status` = xe.`status`
INNER JOIN oee_ze ze ON bxg.flag = ze.flag and bxg.`status` = ze.`status`
INNER JOIN oee_zy zy ON bxg.flag = zy.flag and bxg.`status` = zy.`status`
INNER JOIN oee_xy xy ON bxg.flag = xy.flag and bxg.`status` = xy.`status`
<if test="flag != null and flag != ''">
where bxg.flag = #{flag}
</if>
limit 1
order by flag desc , status limit 9
</select>
<!-- 获取不锈钢OEE-->
<select id="getOeeBxg" resultType="com.ipsplm.entity.simulation.OeeBxg">
select *
from oee_bxg
order by id desc limit 9
order by flag desc , status limit 9
</select>
<!-- 获取大径线OEE-->
<select id="getOeeDj" resultType="com.ipsplm.entity.simulation.OeeDj">
select *
from oee_dj
order by id desc limit 9
order by flag desc , status limit 9
</select>
<!-- 获取小二线OEE-->
<select id="getOeeXe" resultType="com.ipsplm.entity.simulation.OeeXe">
select *
from oee_xe
order by id desc limit 9
order by flag desc , status limit 9
</select>
<!-- 获取小一线OEE-->
<select id="getOeeXy" resultType="com.ipsplm.entity.simulation.OeeXy">
select *
from oee_xy
order by id desc limit 9
order by flag desc , status limit 9
</select>
<!-- 获取中二线OEE-->
<select id="getOeeZe" resultType="com.ipsplm.entity.simulation.OeeZe">
select *
from oee_ze
order by id desc limit 9
order by flag desc , status limit 9
</select>
<!-- 获取中一线OEE-->
<select id="getOeeZy" resultType="com.ipsplm.entity.simulation.OeeZy">
select *
from oee_zy
order by id desc limit 9
order by flag desc , status limit 9
</select>
<!-- 获取工序列表-->
<select id="getProcessList" resultType="java.lang.String">
@ -75,7 +79,7 @@
</select>
<!-- 获取缓存信息-->
<select id="getBufferName" resultType="com.ipsplm.entity.simulation.vo.BufferVO">
select table_code,buffer,buffer_des from process_buffer where process_des = #{process}
select table_code,buffer as bufferCode ,buffer_des as bufferName from process_buffer where process_des = #{process}
</select>
<!-- 获取不锈钢缓存数量-->
<select id="getBufferNumBxg" resultType="com.ipsplm.entity.simulation.BufferNumBxg">

Loading…
Cancel
Save