河南大学吧 关注:642,046贴子:21,328,356

回复:学弟学妹们 我是程序媛呦 萌萌哒的

只看楼主收藏回复

大学僧进化体 程序猿


来自iPhone客户端53楼2015-09-11 16:16
回复
    别再玩躲猫猫了


    来自Android客户端54楼2015-09-11 16:19
    回复
      学姐求


      来自iPhone客户端55楼2015-09-11 16:44
      回复
        程雨熙


        来自Android客户端57楼2015-09-11 16:58
        收起回复
          public String Trustee() {
          MSLog.debug("@@BankTrusteeService开始执行报备"+ "------时间:" + DateUtil.getParseDate( Constants.TIME_FORMAT, new Date()));
          //1.查询所有前一天bus进件中放款成功的工单信息
          Map<String,Object> condition = new HashMap<String, Object>();//添加查询条件
          Date yesterday = DateUtil.getYesterday();//获取昨天
          String strYesterday = DateUtil.msFormatDateTime(yesterday, Constants.DATE_FORMAT);
          condition.put("startDate", strYesterday+" 23:30:00");
          Date today = DateUtil.msGetCurrentDate();
          String strToday = DateUtil.msFormatDateTime(today, Constants.DATE_FORMAT);
          condition.put("endDate", strToday+" 23:30:00");
          List<TLonApplication> lonApplications = bankTrusteeShipMapper.selectApps(condition);
          //2.将符合条件的工单信息插入报备表t_lon_bank_trustee
          if (lonApplications!=null && lonApplications.size()>0) {
          MSLog.debug("存在需要新报备的工单记录,执行插入报备表操作"+JsonUtil.list2json(lonApplications)+ "------时间:" + DateUtil.getParseDate( Constants.TIME_FORMAT, new Date()));
          insert(lonApplications);
          MSLog.debug("插入报备表结束------时间:" + DateUtil.getParseDate( Constants.TIME_FORMAT, new Date()));
          }
          //3.从报备表中查询所有未进行报备的记录
          MSLog.debug("从报备表中获取所有未报备的数据------时间:" + DateUtil.getParseDate( Constants.TIME_FORMAT, new Date()));
          List<BankTrusteeShip> records = bankTrusteeShipMapper.selectAll("0");
          MSLog.debug("从报备表中获取所有未报备的数据结束---"+JsonUtil.list2json(records)+"---时间:" + DateUtil.getParseDate( Constants.TIME_FORMAT, new Date()));
          records = validate(records);
          MSLog.debug("数据校验结束---"+JsonUtil.list2json(records)+"---时间:" + DateUtil.getParseDate( Constants.TIME_FORMAT, new Date()));
          if (records != null && records.size() > 0) {
          //4.生成报备文件
          String fileName = createFile(records);
          if (fileName != null) {
          //5.将文件上传至sftp
          MSLog.debug("开始向sftp上传报备文件------时间:" + DateUtil.getParseDate( Constants.TIME_FORMAT, new Date()));
          String ftpIp = ParameterPub.getSystemParam().getSystemSetting().getProperty("bank_sFtp_ip");//sftp地址
          String ftpPort = ParameterPub.getSystemParam().getSystemSetting().getProperty("bank_sFtp_port");//sftp端口号
          String ftpUser = ParameterPub.getSystemParam().getSystemSetting().getProperty("bank_sFtp_userName");//sftp用户名
          String ftpPwd = ParameterPub.getSystemParam().getSystemSetting().getProperty("bank_sFtp_passWord");//sftp密码
          String ftpDir = ParameterPub.getSystemParam().getSystemSetting().getProperty("bank_sFtp_path");//sftp上传路径
          String fileDir = ParameterPub.getSystemParam().getSystemSetting().getProperty("BankTrusteeShipDir");//文件的本地地址
          String fileNameToUp = fileName+".txt";
          boolean loanFileUploadFTP = loanFTPService.loanFileUploadFTP(ftpIp, Integer.parseInt(ftpPort), ftpUser, ftpPwd, fileDir, fileNameToUp, ftpDir, "");
          MSLog.debug("向sftp上传报备文件结束,返回值:"+loanFileUploadFTP+"------时间:" + DateUtil.getParseDate( Constants.TIME_FORMAT, new Date()));
          if ( !loanFileUploadFTP ){
          // 上传报备文件失败,同时终止程序
          MSLog.info( "上传报备文件失败-------" + fileNameToUp + "------时间:" + DateUtil.getParseDate( Constants.TIME_FORMAT, new Date()));
          return "fail";
          }
          //6.调用账务系统上传报备文件
          String url = ParameterPub.getSystemParam().getSystemSetting().getProperty("BankTrusteeShip");
          Map<String, String> params = new HashMap<String, String>();
          params.put("fullPath", ftpDir+fileNameToUp);
          try {
          MSLog.debug("开始调用账务接口进行报备url:"+url+" params:"+JsonUtil.map2json(params)+"------时间:" + DateUtil.getParseDate( Constants.TIME_FORMAT, new Date()));
          String result = HttpClientUtil.doHttpPost(url, "GBK", params, 60000);
          MSLog.debug("调用账务接口进行报备结束,返回值:"+result+"------时间:" + DateUtil.getParseDate( Constants.TIME_FORMAT, new Date()));
          if (result != null && !result.equals("")) {
          //响应信息转换对象操作
          JsonNode node = mapper.readTree(result);
          //响应码
          String strCode = node.get("resp_code").getTextValue();
          if (strCode!= null && "0000".equals(strCode)) {
          MSLog.debug("通知账务进行报备成功,开始更新报备表数据------时间:" + DateUtil.getParseDate( Constants.TIME_FORMAT, new Date()));
          //7.更新报备表数据
          for (int j = 0; j < records.size(); j++) {
          Map<String, Object> conditions = new HashMap<String, Object>();
          conditions.put("appId", records.get(j).getAppId());
          conditions.put("isTrustee", "1");
          conditions.put("lastUpDate", DateUtil.getCurrentTime(Constants.TIME_FORMAT));
          conditions.put("fileName", ftpDir+fileNameToUp);
          bankTrusteeShipMapper.updateIsTrustee(conditions);
          }
          MSLog.debug("更新报备表数据成功,报备任务结束------时间:" + DateUtil.getParseDate( Constants.TIME_FORMAT, new Date()));
          return "success";
          } else {
          MSLog.debug("报备失败"+result+ "------时间:" + DateUtil.getParseDate( Constants.TIME_FORMAT, new Date()));
          return "fail";
          }
          }else {
          MSLog.debug("报备失败"+result+ "------时间:" + DateUtil.getParseDate( Constants.TIME_FORMAT, new Date()));
          return "fail";
          }
          } catch (Exception e) {
          MSLog.debug("调用账务系统进行报备异常",e);
          return "fail";
          }
          } else {
          MSLog.debug("生成报备文件失败---时间:" + DateUtil.getParseDate( Constants.TIME_FORMAT, new Date()));
          return "fail";
          }
          } else {
          MSLog.debug("没有需要报备的数据---时间:" + DateUtil.getParseDate( Constants.TIME_FORMAT, new Date()));
          return "success";
          }
          }


          58楼2015-09-11 17:02
          收起回复
            程序猿


            来自Android客户端59楼2015-09-11 17:03
            收起回复
              学姐,能加微信吗?15040658600


              来自手机贴吧61楼2015-09-11 17:38
              收起回复
                医学院帮顶


                IP属地:河南来自WindowsPhone客户端62楼2015-09-11 17:40
                收起回复


                  IP属地:上海来自Android客户端63楼2015-09-11 17:44
                  收起回复
                    好高大上的职业,好羡慕


                    来自Android客户端64楼2015-09-11 18:38
                    收起回复
                      这么漂亮的程序辕


                      来自Android客户端65楼2015-09-11 18:41
                      收起回复
                        软件学院计算机科学与技术路过,但是没有去实训真心不想干这一行


                        来自iPhone客户端67楼2015-09-11 18:49
                        收起回复
                          开玩笑 这是你


                          IP属地:河南来自iPhone客户端68楼2015-09-11 19:20
                          收起回复