diff --git a/nlsso-server/src/main/java/org/nl/common/mnt/websocket/MsgType.java b/nlsso-server/src/main/java/org/nl/common/websocket/MsgType.java similarity index 95% rename from nlsso-server/src/main/java/org/nl/common/mnt/websocket/MsgType.java rename to nlsso-server/src/main/java/org/nl/common/websocket/MsgType.java index e1df5be..55d446b 100644 --- a/nlsso-server/src/main/java/org/nl/common/mnt/websocket/MsgType.java +++ b/nlsso-server/src/main/java/org/nl/common/websocket/MsgType.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.nl.common.mnt.websocket; +package org.nl.common.websocket; /** * @author ZhangHouYing diff --git a/nlsso-server/src/main/java/org/nl/common/websocket/SendHomeWebSocketServer.java b/nlsso-server/src/main/java/org/nl/common/websocket/SendHomeWebSocketServer.java new file mode 100644 index 0000000..f16ec4b --- /dev/null +++ b/nlsso-server/src/main/java/org/nl/common/websocket/SendHomeWebSocketServer.java @@ -0,0 +1,123 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.nl.common.websocket; +import com.alibaba.fastjson.JSON; +import lombok.extern.slf4j.Slf4j; +import org.nl.wms.database.eas.dao.HomeBillCounts; +import org.springframework.stereotype.Component; +import javax.websocket.*; +import javax.websocket.server.PathParam; +import javax.websocket.server.ServerEndpoint; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.CopyOnWriteArraySet; + + +@ServerEndpoint("/webSocket/SendHomeInfo/{sid}") +@Slf4j +@Component +public class SendHomeWebSocketServer { + + /** + * concurrent包的线程安全Set,用来存放每个客户端对应的MyWebSocket对象。 + */ + private static CopyOnWriteArraySet webSocketSet = new CopyOnWriteArraySet<>(); + + /**静态变量,用来记录当前在线连接数。应该把它设计成线程安全的。*/ + private static int onlineCount = 0; + + + /**与某个客户端的连接会话,需要通过它来给客户端发送数据*/ + private Session session; + /** + * 与某个客户端的连接会话,需要通过它来给客户端发送数据 + */ + /** + * 接收sid + */ + private String sid = ""; + + /** + * 连接建立成功调用的方法 + */ + @OnOpen + public void onOpen(Session session, @PathParam("sid") String sid) { + this.session = session; + //如果存在就先删除一个,防止重复推送消息 + webSocketSet.removeIf(webSocket -> webSocket.sid.equals(sid)); + webSocketSet.add(this); + this.sid = sid; + } + + /** + * 连接关闭调用的方法 + */ + @OnClose + public void onClose() { + webSocketSet.remove(this); + } + + /** + * 收到客户端消息后调用的方法 + * + * @param message 客户端发送过来的消息 + */ + @OnMessage + public void onMessage(String message, Session session) { + System.out.println(webSocketSet.size() + "_接收到消息_" + session.getId()); + } + + @OnError + public void onError(Session session, Throwable error) { + //log.error("发生错误"); + webSocketSet.remove(session); + error.printStackTrace(); + } + + public Session getSession() { + Integer d = 1; + return session; + } + // 发送消息,在定时任务中会调用此方法 + public void sendMessage(String message) throws IOException { + this.session.getBasicRemote().sendText(message); + } + + + public void sendDataToClient(List data) { + try { + if (this.session != null&& data != null && !data.isEmpty()) { + this.session.getBasicRemote().sendText(JSON.toJSONString(data)); + } + } catch (IOException e) { + log.error("发送消息给客户端失败", e); + } + } + public static synchronized int getOnlineCount() { + return onlineCount; + } + + public static CopyOnWriteArraySet getWebSocketSet() { + return webSocketSet; + } + + + public void setSession(Session session) { + this.session = session; + } + + +} diff --git a/nlsso-server/src/main/java/org/nl/common/mnt/websocket/SocketMsg.java b/nlsso-server/src/main/java/org/nl/common/websocket/SocketMsg.java similarity index 95% rename from nlsso-server/src/main/java/org/nl/common/mnt/websocket/SocketMsg.java rename to nlsso-server/src/main/java/org/nl/common/websocket/SocketMsg.java index b1d5d75..ca215c0 100644 --- a/nlsso-server/src/main/java/org/nl/common/mnt/websocket/SocketMsg.java +++ b/nlsso-server/src/main/java/org/nl/common/websocket/SocketMsg.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.nl.common.mnt.websocket; +package org.nl.common.websocket; import lombok.Data; diff --git a/nlsso-server/src/main/java/org/nl/common/mnt/websocket/WebSocketServer.java b/nlsso-server/src/main/java/org/nl/common/websocket/WebSocketServer.java similarity index 93% rename from nlsso-server/src/main/java/org/nl/common/mnt/websocket/WebSocketServer.java rename to nlsso-server/src/main/java/org/nl/common/websocket/WebSocketServer.java index 6932a97..35c68ef 100644 --- a/nlsso-server/src/main/java/org/nl/common/mnt/websocket/WebSocketServer.java +++ b/nlsso-server/src/main/java/org/nl/common/websocket/WebSocketServer.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.nl.common.mnt.websocket; +package org.nl.common.websocket; import com.alibaba.fastjson.JSONObject; import lombok.extern.slf4j.Slf4j; @@ -81,20 +81,20 @@ public class WebSocketServer { */ @OnMessage public void onMessage(String message, Session session) { - log.info("收到来" + sid + "的信息:" + message); +// log.info("收到来"+sid+"的信息:"+message); //群发消息 for (WebSocketServer item : webSocketSet) { try { item.sendMessage(message); } catch (IOException e) { - log.error(e.getMessage(), e); + //log.error(e.getMessage(), e); } } } @OnError public void onError(Session session, Throwable error) { - log.error("发生错误"); + //log.error("发生错误"); error.printStackTrace(); } @@ -111,7 +111,7 @@ public class WebSocketServer { */ public static void sendInfo(SocketMsg socketMsg, @PathParam("sid") String sid) throws IOException { String message = JSONObject.toJSONString(socketMsg); - log.debug("推送消息到" + sid + ",推送内容:" + message); +// log.info("推送消息到"+sid+",推送内容:"+message); for (WebSocketServer item : webSocketSet) { try { //这里可以设定只推送给这个sid的,为null则全部推送 diff --git a/nlsso-server/src/main/java/org/nl/system/service/notice/impl/SysNoticeServiceImpl.java b/nlsso-server/src/main/java/org/nl/system/service/notice/impl/SysNoticeServiceImpl.java index dc906f5..78cb10f 100644 --- a/nlsso-server/src/main/java/org/nl/system/service/notice/impl/SysNoticeServiceImpl.java +++ b/nlsso-server/src/main/java/org/nl/system/service/notice/impl/SysNoticeServiceImpl.java @@ -14,9 +14,10 @@ import lombok.extern.slf4j.Slf4j; import org.nl.common.domain.query.PageQuery; import org.nl.common.enums.NoticeEnum; import org.nl.common.exception.BadRequestException; -import org.nl.common.mnt.websocket.MsgType; -import org.nl.common.mnt.websocket.SocketMsg; -import org.nl.common.mnt.websocket.WebSocketServer; +import org.nl.common.websocket.MsgType; +import org.nl.common.websocket.SocketMsg; +import org.nl.common.websocket.WebSocketServer; +import org.nl.common.websocket.SocketMsg; import org.nl.system.service.dict.dao.Dict; import org.nl.system.service.dict.dao.mapper.SysDictMapper; import org.nl.system.service.notice.ISysNoticeService; diff --git a/nlsso-server/src/main/java/org/nl/wms/database/eas/controller/EasOutInBillController.java b/nlsso-server/src/main/java/org/nl/wms/database/eas/controller/EasOutInBillController.java index 61c534c..c95c71a 100644 --- a/nlsso-server/src/main/java/org/nl/wms/database/eas/controller/EasOutInBillController.java +++ b/nlsso-server/src/main/java/org/nl/wms/database/eas/controller/EasOutInBillController.java @@ -4,6 +4,7 @@ import java.util.List; import java.util.Set; import cn.dev33.satoken.annotation.SaIgnore; +import com.alibaba.fastjson.JSONArray; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import org.apache.commons.lang3.StringUtils; import org.nl.common.base.CommonPage; @@ -57,7 +58,17 @@ public class EasOutInBillController { return RestBusinessTemplate.execute(() -> easOutInBillService.audit(ids)); } - + /** + * APP升级 + * @return APP升级 + */ + @PostMapping("/appUpdate") + @Log("审核") + @SaIgnore + //@SaCheckPermission("@el.check(EasOutInBill:edit')") + public CommonResult appUpdate() { + return RestBusinessTemplate.execute(() -> easOutInBillService.appUpdate()); + } /** * 首页显示出入库单据数量 diff --git a/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/EasOutInBill.java b/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/EasOutInBill.java index 7d4579d..5328299 100644 --- a/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/EasOutInBill.java +++ b/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/EasOutInBill.java @@ -1,6 +1,7 @@ package org.nl.wms.database.eas.dao; import java.io.Serializable; + import lombok.*; import lombok.Data; import lombok.Builder; @@ -25,7 +26,6 @@ public class EasOutInBill extends Model { private static final long serialVersionUID = -7739291296662381393L; - /** * eas单据id */ @@ -89,6 +89,16 @@ public class EasOutInBill extends Model { */ private String cjsj; + /** + * 部门名称 + */ + private String bmmc; + + /** + * 部门编码 + */ + private String bmbm; + /** * 业务时间 @@ -144,7 +154,6 @@ public class EasOutInBill extends Model { private String update_time; - /** * 获取主键值 * diff --git a/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/EasOutInBillDetail.java b/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/EasOutInBillDetail.java index f34457c..300b6e1 100644 --- a/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/EasOutInBillDetail.java +++ b/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/EasOutInBillDetail.java @@ -48,6 +48,16 @@ public class EasOutInBillDetail extends Model { */ private String djid; + /** + * 部门名称 + */ + private String bmmc; + + /** + * 部门编码 + */ + private String bmbm; + /** * 单据类型 @@ -109,9 +119,6 @@ public class EasOutInBillDetail extends Model { private String cjr; - - - /** * 分录序号 */ diff --git a/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/mapper/EasOutInBillDetailMapper.java b/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/mapper/EasOutInBillDetailMapper.java index 5bff1e0..9d8f573 100644 --- a/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/mapper/EasOutInBillDetailMapper.java +++ b/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/mapper/EasOutInBillDetailMapper.java @@ -38,4 +38,9 @@ public interface EasOutInBillDetailMapper extends BaseMapper @DS("mysql_srm") List selectSrmPageWithInventory(); + void deleteInfo(@Param("days") String days); + + void deleteDetail(@Param("ids") Set ids); + + } diff --git a/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/EasOutInBillDetailMapper.xml b/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/EasOutInBillDetailMapper.xml index 5dc7b0b..d29ab1c 100644 --- a/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/EasOutInBillDetailMapper.xml +++ b/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/EasOutInBillDetailMapper.xml @@ -6,7 +6,7 @@ * FROM MEIAMSYSTEM.V_UC_OUTINBILL - WHERE DJZT = '提交' OR DJZT = '保存' + WHERE DJZT = '提交' AND TO_DATE(cjsj, 'YYYY-MM-DD') >= TRUNC(SYSDATE) - INTERVAL '2' DAY(3) - + + DELETE FROM eas_out_in_bill WHERE cjsj < #{days} + + + + DELETE + FROM eas_out_in_bill_detail + WHERE djid IN + + #{item} + + + insert into eas_out_in_bill_detail(id,djid, djlx, ywlx, djbh, zzbm, zzmc, btbz, djzt, cjsj, ywrq, cjr, flid, flxh, - wlbm, wlmc, ggxh, pc, jldw, jbjldw, fzjldw, sl, jbsl, fzsl, ckbm, ckmc, kwbm, kwmc, flbz, sysl, code, cksj, llr,tjkwbm,tjkwmc,kcsl,djly,trackno,update_id,update_name,update_time,czsl) + wlbm, wlmc, ggxh, pc, jldw, jbjldw, fzjldw, sl, jbsl, fzsl, ckbm, ckmc, kwbm, kwmc, flbz, sysl, code, cksj, llr,tjkwbm,tjkwmc,kcsl,djly,trackno,update_id,update_name,update_time,czsl,bmbm,bmmc) values (#{entity.id},#{entity.djid}, #{entity.djlx}, #{entity.ywlx}, #{entity.djbh}, #{entity.zzbm}, #{entity.zzmc}, @@ -105,7 +109,7 @@ #{entity.flxh}, #{entity.wlbm}, #{entity.wlmc}, #{entity.ggxh}, #{entity.pc}, #{entity.jldw}, #{entity.jbjldw}, #{entity.fzjldw}, #{entity.sl}, #{entity.jbsl}, #{entity.fzsl}, #{entity.ckbm}, #{entity.ckmc}, #{entity.kwbm}, #{entity.kwmc}, #{entity.flbz}, #{entity.sysl}, #{entity.code}, - #{entity.cksj}, #{entity.llr}, #{entity.tjkwbm}, #{entity.tjkwmc}, #{entity.kcsl}, #{entity.djly}, #{entity.trackno}, #{entity.update_id}, #{entity.update_name}, #{entity.update_time}, #{entity.czsl}) + #{entity.cksj}, #{entity.llr}, #{entity.tjkwbm}, #{entity.tjkwmc}, #{entity.kcsl}, #{entity.djly}, #{entity.trackno}, #{entity.update_id}, #{entity.update_name}, #{entity.update_time}, #{entity.czsl}, #{entity.bmbm}, #{entity.bmmc}) diff --git a/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/EasOutInBillMapper.xml b/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/EasOutInBillMapper.xml index f94486e..51a31c6 100644 --- a/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/EasOutInBillMapper.xml +++ b/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/EasOutInBillMapper.xml @@ -7,7 +7,7 @@ SELECT * FROM MEIAMSYSTEM.V_UC_OUTINBILL WHERE - djzt = '保存' + djzt = '提交'