技术积累3

关于程序化交易资料网址
http://blog.csdn.net/dipolar/article/details/50752839
http://blog.csdn.net/shuigge/article/details/72829826




禁止滚轮+ctr调整页面大小
var scrollFunc=function(e){
e=e || window.event;
if(e.wheelDelta && event.ctrlKey){
//IE/Opera/Chrome
event.returnValue=false;
}else if(e.detail){
//Firefox
event.returnValue=false;
}
}
/*注册事件*/
if(document.addEventListener){
document.addEventListener('DOMMouseScroll',scrollFunc,false);
}
//W3C
window.onmousewheel=document.onmousewheel=scrollFunc;
//IE/Opera/Chrome/Safari
</script> 




form提交新生成页面,加入属性target=_blank
<form style="margin-top: 10px;margin-left: 70px;" action="${ctx}/search" method="post" target="_blank">


tomcat服务器部署配置文件修改
Sever Locations 选择Use custom location
Sever path 默认到tomcat目录
Deploy path: webapps
将项目导出为war文件,删除tomcat下的webapp下面的项目,然后将war报拷入,启动Tomcat
启动文件在Tomcat的bin目录下windows: startup.bat  linux: ./catalina startup


按照数学模型的理念和对计算机技术的利用方式,量化交易可以进一步细分为自动化交易(Automatic Trading)、量化
投资(Quantitative Investment)、程序化交易(Program Trading)、算法交易(Algorithm Trading)以及高频交
易(High Frequency Trading)。这五种量化交易方式的侧重点各有不同,是量化交易技术发展到不同阶段的产物,也
是不同量化交易用户群的不同交易方式。




奇偶循环,奇数和偶数的样式不一样,用status判断是奇数行还是偶数行,然后再循环出来。
<c:forEach items="${page.list}" var="article" varStatus="status">
    <c:choose>
<c:when test="${status.index%2 == 0}">
      <div align="center">
<table style="width: 75%;background-color: #FFFFFF">
   <tr>
      <td width="50%;"><img src="${article.image}" width="540px;" height="345px;"></td>
      <td bgcolor="#FFFFFF" width="50%;" align="center">
         <table style="height: 320px; width: 60%;">
             <tr>
                <td valign="bottom"><font color="#4D5981" size="5px">${fns:abbr(article.keywords,20)}</font></td>
             </tr>
             <tr>
                <td><font color="#4D5981" size="5px">${fns:abbr(article.title,28)}</font></td>
             </tr>
             <tr>
                <td> 
                <font color="#AEACAD">
                 ${fns:abbr(article.description,200)}
                </font>
                </td>
             </tr>
             <tr>
                <td valign="bottom"><a href="${article.url}"><img src="${pageContext.request.contextPath}/images/y-1.jpg" width="40px;" height="40px;"></a></td>
             </tr>
             <tr>
                <td valign="top"><font color="#AEACAD">查看详情</font></td>
             </tr>
         </table>
      </td>
   </tr>
 </table>
      </div>
      </c:when>
      <c:otherwise>
      <div align="center">
<table style="width: 75%;background-color: #FFFFFF">
   <tr> 
      <td bgcolor="#FFFFFF" width="50%;" align="center">
         <table style="height: 320px; width: 60%;">
             <tr>
                <td valign="bottom"><font color="#4D5981" size="5px">${fns:abbr(article.keywords,20)}</font></td>
             </tr>
             <tr>
                <td><font color="#4D5981" size="5px">${fns:abbr(article.title,28)}</font></td>
             </tr>
             <tr>
                <td> 
                <font color="#AEACAD">
                 ${fns:abbr(article.description,200)}
                </font>
                </td>
             </tr>
             <tr>
                <td valign="bottom"><a href="${article.url}"><img src="${pageContext.request.contextPath}/images/y-1.jpg" width="40px;" height="40px;"></a></td>
             </tr>
             <tr>
                <td valign="top"><font color="#AEACAD">查看详情</font></td>
             </tr>
         </table>
      </td>
      <td width="50%;"><img src="${article.image}" width="540px;" height="345px;"></td>
   </tr>
 </table>
      </div>
      </c:otherwise>
      </c:choose>
      </c:forEach>
    </c:if>  


页面样式问题可以按F12找到引用的样式问题,逐个调试找到根源问题,看到底是哪一个样式影响此标签。
network直接看请求的信息


前端日期格式转换
$("#maxEndDate").val(time.format("yyyy-MM-dd hh:mm:ss")); 


后台日期格式转换
public Page<Contract> getContractList(String page, String rows, String contractId, String contractName, String words,
@DateTimeFormat(pattern="yyyy-MM-dd") Date startime, @DateTimeFormat(pattern="yyyy-MM-dd") Date endtime, String contractStatus,HttpServletRequest request) {
    在spring配置文件开启    
<!-- 默认的注解映射的支持 -->
<mvc:annotation-driven />


dao.xml文件里面的参数如果传的是类,
testMapper.findAllList(@Param(value = "option") EmployeeOption option)
则xml文件
<select id="getHolidayList" resultType="com.zhaodin.oa.entity.Holiday" >
SELECT 
            h.holiday_id AS holiday_id,
h.employee_id AS employee_id,
e.employee_name AS employee_name,
vt.vacation_type AS vacation_type,
vt.vacation_name AS vacation_name,
h.number AS number,
h.remark AS remark,
h.create_time AS create_time,
c.employee_name AS create_name
FROM 
            t_holiday h  
            LEFT JOIN(t_dept a,t_employee e,vacation_type vt,t_employee c)
ON(
   a.id = e.dept_id
   AND h.employee_id = e.employee_id
   AND h.vacation_type = vt.vacation_type
   AND h.create_empid = c.employee_id
  )
WHERE        1 = 1
            <if test="option.vacation_type != null">
            AND h.vacation_type = #{option.vacation_type}
            </if>
            <if test="option.dept_id != null and option.dept_id != ''">
        AND a.id = #{option.dept_id}
            </if>
            <if test="option.employee_name != null and option.employee_name != ''">
        AND e.employee_name = #{option.employee_name}
            </if>
            <if test="option.employee_id != null and option.employee_id != ''">
        AND h.employee_id = #{option.employee_id}
            </if>
</select>




后天接收json数据乱码是可以将数据格式先转换一下。
@RequestMapping("/abnormal.do")
public String abnormal(HttpServletRequest request, String employee_id, String employee_name, String attYearMonth) {
try {
String emp_name = new String(employee_name.getBytes("ISO8859-1"), "utf-8");//转换数据格式
request.setAttribute("employee_name", emp_name);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
request.setAttribute("employee_id", employee_id);
request.setAttribute("attYearMonth", attYearMonth);
return "sign/abnormal";
}


Mysql函数的调用方式
<select id="getJointList" parameterType="com.zhaodin.oa.entity.JointInfo" useCache="false"
         statementType="CALLABLE" >  
        <![CDATA[ 
        call getRouter(  //函数或存储过程名称
        #{employeeId,mode=IN,jdbcType=INTEGER},
        #{routerType,mode=IN,jdbcType=VARCHAR},
        #{deptLevel,mode=IN,jdbcType=INTEGER},
        #{routerList,mode=OUT,jdbcType=VARCHAR});
         ]]>
    </select>
传进来的参数为类,返回的参数也为此类,不用再另外规定返回类别,in指的是输入的参数,out指的是输出的参数。




easyUI onchange事件的调用
$(function(){
getVacationInfo();
$("#endtime").datebox({onChange: function () {countTime();}});
$("#starttime").datebox({onChange: function () {countTime();}});
$("#am").combobox({onChange: function () {countTime();}});
$("#pm").combobox({onChange: function () {countTime();}});
$("#counttime").textbox({onChange: function (){onLoad();}});
})
// 加载审批流程
function onLoad(){
var url = '${pageContext.request.contextPath}/event/toLoadProcess.do?dnum='+count_num+'&type='+'vacation'+'&random='+Math.random();
$.ajax({
url: url,
async: false,
datatype: "jsonp",
type: "get",
success: function(result){
var dataObj = JSON.parse(result);//返回的result为json格式的数据
con = "";
$.each(dataObj, function(index, item){
con += "<li style='float: left;list-style:none;'>"+item.dept_position+":"+item.check_name;
if(index<dataObj.length-1){
con +="&nbsp;&nbsp;→&nbsp;&nbsp;"
}

});
con +="</li>";
$("#con").html(con); //把内容入到这个div或者td中即完成
}
});
}


// 获取假期信息,从后台获取数据
function getVacationInfo(){
var url = '${pageContext.request.contextPath}/event/getVacationType.do?random='+Math.random();
$.ajax({
url: url,
async: false,
datatype: "jsonp",
type: "get",
success: function(data){
data=JSON.parse(data);
$('#vacation_type').combobox({
valueField:'vacation_type',
       textField:'vacation_name',
       data: data
});
}


});
}


//新增请休假申请
function addVacation(){
if(flag){
var cause = $('#cause').val();
if(cause == null || cause ==''){
$.messager.alert('提示','请输入事由!');
return false;
}
$('#fm').form('submit',{
url: "${pageContext.request.contextPath}/event/addVacation.do",
onSubmit: function(param){
param.number = $('#number').val();
param.vacation_type = $('#vacation_type').val();
param.starttime = $('#starttime').val() + ' ' + $('#am').val();
param.endtime = $('#endtime').val() + ' ' + $('#pm').val();
param.counttime = $('#counttime').text();
param.cause = $('#cause').val(); 
return $(this).form('validate');
},
success:function(response){
response = JSON.parse(response);
if(response.code !== 200){
$.messager.alert('提示',response.msg);
}else{
$.messager.alert('提示',response.msg, null, function(){
window.location.reload();
});
}
}
});
}else{
$.messager.alert('提示',msg);
}
}


               


            自动生成编码思路
                        DATECR dateCr = new DATECR();//获取工具类
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
String today = format.format(new Date()); //将日期转成字符串
String maxOrderno = eventService.findMaxOvertimeNum(today); //查出数据库最大编号
String creatOptionId = dateCr.creatOptionId(maxOrderno, "CC");//传入参数生成编号
overtime.setOvertime_num(creatOptionId);


           查询最大编号方法
                       <select id="findMaxNum" resultType="string">
      SELECT
      max(vacation_num)  as vacation_num
      FROM 
      t_vacation
      WHERE
      vacation_num like CONCAT('%',#{day},'%') //只取中间值的模糊查询的写法
              </select>
           工具类
           public class DATECR {
            private String orderno;
  public String creatOptionId(String maxOrderno,String str) {
            SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd"); // 时间字符串产生方式
            String uid_pfix = "DOC_"+ str+ "_" + format.format(new Date()); // 组合流水号前一部分,NO+时间字符串,如:NO20160126
            if (maxOrderno != null && maxOrderno.contains(uid_pfix)) {
                String uid_end = maxOrderno.substring(15, 19); // 截取字符串最后四位,结果:0001             
                int endNum = Integer.parseInt(uid_end); // 把String类型的0001转化为int类型的1   
                int tmpNum = 10000 + endNum + 1; // 结果10002    
                orderno = uid_pfix + Tools.subStr("" + tmpNum, 1);// 把10002首位的1去掉,再拼成NO201601260002字符串
            } else {
                orderno = uid_pfix + "0001";
            }
            return orderno;
            }

            }
         
        //截取字符串
            public class Tools {
public static String subStr(String str, int start) {
        if (str == null || str.equals("") || str.length() == 0)
            return "";
        if (start < str.length()) {
            return str.substring(start);
        } else {
            return "";
        }


        }
        }


          
       mybatis 的case when 的查询方法


       select '姓名',
       max{case'课程'when'语文'then'分数'else 0 end }'语文'
       max{case'课程'when'数学'then'分数'else 0 end }'数学'
       max{case'课程'when'英语'then'分数'else 0 end }'英语'
       from stu
       order by '姓名'


       查询结果


       姓名   语文   数学   英语
       张三    87     89     91
       李四    77     99     89


      连接中打开新窗口
      rel属性


      HTML4.0增加了一个新属性:rel,这个属性用来说明链接和包含此链接页面的关系,以及链接打开的目 标。rel有许多的属性值,比如next、previous,、chapter、section等等。我们要使用的就是rel="externa l"属性。原来这样写的代码:


      <a href="document.html" target="_blank"> 打开一个新窗口</a>
      
      现在要写成这样:


      <a href="document.html" rel="external">打开一个 新窗口</a>
      
      这是符合strict标准的方法。当然还必须配合一个javascript才有效。


      javascript


      完整的代码JS如下:


      function externallinks() { 
      if (!document.getElementsByTagName) return; 
      var anchors = document.getElementsByTagName("a"); 
      for (var i=0; i<anchors.length; i++) { 
      var anchor = anchors[i]; 
      if (anchor.getAttribute("href") && 
      anchor.getAttribute("rel") == "external") 
      anchor.target = "_blank"; 
      } 
      } 
      window.onload = externallinks;


      你可以把它保存成一个.js文件(比如external.js),然后通过外部联接方法调用:


      <script type="text/javascript" src="external.js"></script>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值