| | |
| | | import javax.servlet.http.HttpSession; |
| | | |
| | | import com.yc.api.utils.VersionUtils; |
| | | import com.yc.open.mutual.entity.OnlineMessageEntity; |
| | | import com.yc.open.mutual.schedule.Gate; |
| | | import com.yc.sdk.shopping.service.imagedata.ShoppingImageDataIfc; |
| | | import com.yc.utils.DateUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.dao.DataAccessException; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | private OnlineServiceIfc online; |
| | | @Autowired |
| | | ShoppingImageDataIfc imgData; |
| | | @Autowired |
| | | Gate gate; |
| | | @RequestMapping("/addMsg.do") |
| | | public void addMsg(int formid,String doccode,String msg,String ruc,HttpServletRequest request,HttpServletResponse response){ |
| | | //CacheService cache=(CacheService)FactoryBean.getBean("cache"); |
| | | HttpSession session=request.getSession(); |
| | | String usercode = (String)session.getAttribute(SessionKey.HRCODE); |
| | | String username = (String)session.getAttribute(SessionKey.HRNAME); |
| | | String dbid = (String)session.getAttribute(SessionKey.DATA_BASE_ID);//数据源id |
| | | if(usercode==null){ |
| | | usercode=(String)session.getAttribute("@usercode");//用户ID |
| | | username=(String)session.getAttribute("@username");//用户名 |
| | | usercode=(String)session.getAttribute(SessionKey.USERCODE);//用户ID |
| | | username=(String)session.getAttribute(SessionKey.USERNAME);//用户名 |
| | | } |
| | | if(ruc==null||ruc.equals("")){//空值时 |
| | | ruc="All"; |
| | | } |
| | | String sql="set nocount on \n insert into _sys_OnlineMsg(formid,doccode,usercode,userName,msg,ReceiverUserCodes) values(?,?,?,?,?,?)"; |
| | | String dateTime=DateUtil.toDay(); |
| | | String sql="set nocount on \n insert into _sys_OnlineMsg(formid,doccode,usercode,userName,msg,ReceiverUserCodes,createtime) values(?,?,?,?,?,?,?)"; |
| | | try{ |
| | | SpObserver.setDBtoInstance("_"+request.getSession().getAttribute(SessionKey.DATA_BASE_ID)); |
| | | online.addMsg(sql, new Object[]{formid,doccode,usercode,username,msg,ruc}); |
| | | SpObserver.setDBtoInstance("_"+dbid); |
| | | online.addMsg(sql, new Object[]{formid,doccode,usercode,username,msg,ruc, dateTime}); |
| | | //增加推送功能 by danaus 2022/9/23 11:02 |
| | | gate.enterGateByOnlineMessages(new OnlineMessageEntity(username,usercode,msg,formid,doccode,ruc,Integer.parseInt(dbid),dateTime)); |
| | | this.print(response, "{\"info\":\"success\"}"); |
| | | }catch(Exception e){ |
| | | this.print(response, "{\"info\":\"error\",\"msg\":\""+this.getErrorMsg(e)+"\"}"); |
| | |
| | | } |
| | | } |
| | | /** |
| | | * 取得当前系统已加载的在线交流推送服务 |
| | | * |
| | | * @return |
| | | */ |
| | | public static Task getTaskByOnlineMessage(String dbid,int formid) { |
| | | Task task = null; |
| | | for (Map.Entry<String, Task> entry : pushTasksMap.entrySet()) { |
| | | if (entry.getKey().startsWith(dbid) && entry.getKey().endsWith(formid + "")) { |
| | | if("pushOnlineMessages".equalsIgnoreCase(entry.getValue().getActionType())) { |
| | | //取在线交流的task |
| | | task = entry.getValue(); |
| | | break; |
| | | }else { |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | if (task != null && task.getStatus() == 1) { |
| | | //启用才返回 |
| | | return task; |
| | | }else{ |
| | | |
| | | return null; |
| | | } |
| | | } |
| | | /** |
| | | * 取得当前系统已加载的推送服务 |
| | | * |
| | | * @return |
| | |
| | | import com.yc.sdk.WebSocketMessage.entity.MessageType; |
| | | import com.yc.sdk.WebSocketMessage.entity.WsMessageUserEntity; |
| | | import com.yc.service.BaseService; |
| | | import com.yc.service.impl.BaseDoIfc; |
| | | import org.springframework.jdbc.core.BeanPropertyRowMapper; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | |
| | | if (Thread.interrupted()) { |
| | | throw new InterruptedException(); |
| | | } |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | //log.info(dataSourceEntity.getSystemID() + "右下角弹窗开始....."); |
| | | SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId()); |
| | | BaseService baseService = (BaseService) FactoryBean.getBean("BaseService"); |
| | | BaseDoIfc doIfc = (BaseDoIfc) FactoryBean.getBean("baseDoImpl"); |
| | | BaseService baseService=(BaseService)FactoryBean.getBean("BaseService"); |
| | | //获取当前已连接webscoket的用户 |
| | | final List<WsMessageUserEntity> onlineUser = WebSocketMessageServer.getOnlineUser(dataSourceEntity.getDbId(), null); |
| | | StringJoiner joiner = new StringJoiner(","); |
| | |
| | | if(flag){ |
| | | //成功才更新次数 |
| | | collect.stream().forEach(z->{ |
| | | updateJoiner.add(" insert into @table(MessId,UserCode) values ( "+z.getMessid()+","+GridUtils.prossSqlParm(userCode)+")"); |
| | | updateJoiner.add(" if not exists(select 1 from @table where MessId = "+z.getMessid()+" and UserCode = "+GridUtils.prossSqlParm(userCode)+")\n" + |
| | | " begin\n" + |
| | | " insert into @table(MessId,UserCode) values ( "+z.getMessid()+","+GridUtils.prossSqlParm(userCode)+")\n" + |
| | | " end\n"); |
| | | }); |
| | | } |
| | | } |
| | |
| | | if(updateJoiner.length()>0) { |
| | | String sql = "set nocount on \n declare @table table(MessId int,UserCode varchar(50), Primary Key(MessId,UserCode))\n" + |
| | | updateJoiner.toString() + |
| | | " \n update a set tipcount = isnull(tipcount,0) + 1 \n" + |
| | | " \n update a set tipcount = isnull(tipcount,0) + 1,LastPushTime=getDate() \n" + |
| | | " from _sysMessageCount a \n" + |
| | | "where exists ( select 1 from @table b where a.MessId = b.MessId and a.UserCode = b.UserCode ) "; |
| | | |
| | | baseService.getSimpleJdbcTemplate().execute(sql); |
| | | "where exists ( select 1 from @table b where a.MessId = b.MessId and a.UserCode = b.UserCode and (a.LastPushTime is null or datediff(second,a.LastPushTime,getdate()) > 45 )) "; |
| | | doIfc.doExecute(sql); |
| | | //log.info(dataSourceEntity.getSystemID() + "右下角弹窗完成:"+sql); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } catch (InterruptedException ex) { |
| | |
| | | SpObserver.setDBtoInstance(); |
| | | } |
| | | } |
| | | |
| | | private void pushSystemMessage(MessageTipsEntity entity,SimpleDateFormat sdf) { |
| | | Map map=new HashMap(); |
| | | map.put("messagetxt",entity.getMessagetxt()); |
| | | map.put("unvaliddate",sdf.format(toString(entity.getUnvaliddate()))); |
| | | map.put("createtime",sdf.format(toString(entity.getCreatetime()))); |
| | | map.put("createusername",entity.getCreateusername()); |
| | | map.put("topic",entity.getTopic()); |
| | | map.put("messagetype",entity.getMessagetype()); |
| | | //---通知webscoket |
| | | MessageInfo messageInfo = new MessageInfo(); |
| | | messageInfo.setDbId(dataSourceEntity.getDbId()); |
| | | messageInfo.setMsgType(MessageType.POPUP_REMINDER); |
| | | messageInfo.setUserFromType("1");//TODO PC端 |
| | | messageInfo.setUserCode(entity.getUsercode()); |
| | | messageInfo.setMsg(JSON.toJSONString(map)); |
| | | WebSocketMessageServer.publishMessageToRedis(messageInfo); |
| | | } |
| | | |
| | | public String replaceBlank(String str) { |
| | | if (str == null || str == "") { return ""; } |
| | | Matcher m = null; |
| | |
| | | } |
| | | } |
| | | } else { |
| | | /*if (!isfound && domain.indexOf(":9010") > 0) {//TODO 测试用 |
| | | if (!isfound && domain.indexOf(":9010") > 0) {//TODO 测试用 |
| | | for (String s : domainList) { |
| | | if (s.indexOf(":9010") > 0) {// 优先9001,&&s.startsWith("192.168.100.202") |
| | | //s = getProtocol(map, s); |
| | |
| | | break; |
| | | } |
| | | } |
| | | }*/ |
| | | } |
| | | if (!isfound && domain.indexOf(":9001") > 0) { |
| | | for (String s : domainList) { |
| | | if (s.indexOf(":9001") > 0) {// 优先9001,&&s.startsWith("192.168.100.202") |
| | |
| | | SpObserver.setDBtoInstance(); |
| | | } |
| | | } |
| | | /** |
| | | *接收推送过来的在线交流信息 |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/open/mutual/postOnlineMessage.do") |
| | | @ResponseBody |
| | | public Object postOnlineMessage(HttpServletRequest request, HttpServletResponse response) { |
| | | //验证已在filter里面做,这里只需要处理业务逻辑 |
| | | CallBackMessage callBackMessage = new CallBackMessage(); |
| | | String data = null; |
| | | OnlineMessageEntity entity = null; |
| | | try { |
| | | String dbid = request.getAttribute(SessionKey.SHOPPING_DBID) + ""; |
| | | SpObserver.setDBtoInstance("_" + dbid); |
| | | data = URLDecoder.decode(request.getParameter("data"), "utf-8"); |
| | | entity = JSON.parseObject(data, OnlineMessageEntity.class); |
| | | mutualServiceIfc.postOnlineMessage(entity); |
| | | callBackMessage.sendSuccessMessageByDefault(); |
| | | return callBackMessage.toJSONObject(); |
| | | } catch (Exception e) { |
| | | //写错误日志 |
| | | this.sendErrorLog(entity.getFormid(), entity.getRefCode(), e); |
| | | callBackMessage.sendErrorMessage(e.getCause() != null ? (e.getCause().getMessage()).trim() : e.getMessage()); |
| | | return callBackMessage.toJSONObject(); |
| | | } finally { |
| | | SpObserver.setDBtoInstance(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.yc.open.mutual.entity; |
| | | |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | public class OnlineMessageEntity { |
| | | String createtime; |
| | | String username; |
| | | String usercode; |
| | | String msg; |
| | | String avatar; |
| | | Integer formid; |
| | | String doccode; |
| | | String unid; |
| | | Integer dbid; |
| | | String receiverUserCodes; |
| | | String refCode; |
| | | Integer onbus;//1表示是onbus调用进行推送,0表示客户系统, |
| | | |
| | | public OnlineMessageEntity(String username, String usercode, String msg, Integer formid, String doccode,String receiverUserCodes,int dbid,String createtime) { |
| | | this.username = username; |
| | | this.usercode = usercode; |
| | | this.msg = msg; |
| | | this.formid = formid; |
| | | this.doccode = doccode; |
| | | this.receiverUserCodes=receiverUserCodes; |
| | | this.dbid=dbid; |
| | | this.createtime=createtime; |
| | | } |
| | | } |
| | |
| | | import com.yc.open.deli.schedule.v2.DeliThread; |
| | | import com.yc.open.dinghuobang.schedule.DingHuoBangThread; |
| | | import com.yc.open.jinwu.yonya.schedule.T640210Thread; |
| | | import com.yc.open.mutual.entity.OnlineMessageEntity; |
| | | import com.yc.open.ufida.schedule.UfIdaGate; |
| | | import com.yc.open.wms.schedule.WMSThread; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | //--------210610撤销审核 |
| | | new Recovert210610Gate().run(entity); |
| | | } |
| | | public void enterGateByOnlineMessages(OnlineMessageEntity entity) throws Exception{ |
| | | threadPoolExecutor.execute(new OnLineMessagesThread(entity)); |
| | | } |
| | | } |
| | |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | |
| | | String bntName;//审核按钮名称,通过这个来确认是触发了那个按钮 |
| | | String userCode;//当前用户 |
| | | String userName;//当前用户 |
| | | //String sql;//用于在线交流,直接推送sql过去执行一次 |
| | | |
| | | public GateEntity(int formid, int winType, String checkPoint, String docCode, String dbid, String bntName) { |
| | | this.formid = formid; |
| | | this.winType = winType; |
New file |
| | |
| | | package com.yc.open.mutual.schedule; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.yc.action.grid.GridUtils; |
| | | import com.yc.entity.AttachmentConfig; |
| | | import com.yc.entity.DataSourceEntity; |
| | | import com.yc.exception.ApplicationException; |
| | | import com.yc.exception.CallBackMessage; |
| | | import com.yc.factory.FactoryBean; |
| | | import com.yc.multiData.MultiDataSource; |
| | | import com.yc.multiData.SpObserver; |
| | | import com.yc.open.controller.BaseController; |
| | | import com.yc.open.init.BaseGate; |
| | | import com.yc.open.init.InitSystemTaks; |
| | | import com.yc.open.init.Task; |
| | | import com.yc.open.mutual.controller.MutualController; |
| | | import com.yc.open.mutual.entity.AttachmentEntity; |
| | | import com.yc.open.mutual.entity.FormEntity; |
| | | import com.yc.open.mutual.entity.OnlineMessageEntity; |
| | | import com.yc.open.mutual.entity.T210604Entity; |
| | | import com.yc.open.mutual.service.MutualServiceIfc; |
| | | import com.yc.service.BaseService; |
| | | import com.yc.service.impl.BaseDoIfc; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 推送在线交流,不需要指定taskid,因为是固定取指定表的数据 |
| | | */ |
| | | public class OnLineMessagesThread extends BaseGate implements Runnable { |
| | | protected final Logger log = LoggerFactory.getLogger(this.getClass()); |
| | | //private static String TASKID = "OP0060";//指定任务ID,其他功能号也有对应的taskid |
| | | private OnlineMessageEntity entity; |
| | | |
| | | |
| | | public OnLineMessagesThread(OnlineMessageEntity entity) { |
| | | this.entity = entity; |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void run() { |
| | | MutualController mutualController=(MutualController)FactoryBean.getBean("mutualController"); |
| | | try { |
| | | SpObserver.setDBtoInstance("_" + entity.getDbid()); |
| | | Task task = InitSystemTaks.getTaskByOnlineMessage(entity.getDbid()+"",entity.getFormid()); |
| | | //满足条件才执行 |
| | | if (task != null ) { |
| | | MutualServiceIfc mutualServiceIfc=(MutualServiceIfc)FactoryBean.getBean("mutualServiceImpl"); |
| | | if(StringUtils.isBlank(task.getApiUrl())){ |
| | | //没填url表示是onbus调用,有值是客户系统调用 |
| | | entity.setOnbus(1); |
| | | } |
| | | OnlineMessageEntity onlineMessageEntity=mutualServiceIfc.getOnlineMessage(entity, task); |
| | | if (onlineMessageEntity != null) { |
| | | entity.setRefCode(onlineMessageEntity.getRefCode());//对方系统的docCode |
| | | entity.setDbid(onlineMessageEntity.getDbid()); |
| | | String body=JSON.toJSONString(entity); |
| | | String url=task.getApiUrl(); |
| | | String query=mutualController.getSignV3(body, task); |
| | | if(entity.getOnbus()!=null&&entity.getOnbus()==1){ |
| | | //通过dbid取得对方相关的信息,拼接url和生成签名 |
| | | query=mutualController.getSignV2(body, entity.getDbid()+""); |
| | | final DataSourceEntity dataSourceMap = MultiDataSource.getDataSourceMap(entity.getDbid() + ""); |
| | | url = mutualController.getSystemUrlByDataSource(dataSourceMap); |
| | | } |
| | | final String msg = mutualController.doPostByParameter(url +"/open/mutual/postOnlineMessage.do"+ query, body);//TODO task.getApiUrl() |
| | | CallBackMessage callBackMessage=JSON.parseObject(msg,CallBackMessage.class); |
| | | if(callBackMessage.getState()==-1){ |
| | | throw new ApplicationException(callBackMessage.getMsg()); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | ex.printStackTrace(); |
| | | mutualController.sendErrorLog(entity.getFormid(), entity.getDoccode(), ex); |
| | | log.error(ex.getMessage()); |
| | | } finally { |
| | | SpObserver.setDBtoInstance(); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | void post210604ToCustomer(T210604Entity entity); |
| | | void post210604ToOnbus(T210604Entity entity); |
| | | Integer deleteForm(int formid,String docCode); |
| | | |
| | | OnlineMessageEntity getOnlineMessage(OnlineMessageEntity entity, Task task); |
| | | |
| | | void postOnlineMessage(OnlineMessageEntity entity); |
| | | } |
| | |
| | | " end \n" ; |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public OnlineMessageEntity getOnlineMessage(OnlineMessageEntity entity, Task task) { |
| | | return this.jdbcTemplate.queryForObject("set nocount on\n" + |
| | | " declare @tableName varchar(50),@formid int="+entity.getFormid()+",@docCode varchar(50)='"+entity.getDoccode()+"',@isOnbus int="+entity.getOnbus()+"\n" + |
| | | " declare @sql nvarchar(2000),@ParmDefinition nvarchar(2000),@refCode varchar(50),@cltCode varchar(50),@dbid int\n" + |
| | | " select @tableName=hdtable from gform where formid=@formid\n" + |
| | | " select @sql ='select @refCode=refCode'\n" + |
| | | " if @isOnbus=1\n" + |
| | | " begin\n" + |
| | | " set @sql=@sql+',@cltCode=cltCode '\n" + |
| | | " set @sql=@sql+' from '+ isnull(@tableName,'') +' where doccode=@docCode'\n" + |
| | | " set @ParmDefinition = N'@refCode varchar(50) OUTPUT,@cltCode varchar(50) OUTPUT,@docCode nvarchar(50)'\n" + |
| | | " EXEC sp_executesql @sql , @ParmDefinition ,@refCode OUTPUT,@cltCode OUTPUT, @docCode \n" + |
| | | " select @dbid=dbid from t110203 where cltcode=@cltCode\n" + |
| | | " end\n" + |
| | | " else\n" + |
| | | " begin\n" + |
| | | " set @sql=@sql+' from '+ isnull(@tableName,'') +' where doccode=@docCode'\n" + |
| | | " set @ParmDefinition = N'@refCode varchar(50) OUTPUT ,@docCode nvarchar(50)'\n" + |
| | | " EXEC sp_executesql @sql , @ParmDefinition ,@refCode OUTPUT, @docCode \n" + |
| | | " end\n" + |
| | | " select @refCode as refCode,@dbid as dbid",new BeanPropertyRowMapper<>(OnlineMessageEntity.class)); |
| | | } |
| | | @Transactional |
| | | @Override |
| | | public void postOnlineMessage(OnlineMessageEntity entity) { |
| | | this.jdbcTemplate.update("set nocount on\n" + |
| | | " insert into _sys_OnlineMsg(formid,doccode,usercode,userName,msg,ReceiverUserCodes,createtime) values(?,?,?,?,?,?,?)",entity.getFormid(),entity.getRefCode(),entity.getUsercode(),entity.getUsername(),entity.getMsg(),entity.getReceiverUserCodes(),entity.getCreatetime()); |
| | | } |
| | | } |
| | |
| | | public void push120380(HttpServletRequest request, HttpServletResponse response) { |
| | | String docCode = null;//单号 |
| | | String formid = null;//功能号 |
| | | CallBackMessage callBackMessage=new CallBackMessage(); |
| | | try { |
| | | Map<String, String> map = null; |
| | | DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request); |
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error(e.getCause() != null ? e.getCause().getMessage() : e.getMessage()); |
| | | this.print(response, this.getErrorMsg(e)); |
| | | this.printJson(response, callBackMessage.sendErrorMessage(this.getErrorMsg(e))); |
| | | return; |
| | | } finally { |
| | | SpObserver.setDBtoInstance(); |
| | |
| | | if (log.isDebugEnabled()) { |
| | | log.error("通过22类型传进来组装出来的map:" + map.toString()); |
| | | } |
| | | this.print(response, "单号不能为空"); |
| | | this.printJson(response, callBackMessage.sendErrorMessage("单号不能为空")); |
| | | return; |
| | | } |
| | | if (formid == null) { |
| | | if (log.isDebugEnabled()) { |
| | | log.error("通过22类型传进来组装出来的map:" + map.toString()); |
| | | } |
| | | this.print(response, "功能号不能为空"); |
| | | this.printJson(response, callBackMessage.sendErrorMessage("功能号不能为空")); |
| | | return; |
| | | } |
| | | SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId()); |
| | |
| | | if ("success".equalsIgnoreCase(responseEntity.getFlag())) { |
| | | //--更新状态 |
| | | wmsServiceIfc.updateDocStatus(pushEntity, responseEntity.getDeliveryOrderId()); |
| | | this.print(response, "推送成功"); |
| | | this.printJson(response, callBackMessage.toJSONStringByMemo("推送成功")); |
| | | } else { |
| | | log.info("" + responseEntity.getCode() + ":" + responseEntity.getMessage()); |
| | | throw new ApplicationException(responseEntity.getCode() + "-" + responseEntity.getMessage()); |
| | |
| | | } else { |
| | | throw new ApplicationException("接收返回结果数据为空"); |
| | | } |
| | | }else{ |
| | | this.printJson(response, callBackMessage.toJSONStringByMemo("没有需要推送的数据:"+docCode)); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | |
| | | e.printStackTrace(); |
| | | this.sendErrorLog(Integer.parseInt(formid), docCode, e); |
| | | String errorMsg = (e.getCause() != null ? (e.getCause().getMessage()).trim() : e.getMessage()); |
| | | this.print(response, errorMsg); |
| | | this.printJson(response, callBackMessage.sendErrorMessage(errorMsg)); |
| | | } finally { |
| | | SpObserver.setDBtoInstance(); |
| | | } |
| | |
| | | public void pushSale(HttpServletRequest request, HttpServletResponse response) { |
| | | String docCode = null;//单号 |
| | | String formid = null;//功能号 |
| | | CallBackMessage callBackMessage=new CallBackMessage(); |
| | | try { |
| | | Map<String, String> map = null; |
| | | DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request); |
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error(e.getCause() != null ? e.getCause().getMessage() : e.getMessage()); |
| | | this.print(response, this.getErrorMsg(e)); |
| | | this.printJson(response, callBackMessage.sendErrorMessage(this.getErrorMsg(e))); |
| | | return; |
| | | } finally { |
| | | SpObserver.setDBtoInstance(); |
| | |
| | | if (log.isDebugEnabled()) { |
| | | log.error("通过22类型传进来组装出来的map:" + map.toString()); |
| | | } |
| | | this.print(response, "单号不能为空"); |
| | | this.printJson(response, callBackMessage.sendErrorMessage("单号不能为空")); |
| | | return; |
| | | } |
| | | if (formid == null) { |
| | | if (log.isDebugEnabled()) { |
| | | log.error("通过22类型传进来组装出来的map:" + map.toString()); |
| | | } |
| | | this.print(response, "功能号不能为空"); |
| | | this.printJson(response, callBackMessage.sendErrorMessage("功能号不能为空")); |
| | | return; |
| | | } |
| | | if ("120380".equals(formid)) { |
| | | this.print(response, "120380功能号不能调用本接口进行推送"); |
| | | this.printJson(response, callBackMessage.sendErrorMessage("120380功能号不能调用本接口进行推送")); |
| | | return; |
| | | } |
| | | SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId()); |
| | |
| | | if ("success".equalsIgnoreCase(responseEntity.getFlag())) { |
| | | //--更新状态 |
| | | wmsServiceIfc.updateDocStatus(pushEntity, responseEntity.getDeliveryOrderId()); |
| | | this.print(response, "推送成功"); |
| | | this.printJson(response, callBackMessage.toJSONStringByMemo("推送成功")); |
| | | } else { |
| | | log.info("" + responseEntity.getCode() + ":" + responseEntity.getMessage()); |
| | | throw new ApplicationException(responseEntity.getCode() + "-" + responseEntity.getMessage()); |
| | |
| | | } else { |
| | | throw new ApplicationException("接收返回结果数据为空"); |
| | | } |
| | | }else{ |
| | | this.printJson(response, callBackMessage.toJSONStringByMemo("没有需要推送的数据:"+docCode)); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | |
| | | e.printStackTrace(); |
| | | this.sendErrorLog(Integer.parseInt(formid), docCode, e); |
| | | String errorMsg = (e.getCause() != null ? (e.getCause().getMessage()).trim() : e.getMessage()); |
| | | this.print(response, errorMsg); |
| | | this.printJson(response, callBackMessage.sendErrorMessage(errorMsg)); |
| | | } finally { |
| | | SpObserver.setDBtoInstance(); |
| | | } |
| | |
| | | public void pushorder(HttpServletRequest request, HttpServletResponse response) { |
| | | String docCode = null;//单号 |
| | | String formid = null;//功能号 |
| | | CallBackMessage callBackMessage=new CallBackMessage(); |
| | | try { |
| | | Map<String, String> map = null; |
| | | DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request); |
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error(e.getCause() != null ? e.getCause().getMessage() : e.getMessage()); |
| | | this.print(response, this.getErrorMsg(e)); |
| | | this.printJson(response, callBackMessage.sendErrorMessage(this.getErrorMsg(e))); |
| | | return; |
| | | } finally { |
| | | SpObserver.setDBtoInstance(); |
| | |
| | | if (log.isDebugEnabled()) { |
| | | log.error("通过22类型传进来组装出来的map:" + map.toString()); |
| | | } |
| | | this.print(response, "单号不能为空"); |
| | | this.printJson(response, callBackMessage.sendErrorMessage("单号不能为空")); |
| | | return; |
| | | } |
| | | SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId()); |
| | |
| | | if ("success".equalsIgnoreCase(responseEntity.getFlag())) { |
| | | //--更新状态 |
| | | wmsServiceIfc.updateDocStatus(pushEntity, responseEntity.getEntryOrderId()); |
| | | this.print(response, "推送成功"); |
| | | this.printJson(response, callBackMessage.toJSONStringByMemo("推送成功")); |
| | | } else { |
| | | log.info("" + responseEntity.getCode() + ":" + responseEntity.getMessage()); |
| | | throw new ApplicationException(responseEntity.getCode() + "-" + responseEntity.getMessage()); |
| | |
| | | } else { |
| | | throw new ApplicationException("接收返回结果数据为空"); |
| | | } |
| | | }else{ |
| | | this.printJson(response, callBackMessage.toJSONStringByMemo("没有需要推送的数据:"+docCode)); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | |
| | | e.printStackTrace(); |
| | | this.sendErrorLog(Integer.parseInt(formid), docCode, e); |
| | | String errorMsg = (e.getCause() != null ? (e.getCause().getMessage()).trim() : e.getMessage()); |
| | | this.print(response, errorMsg); |
| | | this.printJson(response, callBackMessage.sendErrorMessage(errorMsg)); |
| | | } finally { |
| | | SpObserver.setDBtoInstance(); |
| | | } |
| | |
| | | @RequestMapping(value = "/jinwu/push110514.do") |
| | | public void push110514(HttpServletRequest request, HttpServletResponse response) { |
| | | String docCode = null;//单号 |
| | | CallBackMessage callBackMessage=new CallBackMessage(); |
| | | try { |
| | | Map<String, String> map = null; |
| | | DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request); |
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error(e.getCause() != null ? e.getCause().getMessage() : e.getMessage()); |
| | | this.print(response, this.getErrorMsg(e)); |
| | | this.printJson(response, this.getErrorMsg(e)); |
| | | return; |
| | | } finally { |
| | | SpObserver.setDBtoInstance(); |
| | |
| | | if (log.isDebugEnabled()) { |
| | | log.error("通过22类型传进来组装出来的map:" + map.toString()); |
| | | } |
| | | this.print(response, "单号不能为空"); |
| | | this.printJson(response, callBackMessage.sendErrorMessage("单号不能为空")); |
| | | return; |
| | | } |
| | | SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId()); |
| | |
| | | } |
| | | } |
| | | if (list != null && list.size() > 0) { |
| | | this.print(response, "推送成功"); |
| | | this.printJson(response, callBackMessage.toJSONStringByMemo("推送成功")); |
| | | } |
| | | } catch (Exception e) { |
| | | //写错误日志 |
| | | e.printStackTrace(); |
| | | this.sendErrorLog(110514, docCode, e); |
| | | String errorMsg = (e.getCause() != null ? (e.getCause().getMessage()).trim() : e.getMessage()); |
| | | this.print(response, errorMsg); |
| | | this.printJson(response, callBackMessage.sendErrorMessage(errorMsg)); |
| | | } finally { |
| | | SpObserver.setDBtoInstance(); |
| | | } |
| | |
| | | if ("success".equalsIgnoreCase(responseEntity.getFlag())) { |
| | | //--更新状态,清空之前推送成功的信息,还原成可以继续推送 |
| | | wmsServiceIfc.updateDocStatusByCancel(pushEntity); |
| | | //this.print(response, "取消确认成功"); |
| | | //this.printJson(response, "取消确认成功"); |
| | | } else { |
| | | throw new ApplicationException(responseEntity.getCode() + ":" + responseEntity.getMessage()); |
| | | } |