| | |
| | | if(salesData!=null) { |
| | | String data =BaseThread.createXmlData(salesData); |
| | | log.info(data); |
| | | String url = Constant.PUSH_URL + baseController.getSignByWms(data, "deliveryorder.create",Constant.APP_KEY,Constant.SECRET,Constant.CUSTOMERID); |
| | | String url = Constant.PUSH_URL + baseController.getSignByWms(data, "SyncSalesOrderInfoJinWu",Constant.APP_KEY,Constant.SECRET,Constant.CUSTOMERID); |
| | | final String msg = baseController.doPostByParameterNotNameByXml(url, data); |
| | | log.info("msg:"+msg); |
| | | if(StringUtils.isNotBlank(msg)){ |
| | |
| | | throw new ApplicationException("接收返回结果数据为空"); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | //写错误日志 |
| | | e.printStackTrace(); |
| | | this.sendErrorLog(formid, docCode, e); |
| | | //String errorMsg = (e.getCause() != null ? (e.getCause().getMessage()).trim() : e.getMessage()); |
| | | // this.print(response, errorMsg); |
| | | } finally { |
| | | } finally { |
| | | SpObserver.setDBtoInstance(); |
| | | } |
| | | } |
| | |
| | | public static String CANEL_TOTAL_LIST =",120301,120386,120385,120384,120383,120382,120381,120380,140223,140240,140204,130301,140315,140130,140104,140107,140206,"; |
| | | public static String PUSH_SALES_LIST =",120301,120386,120385,120384,120383,120382,120381,140223,140240,140204,"; |
| | | public static String PUSH_130301_LIST =",130301,140315,140130,140104,"; |
| | | |
| | | /** |
| | | * 推送的网址 |
| | | */ |
| | | //---测试 |
| | | //public static String PUSH_URL="http://106.15.237.140/iWMSOpenAPITest/router"; |
| | | //public static String APP_KEY="4d1d598839c2a574cdf2ae0f9afb313e"; |
| | | //public static String CUSTOMERID="RongyaTest"; |
| | | public static String PUSH_URL="http://106.15.237.140/iWMSOpenAPITest/router"; |
| | | public static String APP_KEY="4d1d598839c2a574cdf2ae0f9afb313e"; |
| | | public static String CUSTOMERID="RongyaTest"; |
| | | //---正式 |
| | | public static String PUSH_URL="http://106.15.237.140/iWMSOpenAPI/router"; |
| | | public static String APP_KEY="6b26f899d1c4c8be50df3ec929adab3d"; |
| | | // public static String PUSH_URL="http://106.15.237.140/iWMSOpenAPI/router"; |
| | | // public static String APP_KEY="6b26f899d1c4c8be50df3ec929adab3d"; |
| | | // public static String CUSTOMERID="Rongya"; |
| | | public static String SECRET="7AY1NPQrmvLm108Kq1TXfOFHCvcluQYt"; |
| | | public static String CUSTOMERID="Rongya"; |
| | | } |
| | |
| | | if (salesData != null) { |
| | | String data = createXmlData(salesData); |
| | | log.info(data); |
| | | String url = Constant.PUSH_URL + baseController.getSignByWms(data, "deliveryorder.create",Constant.APP_KEY,Constant.SECRET,Constant.CUSTOMERID); |
| | | String url = Constant.PUSH_URL + baseController.getSignByWms(data, "SyncSalesOrderInfoJinWu",Constant.APP_KEY,Constant.SECRET,Constant.CUSTOMERID); |
| | | final String msg = baseController.doPostByParameterNotNameByXml(url, data); |
| | | log.info("msg:"+msg); |
| | | if (StringUtils.isNotBlank(msg)) { |
| | |
| | | " b.digit ,b.stCode ,b.stName ,b.itemMemo, b.DocItem " + |
| | | " from " + orderEntity.getHDtable() + " a join " + orderEntity.getDDtable() + " b on a.DocCode = b.DocCode\n" + |
| | | " join gform c on a.formid= c.formid\n" + |
| | | " join t110503 d on d.matCode= b.matCode\n" + |
| | | " where \n" + |
| | | " isnull(a.PushStatus,0)=0 \n" + |
| | | " and c.postdocstatus = a.DocStatus \n" + |
| | | " and d.MatType <>'虚拟' \n" + |
| | | " and a.docCode=@docCode \n" + |
| | | " and a.ShippingMethod not in('门店已提','电商平台已发','维修订单已发') \n" + |
| | | " order by a.doccode asc,b.DocItem asc \n" + |
| | |
| | | " b.digit ,b.stCode ,b.stName ,b.itemMemo, b.DocItem " + |
| | | " from " + orderEntity.getHDtable() + " a join " + orderEntity.getDDtable() + " b on a.DocCode = b.DocCode\n" + |
| | | " join gform c on a.formid= c.formid\n" + |
| | | " join t110503 e on e.matCode= b.matCode\n" + |
| | | " join t110203 d on a.cltcode= d.CltCode\n" + |
| | | " where \n" + |
| | | " isnull(a.PushStatus,0)=0 \n" + |
| | | " and c.postdocstatus = a.DocStatus \n" + |
| | | " and e.MatType <>'虚拟' \n" + |
| | | " and a.docCode=@docCode \n" + |
| | | " and a.ShippingMethod not in('门店已提','电商平台已发','维修订单已发') \n" + |
| | | " order by a.doccode asc,b.DocItem asc \n" + |
| | |
| | | " from " + orderEntity.getHDtable() + " a join " + orderEntity.getDDtable() + " b on a.DocCode = b.DocCode\n" + |
| | | " join gform c on a.formid= c.formid\n" + |
| | | " join t140304H d on d.doccode=a.refCode \n" + |
| | | " join t110503 e on e.matCode= b.matCode\n" + |
| | | " where \n" + |
| | | " isnull(a.PushStatus,0)=0 \n" + |
| | | " and c.postdocstatus = a.DocStatus \n" + |
| | | " and e.MatType <>'虚拟' \n" + |
| | | " and a.docCode=@docCode \n" + |
| | | " order by a.doccode asc,b.DocItem asc \n" + |
| | | " open mycurDeli \n" + |
| | |
| | | " b.digit ,b.stCode ,b.stName ,b.itemMemo, b.DocItem " + |
| | | " from " + orderEntity.getHDtable() + " a join " + orderEntity.getDDtable() + " b on a.DocCode = b.DocCode\n" + |
| | | " join gform c on a.formid= c.formid\n" + |
| | | " join t110503 d on d.matCode= b.matCode\n" + |
| | | " where \n" + |
| | | " isnull(a.PushStatus,0)=0 \n" ; |
| | | " isnull(a.PushStatus,0)=0 \n"+ |
| | | " and d.MatType <>'虚拟' \n"; |
| | | if(pushEntity.getFormId()==140240) { |
| | | hsql+= " and c.postdocstatus = a.DocStatus \n"; |
| | | }else { |
| | |
| | | " b.rowid ,b.MatCode ,b.cv1 ,b.cv2 ," + |
| | | " b.digit ,b.stCode ,b.stName ,b.itemMemo, b.DocItem " + |
| | | " from " + orderEntity.getHDtable() + " a join " + orderEntity.getDDtable() + " b on a.DocCode = b.DocCode\n" + |
| | | " join t110503 d on d.matCode= b.matCode\n" + |
| | | " where \n" + |
| | | " isnull(a.PushStatus,0)=0 \n" + |
| | | " and d.MatType <>'虚拟' \n" + |
| | | " and a.DocStatus=60 \n"+ |
| | | " and a.docCode=@docCode \n" + |
| | | " order by a.doccode asc,b.DocItem asc \n" + |
| | |
| | | " b.digit ,b.stCode ,b.stName ,b.itemMemo, b.DocItem " + |
| | | " from " + orderEntity.getHDtable() + " a join " + orderEntity.getDDtable() + " b on a.DocCode = b.DocCode\n" + |
| | | " join gform c on a.formid= c.formid\n" + |
| | | " join t110503 d on d.matCode= b.matCode\n" + |
| | | " where \n" + |
| | | " isnull(a.PushStatus,0)=0 \n" + |
| | | " and c.postdocstatus = a.DocStatus \n" + |
| | | " and d.MatType <>'虚拟' \n" + |
| | | " and a.docCode=@docCode \n" + |
| | | " order by a.doccode asc,b.DocItem asc \n" + |
| | | " open mycurDeli \n" + |
| | |
| | | " from " + orderEntity.getHDtable() + " a \n" + |
| | | " join " + orderEntity.getDDtable() + " b on a.DocCode = b.DocCode\n" + |
| | | " join t110203 d on d.cltCode= a.cltCode\n" + |
| | | " join t110503 e on e.matCode= b.matCode\n" + |
| | | " where \n" + |
| | | " isnull(a.PushStatus,0)=0 \n" + |
| | | " and e.MatType <>'虚拟' \n" + |
| | | " and a.DocStatus=60 \n" + |
| | | " and a.docCode=@docCode \n" + |
| | | " order by a.doccode asc,b.DocItem asc \n" + |
| | |
| | | " from " + orderEntity.getHDtable() + " a \n" + |
| | | " join " + orderEntity.getDDtable() + " b on a.DocCode = b.DocCode\n" + |
| | | " join gform c on a.formid= c.formid\n" + |
| | | " join t110503 d on d.matCode= b.matCode\n" + |
| | | " where \n" + |
| | | " isnull(a.PushStatus,0)=0 \n"; |
| | | " isnull(a.PushStatus,0)=0 \n"+ |
| | | " and d.MatType <>'虚拟' \n" ; |
| | | if ("140315".equalsIgnoreCase(orderEntity.getType())) { |
| | | hsql += " and c.postdocstatus = a.DocStatus \n"; |
| | | |
| | |
| | | " join " + orderEntity.getDDtable() + " b on a.DocCode = b.DocCode\n" + |
| | | " join t140304H c on a.refcode = c.DocCode\n" + |
| | | " join gform d on a.formid= d.formid\n" + |
| | | " join t110503 e on e.matCode= b.matCode\n" + |
| | | " where \n" + |
| | | " isnull(a.PushStatus,0)=0 \n" + |
| | | " and a.DocStatus=d.postdocstatus \n" + |
| | | " and e.MatType <>'虚拟' \n" + |
| | | " and a.docCode=@docCode \n" + |
| | | " order by a.doccode asc,b.DocItem asc \n" + |
| | | " open mycurDeli \n" + |
| | |
| | | try { |
| | | docCodeList ="'"+ docCodeList.replaceAll(";",",").replaceAll(",","','")+"'"; |
| | | return this.jdbcTemplate.query("set nocount on \n" + |
| | | " select MatCode as itemCode,MatName as itemName,MatCode as goodsCode,Barcode as barCode,MatGroup as categoryId,MatGroupName as categoryName,brand as brandName,special as size,BaseUOM as stockUnit,volume,BaseUomWeight as grossWeight,EnterDate as createTime,ModifyDate as updateTime,a.docCode from t110503 a where a.DocCode in ("+ docCodeList +")", new BeanPropertyRowMapper<>(MatCodeEntity.class)); |
| | | " select MatCode as itemCode,MatName as itemName,MatCode as goodsCode,Barcode as barCode,MatGroup as categoryId,MatGroupName as categoryName,brand as brandName,special as size,BaseUOM as stockUnit,volume,BaseUomWeight as grossWeight,EnterDate as createTime,ModifyDate as updateTime,a.docCode from t110503 a where a.MatType<>'虚拟' and a.DocCode in ("+ docCodeList +")", new BeanPropertyRowMapper<>(MatCodeEntity.class)); |
| | | } catch (EmptyResultDataAccessException e) { |
| | | return null; |
| | | } |
| | |
| | | session.getUserProperties().put("org.apache.tomcat.websocket.BLOCKING_SEND_TIMEOUT", 30000L);//30秒 |
| | | session.getUserProperties().put("org.apache.tomcat.websocket.textBufferSize", 10240);//10K |
| | | try { |
| | | WsMessageUserEntity wsMessageUserEntity = getOnlineUser(dbId, userFromType, userCode); |
| | | WsMessageUserEntity wsMessageUserEntity = getOnlineUser(dbId, userFromType, userCode,sessionId); |
| | | WsUserEntity wsUserEntity = WsUserEntity.builder().dbId(dbId).userCode(userCode).userFromType(userFromType).sessionId(sessionId).build(); |
| | | //log.error("onOpen>>>"+dbId+":usercode:"+userCode); |
| | | //log.error("onlineUserList.size>>>"+onlineUserList.size()); |
| | |
| | | * @param wsMessageUserEntity |
| | | */ |
| | | public void addOnlineUser(Integer dbId, String userCode,String userFromType, WsMessageUserEntity wsMessageUserEntity) { |
| | | onlineUserList.put(RedisSocket.CHANEL_WS_MESSAGES + ":" + dbId + ":" + userFromType +":" + userCode, wsMessageUserEntity); |
| | | onlineUserList.put(RedisSocket.CHANEL_WS_MESSAGES + ":" + dbId + ":" + userFromType +":" + userCode+":"+wsMessageUserEntity.getSessionId(), wsMessageUserEntity); |
| | | } |
| | | |
| | | /** |
| | | * 获取在线用户 |
| | | * |
| | | * @param dbId |
| | | * @param userFromType 用户来源分类:1.ERP 网页端用户,2.ERP APP端用户,3.联盟商城版小程序(旧版),4.活动版小程序(新版) |
| | | * @param userFromType 用户来源分类:1.ERP 网页端用户,2.ERP APP端用户,3.联盟商城版小程序(旧版),4.活动版小程序(新版),5.农行支付结果 回调 |
| | | * @param userCode |
| | | * @return |
| | | */ |
| | | public static WsMessageUserEntity getOnlineUser(Integer dbId, String userFromType,String userCode) { |
| | | return onlineUserList.get(RedisSocket.CHANEL_WS_MESSAGES + ":" + dbId + ":" + userFromType + ":" + userCode); |
| | | public static List<WsMessageUserEntity> getOnlineUser(Integer dbId, String userFromType,String userCode) { |
| | | List<WsMessageUserEntity> wsMessageUserList = new ArrayList<WsMessageUserEntity>(); |
| | | for(Map.Entry<String, WsMessageUserEntity> entry:onlineUserList.entrySet()){ |
| | | if (entry.getKey().startsWith(RedisSocket.CHANEL_WS_MESSAGES + ":" + dbId + ":" + userFromType + ":"+userCode)) { |
| | | wsMessageUserList.add(entry.getValue()) ; |
| | | } |
| | | } |
| | | return wsMessageUserList; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 具体一个会话用户 |
| | | * @param dbId |
| | | * @param userFromType |
| | | * @param userCode |
| | | * @param sessionId |
| | | * @return |
| | | */ |
| | | public static WsMessageUserEntity getOnlineUser(Integer dbId, String userFromType,String userCode,String sessionId) { |
| | | return onlineUserList.get(RedisSocket.CHANEL_WS_MESSAGES + ":" + dbId + ":" + userFromType + ":" + userCode+":"+sessionId); |
| | | } |
| | | |
| | | /** |
| | | * 群发只能用户类型 |
| | | * @param dbId |
| | | * @param userFromType |
| | | * @return |
| | | */ |
| | | public static List<WsMessageUserEntity> getOnlineUser(Integer dbId, String userFromType) { |
| | | List<WsMessageUserEntity> wsMessageUserList = new ArrayList<WsMessageUserEntity>(); |
| | | for(Map.Entry<String, WsMessageUserEntity> entry:onlineUserList.entrySet()){ |
| | |
| | | handlerMessage(msg, wsMessageUserEntity); |
| | | } |
| | | } |
| | | }else if(msg.getMsgType().equals(MessageType.ABC_PAY_CALLBACK)){ |
| | | |
| | | List<WsMessageUserEntity> wsMessageUserEntityList = WebSocketMessageServer.getOnlineUser(msg.getDbId(), msg.getUserFromType()); |
| | | }else{ |
| | | List<WsMessageUserEntity> wsMessageUserEntityList = WebSocketMessageServer.getOnlineUser(msg.getDbId(), msg.getUserFromType(),msg.getUserCode()); |
| | | //只有是存在于当前的用户信息才需要处理,否则不需要处理 |
| | | if (wsMessageUserEntityList != null && wsMessageUserEntityList.size() != 0) { |
| | | for (WsMessageUserEntity wsMessageUserEntity : wsMessageUserEntityList) { |
| | | handlerMessage(msg, wsMessageUserEntity); |
| | | } |
| | | } |
| | | }else { |
| | | //只发一个具体用户 |
| | | WsMessageUserEntity wsMessageUserEntity = WebSocketMessageServer.getOnlineUser(msg.getDbId(), msg.getUserFromType(),msg.getUserCode()); |
| | | handlerMessage(msg, wsMessageUserEntity); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |