| | |
| | | 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.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.jcdm.common.constant.Constants; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.jcdm.common.utils.DateUtils; |
| | | import com.jcdm.common.utils.StringUtils; |
| | | import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling; |
| | |
| | | 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 com.jcdm.main.websocket.WebSocketServer; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 产品过站采集Service业务层处理 |
| | |
| | | { |
| | | |
| | | List<DaPassingStationVO> result = new ArrayList<>(); |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | LocalDateTime startTime = LocalDate.now().atStartOfDay(); |
| | | LocalDateTime endTime = LocalDate.now().plusDays(1).atStartOfDay(); |
| | | String s1 = startTime.format(formatter); |
| | | String s2 = endTime.format(formatter); |
| | | daPassingStationCollection.setStartTime(s1); |
| | | daPassingStationCollection.setEndTime(s2); |
| | | List<DaPassingStationCollection> list = daPassingStationCollectionMapper.selectDaPassingStationCollectionList(daPassingStationCollection); |
| | | //筛除节拍为空的数据 |
| | | list = list.stream().filter(x -> StringUtils.isNotEmpty(x.getBeatTime())).collect(Collectors.toList()); |
| | |
| | | rmRepairRecordMapper.insertRmRepairRecord(rmRepairRecord); |
| | | } |
| | | } |
| | | @Override |
| | | public String SelectSN(String SNcode,String node) { |
| | | try { |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("SN_CODE",SNcode); |
| | | params.put("Node",node); |
| | | params.put("Success",""); |
| | | daPassingStationCollectionMapper.SelectSN(params); |
| | | return (String)params.get("Success"); |
| | | } catch (Exception e) { |
| | | return "数据查询失败!"; |
| | | } |
| | | } |
| | | |
| | | public String sendMessage(String message) throws Exception{ |
| | | Map<String,Object> map = new HashMap<>(); |
| | | |
| | | // 获取当前日期和时间 |
| | | LocalDateTime nowDateTime = LocalDateTime.now(); |
| | | DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | System.out.println(dateTimeFormatter.format(nowDateTime)); |
| | | map.put("server_time",dateTimeFormatter.format(nowDateTime)); |
| | | map.put("server_code","200"); |
| | | |
| | | map.put("server_message",message); |
| | | JSONObject jsonObject = new JSONObject(map); |
| | | WebSocketServer.sendAllMessage(jsonObject.toString()); |
| | | return jsonObject.toString(); |
| | | } |
| | | } |