| | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.jcdm.common.core.domain.R; |
| | | import com.jcdm.common.utils.StringUtils; |
| | | import com.jcdm.main.bs.orderScheduling.vo.LineChartVO; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ä¸çº¿æ°é |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('bs:orderScheduling:list')") |
| | | @GetMapping("/getOffLineNum") |
| | | public TableDataInfo getOffLineNum(BsOrderScheduling bsOrderScheduling) |
| | | { |
| | | |
| | | List<LineChartVO> vo = bsOrderSchedulingService.getOffLineNum(); |
| | | return getDataTable(vo); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('bs:orderScheduling:list')") |
| | | @GetMapping("/list2") |
| | | public TableDataInfo list2(BsOrderScheduling bsOrderScheduling) |
| | |
| | | |
| | | import java.util.List; |
| | | import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling; |
| | | import com.jcdm.main.bs.orderScheduling.vo.LineChartVO; |
| | | |
| | | /** |
| | | * 订åæ产Serviceæ¥å£ |
| | |
| | | * @return 订åæ产éå |
| | | */ |
| | | public List<BsOrderScheduling> selectBsOrderSchedulingList(BsOrderScheduling bsOrderScheduling); |
| | | public List<LineChartVO> getOffLineNum(); |
| | | |
| | | /** |
| | | * æ°å¢è®¢åæ产 |
| | |
| | | package com.jcdm.main.bs.orderScheduling.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.jcdm.common.utils.DateUtils; |
| | | import com.jcdm.common.utils.StringUtils; |
| | | import com.jcdm.main.bs.orderScheduling.Query.PrepareOnlineQuery; |
| | | import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling; |
| | | import com.jcdm.main.bs.orderScheduling.mapper.BsOrderSchedulingMapper; |
| | | import com.jcdm.main.bs.orderScheduling.service.IBsOrderSchedulingService; |
| | | import com.jcdm.main.bs.orderScheduling.vo.LineChartVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 订åæ产Serviceä¸å¡å±å¤ç |
| | |
| | | return bsOrderSchedulingMapper.selectBsOrderSchedulingList(bsOrderScheduling); |
| | | } |
| | | |
| | | @Override |
| | | public List<LineChartVO> getOffLineNum() |
| | | { |
| | | List<LineChartVO> result = new ArrayList<>(); |
| | | BsOrderScheduling bsOrderScheduling = new BsOrderScheduling(); |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalDateTime startTime = LocalDateTime.of(now.getYear(),now.getMonthValue(),now.getDayOfMonth(),8,0,0); |
| | | LocalDateTime endTime = LocalDateTime.of(now.getYear(),now.getMonthValue(),now.plusDays(1).getDayOfMonth(),22,0,0); |
| | | String s1 = startTime.format(formatter); |
| | | String s2 = endTime.format(formatter); |
| | | bsOrderScheduling.setStartTime(s1); |
| | | bsOrderScheduling.setEndTime(s2); |
| | | List<BsOrderScheduling> todayList = bsOrderSchedulingMapper.selectBsOrderSchedulingList(bsOrderScheduling); |
| | | todayList = todayList.stream().filter(x -> ObjectUtil.isNotEmpty(x.getCvtOfflineTime())).collect(Collectors.toList()); |
| | | if (CollUtil.isNotEmpty(todayList)){ |
| | | List<String> allModel = todayList.stream().map(BsOrderScheduling::getModel).distinct().collect(Collectors.toList()); |
| | | Map<String, List<BsOrderScheduling>> collect = new HashMap<>(); |
| | | for (String s : allModel) { |
| | | LineChartVO vo = new LineChartVO(); |
| | | List<Integer> arr = new ArrayList<>(); |
| | | vo.setName(s); |
| | | collect = todayList.stream().filter(x -> s.equals(x.getModel())).collect(Collectors.groupingBy(item -> new SimpleDateFormat("yyyy-MM-dd HH").format(item |
| | | .getCvtOfflineTime()))); |
| | | Map<Integer,Integer> temp = new HashMap<>(); |
| | | if (CollUtil.isNotEmpty(collect)){ |
| | | for (String string : collect.keySet()) { |
| | | int size = collect.get(string).size(); |
| | | String s3 = string.split(StringUtils.SPACE)[1]; |
| | | if (StringUtils.isNotEmpty(s3)){ |
| | | int i = Integer.parseInt(s3); |
| | | temp.put(i,size); |
| | | } |
| | | } |
| | | } |
| | | for (int i = 8; i < 23; i++) { |
| | | arr.add(temp.getOrDefault(i, 0)); |
| | | } |
| | | vo.setData(arr); |
| | | vo.setType("line"); |
| | | result.add(vo); |
| | | } |
| | | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢åç®±ä¸çº¿å表 |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.jcdm.main.bs.orderScheduling.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class LineChartVO { |
| | | |
| | | private String name; |
| | | |
| | | private String type; |
| | | |
| | | private List<Integer> data; |
| | | } |
| | |
| | | import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling; |
| | | import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection; |
| | | import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService; |
| | | import com.jcdm.main.da.passingStationCollection.vo.DaPassingStationVO; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('da:passingStationCollection:list')") |
| | | @GetMapping("/getTopProcess") |
| | | public TableDataInfo getTopProcess() |
| | | { |
| | | DaPassingStationCollection daPassingStationCollection = new DaPassingStationCollection(); |
| | | List<DaPassingStationVO> list = daPassingStationCollectionService.getTopProcess(daPassingStationCollection); |
| | | return getDataTable(list); |
| | | } |
| | | /** |
| | | * æ¥è¯¢äº§åè¿ç«ééå表 |
| | | */ |
| | |
| | | package com.jcdm.main.da.passingStationCollection.domain; |
| | | |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import com.jcdm.common.annotation.Excel; |
| | |
| | | * @author yyt |
| | | * @date 2023-12-12 |
| | | */ |
| | | @Data |
| | | public class DaPassingStationCollection extends BaseEntity |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | @Excel(name = "èææ¶é´") |
| | | private String beatTime; |
| | | |
| | | @TableField(exist = false) |
| | | private Long beatTimeLong; |
| | | |
| | | private Long[] ids; |
| | | |
| | | public Long[] getIds() { |
| | |
| | | |
| | | import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling; |
| | | import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection; |
| | | import com.jcdm.main.da.passingStationCollection.vo.DaPassingStationVO; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @return 产åè¿ç«éééå |
| | | */ |
| | | public List<DaPassingStationCollection> selectDaPassingStationCollectionList(DaPassingStationCollection daPassingStationCollection); |
| | | public List<DaPassingStationVO> getTopProcess(DaPassingStationCollection daPassingStationCollection); |
| | | |
| | | |
| | | /** |
| | |
| | | package com.jcdm.main.da.passingStationCollection.service.impl; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.jcdm.common.constant.Constants; |
| | | import com.jcdm.common.utils.DateUtils; |
| | | import com.jcdm.common.utils.StringUtils; |
| | | import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling; |
| | | import com.jcdm.main.bs.orderScheduling.mapper.BsOrderSchedulingMapper; |
| | | import com.jcdm.main.bs.orderScheduling.service.IBsOrderSchedulingService; |
| | | import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection; |
| | | import com.jcdm.main.da.passingStationCollection.mapper.DaPassingStationCollectionMapper; |
| | | import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService; |
| | | import com.jcdm.main.da.passingStationCollection.vo.DaPassingStationVO; |
| | | import com.jcdm.main.rm.repairRecord.domain.RmRepairRecord; |
| | | import com.jcdm.main.rm.repairRecord.mapper.RmRepairRecordMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | return daPassingStationCollectionMapper.selectDaPassingStationCollectionList(daPassingStationCollection); |
| | | } |
| | | |
| | | @Override |
| | | public List<DaPassingStationVO> getTopProcess(DaPassingStationCollection daPassingStationCollection) |
| | | { |
| | | |
| | | List<DaPassingStationVO> result = new ArrayList<>(); |
| | | List<DaPassingStationCollection> list = daPassingStationCollectionMapper.selectDaPassingStationCollectionList(daPassingStationCollection); |
| | | //çé¤èæ为空çæ°æ® |
| | | list = list.stream().filter(x -> StringUtils.isNotEmpty(x.getBeatTime())).collect(Collectors.toList()); |
| | | //åçéæä½ |
| | | if (CollUtil.isNotEmpty(list)){ |
| | | for (DaPassingStationCollection passingStationCollection : list) { |
| | | if (StringUtils.isNotEmpty(passingStationCollection.getBeatTime())){ |
| | | Long aLong = Long.valueOf(passingStationCollection.getBeatTime()); |
| | | passingStationCollection.setBeatTimeLong(aLong); |
| | | }else { |
| | | passingStationCollection.setBeatTimeLong(0L); |
| | | } |
| | | } |
| | | Map<String, Double> collect = list.stream().collect(Collectors.groupingBy(DaPassingStationCollection::getLocationCode, Collectors.averagingLong(DaPassingStationCollection::getBeatTimeLong))); |
| | | //æåº |
| | | List<Map.Entry<String,Double>> entryList = new ArrayList<>(collect.entrySet()); |
| | | Collections.sort(entryList, new Comparator<Map.Entry<String, Double>>() { |
| | | @Override |
| | | public int compare(Map.Entry<String, Double> o1, Map.Entry<String, Double> o2) { |
| | | double v = o2.getValue() - o1.getValue(); |
| | | return (int) v; |
| | | } |
| | | }); |
| | | LinkedHashMap<String, Double> linkedHashMap = new LinkedHashMap<String, Double>(); |
| | | int i = 1; |
| | | double sum = 0; |
| | | for (Map.Entry<String,Double> e : entryList |
| | | ) { |
| | | if (i<6){ |
| | | sum = sum + e.getValue(); |
| | | linkedHashMap.put(e.getKey(),e.getValue()); |
| | | i++; |
| | | } |
| | | |
| | | } |
| | | //计ç®æ°æ® |
| | | if (CollUtil.isNotEmpty(linkedHashMap)){ |
| | | for (String s : linkedHashMap.keySet()) { |
| | | DaPassingStationVO vo = new DaPassingStationVO(); |
| | | BigDecimal divide = BigDecimal.valueOf(linkedHashMap.get(s)).divide(BigDecimal.valueOf(sum),4, RoundingMode.HALF_UP); |
| | | vo.setName(s); |
| | | vo.setValue(divide); |
| | | result.add(vo); |
| | | } |
| | | } |
| | | |
| | | // Map<String, List<DaPassingStationCollection>> collect = list.stream().collect(Collectors.groupingBy(DaPassingStationCollection::getLocationCode)); |
| | | // for (String key:collect.keySet()){ |
| | | // List<DaPassingStationCollection> list1 = collect.get(key); |
| | | // if (CollUtil.isNotEmpty(list1)) { |
| | | // Double collect1 = list1.stream().collect(Collectors.averagingLong(DaPassingStationCollection::getBeatTimeLong)); |
| | | // } |
| | | // } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * è·åé¦é¡µåæ¥ç´¯è®¡é产æ°æ® |
| | | * @param fieldName bs |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.jcdm.main.da.passingStationCollection.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class DaPassingStationVO { |
| | | |
| | | private String name; |
| | | |
| | | private BigDecimal value; |
| | | } |
| | |
| | | params: query |
| | | }) |
| | | } |
| | | //æ¥è¯¢å½å¤©ç产æ°æ® |
| | | export function getOffLineNum() { |
| | | return request({ |
| | | url: '/bs/orderScheduling/getOffLineNum', |
| | | method: 'get' |
| | | }) |
| | | } |
| | | export function listOrderScheduling2(query) { |
| | | return request({ |
| | | url: '/bs/orderScheduling/list2', |
| | |
| | | params: query |
| | | }) |
| | | } |
| | | |
| | | //æ¥è¯¢é¦é¡µtopäºæ°æ® |
| | | export function getTopProcess() { |
| | | return request({ |
| | | url: '/da/passingStationCollection/getTopProcess', |
| | | method: 'get' |
| | | }) |
| | | } |
| | | // ä¸å页æ¥è¯¢äº§åè¿ç«ééå表 |
| | | export function noPageList(query) { |
| | | return request({ |
| | |
| | | import * as echarts from 'echarts' |
| | | require('echarts/theme/macarons') // echarts theme |
| | | import resize from './mixins/resize' |
| | | import { getOffLineNum } from "@/api/main/bs/orderScheduling/orderScheduling"; |
| | | |
| | | export default { |
| | | mixins: [resize], |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | chart: null |
| | | chart: null, |
| | | data: [], |
| | | legendTitle: [], |
| | | } |
| | | }, |
| | | watch: { |
| | |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.$nextTick(() => { |
| | | this.initChart() |
| | | }) |
| | | this.getData() |
| | | |
| | | }, |
| | | beforeDestroy() { |
| | | if (!this.chart) { |
| | |
| | | this.chart = null |
| | | }, |
| | | methods: { |
| | | getData(){ |
| | | getOffLineNum().then(res => { |
| | | if (res.code === 200){ |
| | | this.data = res.rows |
| | | this.data.forEach(x => { |
| | | this.legendTitle.push(x.name) |
| | | }) |
| | | this.$nextTick(() => { |
| | | this.initChart() |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | initChart() { |
| | | this.chart = echarts.init(this.$el, 'macarons') |
| | | this.setOptions(this.chartData) |
| | |
| | | left: 'left' // æ é¢ä½ç½® |
| | | }, |
| | | xAxis: { |
| | | data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], |
| | | data: ['8:00', '9:00', '10:00','11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00','21:00','22:00'], |
| | | boundaryGap: false, |
| | | axisTick: { |
| | | show: false |
| | |
| | | } |
| | | }, |
| | | legend: { |
| | | data: ['expected', 'actual'] |
| | | data: this.legendTitle |
| | | }, |
| | | series: [{ |
| | | name: 'expected', itemStyle: { |
| | | normal: { |
| | | color: '#FF005A', |
| | | lineStyle: { |
| | | color: '#FF005A', |
| | | width: 2 |
| | | } |
| | | } |
| | | }, |
| | | smooth: true, |
| | | type: 'line', |
| | | data: expectedData, |
| | | animationDuration: 2800, |
| | | animationEasing: 'cubicInOut' |
| | | }, |
| | | { |
| | | name: 'actual', |
| | | smooth: true, |
| | | type: 'line', |
| | | itemStyle: { |
| | | normal: { |
| | | color: '#3888fa', |
| | | lineStyle: { |
| | | color: '#3888fa', |
| | | width: 2 |
| | | }, |
| | | areaStyle: { |
| | | color: '#f3f8ff' |
| | | } |
| | | } |
| | | }, |
| | | data: actualData, |
| | | animationDuration: 2800, |
| | | animationEasing: 'quadraticOut' |
| | | }] |
| | | series: this.data |
| | | }) |
| | | } |
| | | } |
| | | }, |
| | | |
| | | } |
| | | </script> |
| | |
| | | import * as echarts from 'echarts' |
| | | require('echarts/theme/macarons') // echarts theme |
| | | import resize from './mixins/resize' |
| | | import { getTopProcess } from "@/api/main/da/passingStationCollection/passingStationCollection"; |
| | | |
| | | export default { |
| | | mixins: [resize], |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | chart: null |
| | | chart: null, |
| | | data: [], |
| | | title:[], |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.$nextTick(() => { |
| | | this.initChart() |
| | | }) |
| | | this.getData() |
| | | |
| | | }, |
| | | beforeDestroy() { |
| | | if (!this.chart) { |
| | |
| | | this.chart = null |
| | | }, |
| | | methods: { |
| | | getData(){ |
| | | getTopProcess().then(res => { |
| | | if (res.code === 200){ |
| | | this.data = res.rows |
| | | this.data.forEach(x => { |
| | | this.title.push(x.name) |
| | | }) |
| | | this.$nextTick(() => { |
| | | this.initChart() |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | initChart() { |
| | | this.chart = echarts.init(this.$el, 'macarons') |
| | | |
| | |
| | | left: 'left', |
| | | // left: 'center', |
| | | // bottom: '10',//左侧é«åº¦ |
| | | data: ['OP460', 'OP090', 'OP660', 'OP650', 'OP730'] |
| | | data: this.title |
| | | }, |
| | | series: [ |
| | | { |
| | |
| | | // length: 10 // è°æ´æ ç¾çº¿çé¿åº¦ |
| | | // }, |
| | | center: ['50%', '60%'], |
| | | data: [ |
| | | { value: 5, name: 'OP460' }, |
| | | { value: 9, name: 'OP090' }, |
| | | { value: 5, name: 'OP660' }, |
| | | { value: 5, name: 'OP650' }, |
| | | { value: 7, name: 'OP730' } |
| | | ], |
| | | data: this.data, |
| | | label: { |
| | | formatter: '{b}: {c} ({d}%)' |
| | | }, |