From 1ebb40569f3af90cc78265e21e33bfa97c7b2f4a Mon Sep 17 00:00:00 2001 From: "castle.zang" Date: Sat, 12 Oct 2024 15:12:03 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=B5=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mes/pcn/api/busi/IMesEarlyWarningService.java | 48 +++++++++ .../pcn/apiservice/config/WebServiceConfig.java | 118 ++++++++++----------- .../busi/MesEarlyWarningKanBanController.java | 98 +++++++++++++++++ .../busi/MesEarlyWarningServiceImpl.java | 71 +++++++++++++ 4 files changed, 276 insertions(+), 59 deletions(-) create mode 100644 modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesEarlyWarningService.java create mode 100644 modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesEarlyWarningKanBanController.java create mode 100644 modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesEarlyWarningServiceImpl.java diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesEarlyWarningService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesEarlyWarningService.java new file mode 100644 index 0000000..58ff47e --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesEarlyWarningService.java @@ -0,0 +1,48 @@ +package cn.estsh.i3plus.ext.mes.pcn.api.busi; + +import cn.estsh.i3plus.pojo.mes.bean.MesEarlyWarningKanBan; +import cn.estsh.i3plus.pojo.mes.model.MesEarlyWarningKanBanModel; + +import java.util.List; + +public interface IMesEarlyWarningService { + + /** + * 查询出需要轮询组的id 和 轮询的时间(切换组时查询一下) + * 如果idList 数量为1,时间则是定时刷新时间 + * + * 添加新的组时需要查询一下 + */ + List getEarlyWarningList(String organizeCode); + + /** + * 保存配置 + * @param model + */ + void saveEarlyWarning(MesEarlyWarningKanBanModel model); + + /** + * 更新配置 + * @param earlyWarning + */ + void updateEarlyWarning(MesEarlyWarningKanBan earlyWarning); + + /** + * 软删配置 + */ + void deleteEarlyWarning(Long id, String organizeCode,String userName); + + /** + * 获取看板数据 + * @param id + */ + MesEarlyWarningKanBan getKanbanData(Long id,String organizeCode); + + /** + * 获取看板数据 + * @param id + */ + void getData(Long id,String organizeCode); + + +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/config/WebServiceConfig.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/config/WebServiceConfig.java index a035b0a..e3c4679 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/config/WebServiceConfig.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/config/WebServiceConfig.java @@ -1,59 +1,59 @@ -///** -// * Licensed to the Apache Software Foundation (ASF) under one -// * or more contributor license agreements. See the NOTICE file -// * distributed with this work for additional information -// * regarding copyright ownership. The ASF licenses this file -// * to you under the Apache ImppLicense, Version 2.0 (the -// * "ImppLicense"); you may not use this file except in compliance -// * with the ImppLicense. You may obtain a copy of the ImppLicense at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, -// * software distributed under the ImppLicense is distributed on an -// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// * KIND, either express or implied. See the ImppLicense for the -// * specific language governing permissions and limitations -// * under the ImppLicense. -// */ -//package cn.estsh.i3plus.ext.mes.pcn.apiservice.config; -// -// -// -//import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.webservice.DcsForEquipmentServer; -//import org.apache.cxf.Bus; -//import org.apache.cxf.jaxws.EndpointImpl; -//import org.apache.cxf.transport.servlet.CXFServlet; -//import org.springframework.beans.factory.annotation.Autowired; -//import org.springframework.boot.web.servlet.ServletRegistrationBean; -//import org.springframework.context.annotation.Bean; -//import org.springframework.context.annotation.Configuration; -// -//import javax.xml.ws.Endpoint; -// -///** -// * @Description : WebService Server 服务配置 -// * WSDL URL: /block/softswitch/server/web-service?wsdl -// * @Reference : -// * @Author : wei.peng -// * @CreateDate : 2019/9/10 下午3:13 -// * @Modify: -// **/ -//@Configuration -//public class WebServiceConfig { -// -// @Autowired -// private Bus bus; -// -// @Bean("cxfServletRegistration") -// public ServletRegistrationBean dispatcherServlet() { -// return new ServletRegistrationBean(new CXFServlet(), "/*"); -// } -// -// @Bean -// public Endpoint endpoint() { -// EndpointImpl endpoint = new EndpointImpl(bus, new DcsForEquipmentServer()); -// endpoint.publish("/DCSForEquipmentService"); -// return endpoint; -// } -//} +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache ImppLicense, Version 2.0 (the + * "ImppLicense"); you may not use this file except in compliance + * with the ImppLicense. You may obtain a copy of the ImppLicense at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the ImppLicense is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the ImppLicense for the + * specific language governing permissions and limitations + * under the ImppLicense. + */ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.config; + + + +import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.webservice.DcsForEquipmentServer; +import org.apache.cxf.Bus; +import org.apache.cxf.jaxws.EndpointImpl; +import org.apache.cxf.transport.servlet.CXFServlet; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import javax.xml.ws.Endpoint; + +/** + * @Description : WebService Server 服务配置 + * WSDL URL: /block/softswitch/server/web-service?wsdl + * @Reference : + * @Author : wei.peng + * @CreateDate : 2019/9/10 下午3:13 + * @Modify: + **/ +@Configuration +public class WebServiceConfig { + + @Autowired + private Bus bus; + + @Bean("cxfServletRegistration") + public ServletRegistrationBean dispatcherServlet() { + return new ServletRegistrationBean(new CXFServlet(), "/i3plus-pcn/*"); + } + + @Bean + public Endpoint endpoint() { + EndpointImpl endpoint = new EndpointImpl(bus, new DcsForEquipmentServer()); + endpoint.publish("/DCSForEquipmentService"); + return endpoint; + } +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesEarlyWarningKanBanController.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesEarlyWarningKanBanController.java new file mode 100644 index 0000000..31214b0 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesEarlyWarningKanBanController.java @@ -0,0 +1,98 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.controller.busi; + +import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.MesEarlyWarningServiceImpl; +import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant; +import cn.estsh.i3plus.pojo.mes.bean.MesEarlyWarningKanBan; +import cn.estsh.i3plus.pojo.mes.model.MesEarlyWarningKanBanModel; +import cn.estsh.impp.framework.boot.util.ResultBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@RestController +@RequestMapping(MesCommonConstant.MES_YANFEN + "/earlyWarningKanBan") +public class MesEarlyWarningKanBanController { + + @Autowired + private MesEarlyWarningServiceImpl mesEarlyWarningService; + + /** + * 获取所有的线末大屏配置 + * @param organizeCode + * @return + */ + @GetMapping(path = "/list/{organizeCode}") + public ResultBean getEarlyWarningList(@PathVariable String organizeCode){ + List list; + try { + list = mesEarlyWarningService.getEarlyWarningList(organizeCode); + } catch (Exception e) { + return ResultBean.fail(e.getMessage()); + } + return ResultBean.success("查询成功").setResultList(list); + } + + /** + * 保存配置 + * @param model + * @return + */ + @PostMapping(path = "/save") + public ResultBean saveEarlyWarningList(@RequestBody MesEarlyWarningKanBanModel model){ + try { + mesEarlyWarningService.saveEarlyWarning(model); + } catch (Exception e) { + return ResultBean.fail(e.getMessage()); + } + return ResultBean.success("查询成功"); + } + + /** + * 更新配置 + * @param earlyWarning + */ + @PostMapping(path = "/update") + public ResultBean updateEarlyWarning(@RequestBody MesEarlyWarningKanBan earlyWarning){ + try { + mesEarlyWarningService.updateEarlyWarning(earlyWarning); + } catch (Exception e) { + return ResultBean.fail(e.getMessage()); + } + return ResultBean.success("更新成功"); + } + + /** + * 软删配置 + */ + @GetMapping(path = "/delete/{id}/{organizeCode}/{userName}") + public ResultBean deleteEarlyWarning(@PathVariable Long id, @PathVariable String organizeCode,@PathVariable String userName){ + try { + mesEarlyWarningService.deleteEarlyWarning(id,organizeCode,userName); + } catch (Exception e) { + return ResultBean.fail(e.getMessage()); + } + return ResultBean.success("删除成功"); + } + + + /** + * 获取看板配置 + */ + @GetMapping(path = "/get/{id}/{organizeCode}") + public ResultBean getKanbanData(@PathVariable Long id,@PathVariable String organizeCode){ + try { + mesEarlyWarningService.getKanbanData(id,organizeCode); + } catch (Exception e) { + return ResultBean.fail(e.getMessage()); + } + return ResultBean.success("删除成功"); + } + + + @GetMapping(path = "/getData/{id}/{organizeCode}") + public ResultBean getData(@PathVariable Long id,@PathVariable String organizeCode){ + return null; + } + +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesEarlyWarningServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesEarlyWarningServiceImpl.java new file mode 100644 index 0000000..b68c974 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesEarlyWarningServiceImpl.java @@ -0,0 +1,71 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi; + +import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesEarlyWarningService; +import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException; +import cn.estsh.i3plus.platform.common.convert.ConvertBean; +import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; +import cn.estsh.i3plus.pojo.mes.bean.MesEarlyWarningKanBan; +import cn.estsh.i3plus.pojo.mes.model.MesEarlyWarningKanBanModel; +import cn.estsh.i3plus.pojo.mes.repository.MesEarlyWarningKanBanRepository; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.beanutils.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.lang.reflect.InvocationTargetException; +import java.util.List; + +@Slf4j +@Service +public class MesEarlyWarningServiceImpl implements IMesEarlyWarningService { + + @Autowired + private MesEarlyWarningKanBanRepository earlyWarningKanBanRao; + + @Override + public List getEarlyWarningList(String organizeCode) { + + DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode); + return earlyWarningKanBanRao.findByHqlWhere(ddlPackBean); + } + + @Override + public void saveEarlyWarning(MesEarlyWarningKanBanModel model) { + MesEarlyWarningKanBan kanBan = new MesEarlyWarningKanBan(); + try { + BeanUtils.copyProperties(kanBan,model); + } catch (IllegalAccessException | InvocationTargetException e) { + log.error(e.getMessage()); + MesPcnException.throwMesBusiException("类型转换出错!"+e.getMessage()); + } + ConvertBean.saveOrUpdate(kanBan,model.getCreateUser()); + earlyWarningKanBanRao.insert(kanBan); + + } + + @Override + public void updateEarlyWarning(MesEarlyWarningKanBan earlyWarning) { + ConvertBean.saveOrUpdate(earlyWarning,earlyWarning.getCreateUser()); + earlyWarningKanBanRao.insert(earlyWarning); + + } + + @Override + public void deleteEarlyWarning(Long id, String organizeCode,String userName) { + earlyWarningKanBanRao.deleteWeaklyByProperties(new String[]{"id","organizeCode"},new Object[]{id,organizeCode},userName); + } + + @Override + public MesEarlyWarningKanBan getKanbanData(Long id,String organizeCode) { + List list = earlyWarningKanBanRao.findByProperty(new String[]{"id", "organizeCode"}, new Object[]{id, organizeCode}); + if (!list.isEmpty()){ + return list.get(0); + } + return new MesEarlyWarningKanBan(); + } + + @Override + public void getData(Long id, String organizeCode) { + + } +}