├── src └── main │ ├── webapp │ ├── images │ │ ├── alipay.png │ │ ├── wechat.png │ │ ├── alipay0.1.png │ │ └── wechat0.1.png │ ├── res │ │ ├── foldingMenu │ │ │ ├── 使用方法.txt │ │ │ ├── index.html │ │ │ ├── images │ │ │ │ ├── pro_down.png │ │ │ │ └── pro_left.png │ │ │ ├── css │ │ │ │ └── lrtk.css │ │ │ └── js │ │ │ │ └── html5.js │ │ ├── My97DatePicker │ │ │ ├── 开发包 │ │ │ │ ├── readme.txt │ │ │ │ ├── lang │ │ │ │ │ ├── zh-cn.js │ │ │ │ │ ├── zh-tw.js │ │ │ │ │ └── en.js │ │ │ │ └── skin │ │ │ │ │ ├── datePicker.gif │ │ │ │ │ ├── default │ │ │ │ │ ├── img.gif │ │ │ │ │ └── datepicker.css │ │ │ │ │ ├── whyGreen │ │ │ │ │ ├── bg.jpg │ │ │ │ │ ├── img.gif │ │ │ │ │ └── datepicker.css │ │ │ │ │ └── WdatePicker.css │ │ │ ├── skin │ │ │ │ ├── datePicker.gif │ │ │ │ ├── default │ │ │ │ │ └── img.gif │ │ │ │ ├── whyGreen │ │ │ │ │ ├── bg.jpg │ │ │ │ │ └── img.gif │ │ │ │ └── WdatePicker.css │ │ │ └── lang │ │ │ │ ├── en.js │ │ │ │ ├── zh-cn.js │ │ │ │ └── zh-tw.js │ │ ├── css │ │ │ ├── about.css │ │ │ ├── monthlyStatistics.css │ │ │ ├── manageItems.css │ │ │ ├── user.register.css │ │ │ ├── frame.css │ │ │ ├── managePayMethods.css │ │ │ ├── history.css │ │ │ ├── inOrOut.css │ │ │ └── public.css │ │ ├── layer │ │ │ └── skin │ │ │ │ └── default │ │ │ │ ├── icon.png │ │ │ │ ├── icon-ext.png │ │ │ │ ├── loading-0.gif │ │ │ │ ├── loading-1.gif │ │ │ │ └── loading-2.gif │ │ ├── bootstrap-3.3.5-dist │ │ │ ├── fonts │ │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ │ └── glyphicons-halflings-regular.woff2 │ │ │ └── js │ │ │ │ └── npm.js │ │ └── js │ │ │ ├── user.logout.js │ │ │ ├── about.js │ │ │ ├── user.login.js │ │ │ ├── monthlyStatistics.js │ │ │ ├── common │ │ │ ├── validator.js │ │ │ ├── common.js │ │ │ └── incomeAndExpenditure.js │ │ │ ├── manageItems.js │ │ │ ├── income.js │ │ │ ├── expenditure.js │ │ │ ├── user.register.js │ │ │ └── managePayMethods.js │ ├── pages │ │ ├── frame.jsp │ │ ├── common │ │ │ └── common.jsp │ │ ├── head.jsp │ │ ├── about.jsp │ │ ├── userActive.jsp │ │ ├── userRegister.jsp │ │ ├── userLogin.jsp │ │ └── menu.jsp │ └── WEB-INF │ │ └── web.xml │ ├── resources │ ├── log4j.properties │ ├── mysqldb.properties │ ├── mybatis-config.xml │ ├── spring.xml │ ├── spring-mvc.xml │ └── mybatis-spring.xml │ └── java │ ├── com │ └── taoxiuxia │ │ ├── model │ │ ├── SessionUser.java │ │ ├── Balance.java │ │ ├── Item.java │ │ ├── PayMethod.java │ │ ├── Income.java │ │ ├── Expenditure.java │ │ └── User.java │ │ ├── util │ │ ├── NumberFormat.java │ │ ├── SpringContextUtil.java │ │ ├── MyDateFormat.java │ │ ├── DateTimeUtil.java │ │ ├── Constants.java │ │ ├── PasswordUtil.java │ │ └── StringTools.java │ │ ├── exception │ │ └── BusinessException.java │ │ ├── controller │ │ ├── AboutController.java │ │ ├── FrameController.java │ │ ├── MonthlyStatisticsController.java │ │ └── ItemController.java │ │ ├── mapper │ │ ├── ExpenditureMapper.java │ │ ├── IncomeMapper.java │ │ ├── ItemMapper.java │ │ ├── UserMapper.java │ │ ├── PayMethodMapper.java │ │ └── BalanceMapper.java │ │ └── service │ │ ├── IIncomeService.java │ │ ├── IExpenditureService.java │ │ ├── IPayMethodService.java │ │ ├── IItemService.java │ │ ├── IUserService.java │ │ ├── IMonthlyStatisticsService.java │ │ ├── IHistoryService.java │ │ └── impl │ │ ├── IncomeServiceImpl.java │ │ ├── ExpenditureServiceImpl.java │ │ └── MonthlyStatisticsServiceImpl.java │ └── checkcode │ └── patchca │ ├── word │ ├── WordFactory.java │ ├── RandomWordFactory.java │ └── AdaptiveRandomWordFactory.java │ ├── service │ ├── CaptchaService.java │ ├── Captcha.java │ ├── ConfigurableCaptchaService.java │ ├── SimpleCaptchaService.java │ └── AbstractCaptchaService.java │ ├── font │ ├── FontFactory.java │ └── RandomFontFactory.java │ ├── demo │ ├── Sample.java │ ├── PatchcaFilterDemoPNG.java │ └── PatchcaFilterDemo.java │ ├── color │ ├── ColorFactory.java │ ├── SingleColorFactory.java │ ├── GradientColorFactory.java │ └── RandomColorFactory.java │ ├── filter │ ├── FilterFactory.java │ ├── library │ │ ├── BlurImageOp.java │ │ ├── SoftenImageOp.java │ │ ├── DoubleRippleImageOp.java │ │ ├── DiffuseImageOp.java │ │ ├── AbstractTransformImageOp.java │ │ ├── RippleImageOp.java │ │ ├── AbstractConvolveImageOp.java │ │ ├── MarbleImageOp.java │ │ └── WobbleImageOp.java │ ├── ConfigurableFilterFactory.java │ ├── predefined │ │ ├── DiffuseRippleFilterFactory.java │ │ ├── MarbleRippleFilterFactory.java │ │ ├── WobbleRippleFilterFactory.java │ │ ├── DoubleRippleFilterFactory.java │ │ ├── RippleFilterFactory.java │ │ └── CurvesRippleFilterFactory.java │ └── AbstractFilterFactory.java │ ├── background │ ├── BackgroundFactory.java │ ├── GradientBackgroundFactory.java │ └── SingleColorBackgroundFactory.java │ ├── text │ └── renderer │ │ ├── SimpleTextRenderer.java │ │ ├── TextRenderer.java │ │ ├── BestFitTextRenderer.java │ │ ├── RandomYBestFitTextRenderer.java │ │ ├── TextString.java │ │ ├── TextCharacter.java │ │ └── AbstractTextRenderer.java │ └── utils │ └── encoder │ └── EncoderHelper.java ├── .gitignore └── README.md /src/main/webapp/images/alipay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/images/alipay.png -------------------------------------------------------------------------------- /src/main/webapp/images/wechat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/images/wechat.png -------------------------------------------------------------------------------- /src/main/webapp/images/alipay0.1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/images/alipay0.1.png -------------------------------------------------------------------------------- /src/main/webapp/images/wechat0.1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/images/wechat0.1.png -------------------------------------------------------------------------------- /src/main/webapp/res/foldingMenu/使用方法.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/res/foldingMenu/使用方法.txt -------------------------------------------------------------------------------- /src/main/webapp/res/foldingMenu/index.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/res/foldingMenu/index.html -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /.settings/ 3 | .project 4 | .classpath 5 | .checkstyle 6 | /src/main/resources/mybatis-spring.xml 7 | mysqldb.properties 8 | -------------------------------------------------------------------------------- /src/main/webapp/res/My97DatePicker/开发包/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/res/My97DatePicker/开发包/readme.txt -------------------------------------------------------------------------------- /src/main/webapp/res/css/about.css: -------------------------------------------------------------------------------- 1 | .money-image{height:250px;} 2 | .label1{text-align: center;} 3 | .label2{text-align: center; height: 30px; margin-top: 50px;} -------------------------------------------------------------------------------- /src/main/webapp/res/layer/skin/default/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/res/layer/skin/default/icon.png -------------------------------------------------------------------------------- /src/main/webapp/res/foldingMenu/images/pro_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/res/foldingMenu/images/pro_down.png -------------------------------------------------------------------------------- /src/main/webapp/res/foldingMenu/images/pro_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/res/foldingMenu/images/pro_left.png -------------------------------------------------------------------------------- /src/main/webapp/res/layer/skin/default/icon-ext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/res/layer/skin/default/icon-ext.png -------------------------------------------------------------------------------- /src/main/webapp/res/My97DatePicker/skin/datePicker.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/res/My97DatePicker/skin/datePicker.gif -------------------------------------------------------------------------------- /src/main/webapp/res/My97DatePicker/开发包/lang/zh-cn.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/res/My97DatePicker/开发包/lang/zh-cn.js -------------------------------------------------------------------------------- /src/main/webapp/res/My97DatePicker/开发包/lang/zh-tw.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/res/My97DatePicker/开发包/lang/zh-tw.js -------------------------------------------------------------------------------- /src/main/webapp/res/layer/skin/default/loading-0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/res/layer/skin/default/loading-0.gif -------------------------------------------------------------------------------- /src/main/webapp/res/layer/skin/default/loading-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/res/layer/skin/default/loading-1.gif -------------------------------------------------------------------------------- /src/main/webapp/res/layer/skin/default/loading-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/res/layer/skin/default/loading-2.gif -------------------------------------------------------------------------------- /src/main/webapp/res/My97DatePicker/skin/default/img.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/res/My97DatePicker/skin/default/img.gif -------------------------------------------------------------------------------- /src/main/webapp/res/My97DatePicker/skin/whyGreen/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/res/My97DatePicker/skin/whyGreen/bg.jpg -------------------------------------------------------------------------------- /src/main/webapp/res/My97DatePicker/skin/whyGreen/img.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/res/My97DatePicker/skin/whyGreen/img.gif -------------------------------------------------------------------------------- /src/main/webapp/res/My97DatePicker/开发包/skin/datePicker.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/res/My97DatePicker/开发包/skin/datePicker.gif -------------------------------------------------------------------------------- /src/main/webapp/res/My97DatePicker/开发包/skin/default/img.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/res/My97DatePicker/开发包/skin/default/img.gif -------------------------------------------------------------------------------- /src/main/webapp/res/My97DatePicker/开发包/skin/whyGreen/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/res/My97DatePicker/开发包/skin/whyGreen/bg.jpg -------------------------------------------------------------------------------- /src/main/webapp/res/My97DatePicker/开发包/skin/whyGreen/img.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/res/My97DatePicker/开发包/skin/whyGreen/img.gif -------------------------------------------------------------------------------- /src/main/webapp/res/My97DatePicker/开发包/skin/default/datepicker.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/res/My97DatePicker/开发包/skin/default/datepicker.css -------------------------------------------------------------------------------- /src/main/webapp/res/My97DatePicker/开发包/skin/whyGreen/datepicker.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/res/My97DatePicker/开发包/skin/whyGreen/datepicker.css -------------------------------------------------------------------------------- /src/main/webapp/res/bootstrap-3.3.5-dist/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/res/bootstrap-3.3.5-dist/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /src/main/webapp/res/bootstrap-3.3.5-dist/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/res/bootstrap-3.3.5-dist/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /src/main/webapp/res/bootstrap-3.3.5-dist/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/res/bootstrap-3.3.5-dist/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /src/main/webapp/res/bootstrap-3.3.5-dist/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TaoXiuxia/AccountBook-V2/HEAD/src/main/webapp/res/bootstrap-3.3.5-dist/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /src/main/webapp/res/css/monthlyStatistics.css: -------------------------------------------------------------------------------- 1 | .left{margin-left: 30px} 2 | .head{margin-top: 30px} 3 | .head2{margin-top: 10px} 4 | .label1{width:90px} 5 | .money1{width:120px} 6 | .button1{width:70px} 7 | .button2{width:170px} -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AccountBook-V2 2 | 简单的记账系统:使用Maven作为项目管理,SSM(Spring,SpringMVC,MyBatis)开发框架。 3 | 4 | 登录页
5 | http://59.110.231.132:8080/AccountBook-V2/userController/showUserLogin.action
6 | 项目搭建方法
7 | http://blog.csdn.net/taoxiuxia/article/details/77902197 8 | -------------------------------------------------------------------------------- /src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=DEBUG, stdout 2 | log4j.logger.org.mybatis=DEBUG 3 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 4 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 5 | log4j.appender.stdout.layout.ConversionPattern=%5p %d %C: %m%n -------------------------------------------------------------------------------- /src/main/webapp/res/My97DatePicker/skin/WdatePicker.css: -------------------------------------------------------------------------------- 1 | .Wdate{ 2 | border:#999 1px solid; 3 | height:20px; 4 | background:#fff url(datePicker.gif) no-repeat right; 5 | } 6 | .Wdate::-ms-clear{display:none;} 7 | 8 | .WdateFmtErr{ 9 | font-weight:bold; 10 | color:red; 11 | } -------------------------------------------------------------------------------- /src/main/webapp/res/My97DatePicker/开发包/skin/WdatePicker.css: -------------------------------------------------------------------------------- 1 | .Wdate{ 2 | border:#999 1px solid; 3 | height:20px; 4 | background:#fff url(datePicker.gif) no-repeat right; 5 | } 6 | .Wdate::-ms-clear{display:none;} 7 | 8 | .WdateFmtErr{ 9 | font-weight:bold; 10 | color:red; 11 | } -------------------------------------------------------------------------------- /src/main/webapp/res/css/manageItems.css: -------------------------------------------------------------------------------- 1 | .addItem{margin-top:20px;} 2 | .addItem-label{height: 25px;width: 70px;} 3 | .addItem-input{height: 25px;width: 100px;} 4 | .col1{width:240px;} 5 | .col2{width:500px;} 6 | .col3{width:110px;} 7 | .col4{width:110px;} 8 | 9 | 10 | .tableTitle{font-size:19px} -------------------------------------------------------------------------------- /src/main/webapp/res/css/user.register.css: -------------------------------------------------------------------------------- 1 | .register{width:500px;margin-left:450px; margin-top: 80px;} 2 | .div1{margin-top: 15px;} 3 | .label1{width:100px;text-align: right; font-weight: 500;} 4 | .input1{width:260px;} 5 | .input2{width:100px;} 6 | .btn1{width:100px; margin-left:100px} 7 | .link1{width:100px; margin-left:20px} -------------------------------------------------------------------------------- /src/main/webapp/res/css/frame.css: -------------------------------------------------------------------------------- 1 | /* 顶部标题栏 */ 2 | .title{height: 50px; background-color: #DCDCDC; position: fixed; top: 0; width: 97%; z-index: 1; margin-top: 0px; border-radius: 10px;} 3 | .title-text{font-size:25px; color:#000000;} 4 | .li-style{list-style: none; margin-top: 6px;} 5 | .userInfo{color: #000000; font-size: 20px; margin-left: 80%;} 6 | .logoutLink{color: #000000; margin-left:10px} 7 | -------------------------------------------------------------------------------- /src/main/webapp/res/css/managePayMethods.css: -------------------------------------------------------------------------------- 1 | .addPayMethod{margin-top:20px;} 2 | .addPayMethod-label{height: 25px;width: 150px; text-align: right;} 3 | .addPayMethod-input{height: 25px;width: 100px;} 4 | .col1{width:240px;} 5 | .col2{width:500px;} 6 | .col3{width:110px;} 7 | .col4{width:110px;} 8 | .add-select{height: 25px;width: 180px; margin-top: 10px; margin-bottom: 10px} 9 | 10 | .tableTitle{font-size:19px} 11 | 12 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/model/SessionUser.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.model; 2 | 3 | public class SessionUser { 4 | 5 | private int userId; 6 | private String userName; 7 | 8 | public int getUserId() { 9 | return userId; 10 | } 11 | 12 | public void setUserId(int userId) { 13 | this.userId = userId; 14 | } 15 | 16 | public String getUserName() { 17 | return userName; 18 | } 19 | 20 | public void setUserName(String userName) { 21 | this.userName = userName; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/util/NumberFormat.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.util; 2 | 3 | public class NumberFormat { 4 | 5 | public static float to2Decimals(float num){ 6 | return (float)(int)(num)/100; 7 | } 8 | 9 | /** 10 | * 保留2位小数 11 | * @param num 12 | * @return 13 | */ 14 | public static float save2Decimals(float num){ 15 | return (float)(int)(num*100)/100; 16 | } 17 | 18 | public static double save2Decimals(double num){ 19 | return (double)(int)(num*100)/100; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/resources/mysqldb.properties: -------------------------------------------------------------------------------- 1 | jdbc.driverClassName=com.mysql.jdbc.Driver 2 | jdbc.url=jdbc:mysql://127.0.0.1:3306/account_v2 3 | jdbc.username=root 4 | jdbc.password=XXXXXX 5 | jdbc.initialSize=1 6 | jdbc.minIdle=1 7 | jdbc.maxActive=20 8 | jdbc.maxWait=60000 9 | jdbc.removeAbandoned=true 10 | jdbc.removeAbandonedTimeout=180 11 | jdbc.timeBetweenEvictionRunsMillis=60000 12 | jdbc.minEvictableIdleTimeMillis=300000 13 | jdbc.validationQuery=SELECT 1 14 | jdbc.testWhileIdle=true 15 | jdbc.testOnBorrow=false 16 | jdbc.testOnReturn=false -------------------------------------------------------------------------------- /src/main/webapp/res/css/history.css: -------------------------------------------------------------------------------- 1 | .label2{font-size:15px; text-align: right;} 2 | .label3{font-size:17px;width:80px; text-align: right;} 3 | .input1{width:200px;} 4 | .layout_div_Style{height: 50px; width: 400px;} 5 | .change-label{width:90px; text-align: right; font-weight: normal;} 6 | .change-text{width:200px;height: 25px;} 7 | .select1{height: 25px;} 8 | 9 | .col1{width: 100px;} 10 | .col2{width: 50px;} 11 | .col3{width: 250px;} 12 | .col4{width: 110px;} 13 | .col5{width: 120px;} 14 | .col6{width: 250px;} 15 | .col7{width: 120px;} 16 | 17 | -------------------------------------------------------------------------------- /src/main/webapp/res/bootstrap-3.3.5-dist/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/util/SpringContextUtil.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.util; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.context.ApplicationContext; 5 | 6 | public class SpringContextUtil { 7 | 8 | private static ApplicationContext context = null; 9 | 10 | public static void setContext(ApplicationContext applicationContext) throws BeansException { 11 | SpringContextUtil.context = applicationContext; 12 | } 13 | 14 | public static Object getBean(String name) { 15 | return context.getBean(name); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/webapp/res/js/user.logout.js: -------------------------------------------------------------------------------- 1 | function logout() { 2 | $.ajax({ 3 | type: "POST", 4 | url: "/AccountBook-V2/userController/logout.action", 5 | data: { 6 | }, 7 | success: function(msg){ 8 | if(msg.info=="注销成功"){ 9 | layer.msg(msg.info); 10 | setTimeout(function(){ 11 | //此处不能使用window.location.href, 12 | //因为window.location.href是页内跳转,在frameset框架下会出错 13 | window.top.location.href="../userController/showUserLogin.action"; 14 | },1500); 15 | } 16 | }, 17 | error: function () { 18 | layer.msg("注销失败"); 19 | } 20 | }); 21 | } 22 | 23 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/util/MyDateFormat.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.util; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | 6 | public class MyDateFormat { 7 | 8 | /** 9 | * 处理日期,将只有年月日的日期字符串转化成日期格式的Date 10 | * 11 | * @param dateStr 12 | * @return 13 | */ 14 | public static Date dateFormat(String dateStr) { 15 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); 16 | Date date = null; 17 | try { 18 | date = format.parse(dateStr); 19 | } catch (Exception e) { 20 | e.printStackTrace(); 21 | } 22 | return date; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/exception/BusinessException.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.exception; 2 | 3 | public class BusinessException extends Exception { 4 | 5 | private static final long serialVersionUID = -5587054685087764286L; 6 | 7 | public BusinessException(String message, Throwable e) { 8 | super(message, e); 9 | } 10 | 11 | public BusinessException(String message) { 12 | super(message); 13 | } 14 | 15 | public BusinessException(Throwable e) { 16 | super(e); 17 | } 18 | 19 | /** 20 | * 重写 fillInStackTrace 方法,日志不会打印堆栈信息,节省时间。 21 | * 业务异常,没有必要打印堆栈,提高效率。 22 | */ 23 | @Override 24 | public Throwable fillInStackTrace() { 25 | return this; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/resources/mybatis-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/main/webapp/res/My97DatePicker/lang/en.js: -------------------------------------------------------------------------------- 1 | var $lang={ 2 | errAlertMsg: "Invalid date or the date out of range,redo or not?", 3 | aWeekStr: ["wk", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], 4 | aLongWeekStr:["wk","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"], 5 | aMonStr: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], 6 | aLongMonStr: ["January","February","March","April","May","June","July","August","September","October","November","December"], 7 | clearStr: "Clear", 8 | todayStr: "Today", 9 | okStr: "OK", 10 | updateStr: "OK", 11 | timeStr: "Time", 12 | quickStr: "Quick Selection", 13 | err_1: 'MinDate Cannot be bigger than MaxDate!' 14 | } -------------------------------------------------------------------------------- /src/main/webapp/res/My97DatePicker/开发包/lang/en.js: -------------------------------------------------------------------------------- 1 | var $lang={ 2 | errAlertMsg: "Invalid date or the date out of range,redo or not?", 3 | aWeekStr: ["wk", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], 4 | aLongWeekStr:["wk","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"], 5 | aMonStr: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], 6 | aLongMonStr: ["January","February","March","April","May","June","July","August","September","October","November","December"], 7 | clearStr: "Clear", 8 | todayStr: "Today", 9 | okStr: "OK", 10 | updateStr: "OK", 11 | timeStr: "Time", 12 | quickStr: "Quick Selection", 13 | err_1: 'MinDate Cannot be bigger than MaxDate!' 14 | } -------------------------------------------------------------------------------- /src/main/webapp/res/foldingMenu/css/lrtk.css: -------------------------------------------------------------------------------- 1 | .menu_head{width:185px;height:47px;line-height:47px;padding-left:38px;font-size:14px;color:#525252;cursor:pointer;border:1px solid #e1e1e1;position:relative;margin:0px;font-weight:bold;background:#f1f1f1 url(../images/pro_left.png) center right no-repeat;} 2 | .menu_list .current{background:#f1f1f1 url(../images/pro_down.png) center right no-repeat;} 3 | .menu_body{width:223px;height:auto;overflow:hidden;line-height:38px;border-left:1px solid #e1e1e1;backguound:#fff;border-right:1px solid #e1e1e1;} 4 | .menu_body a{display:block;width:223px;height:38px;line-height:38px;padding-left:38px;color:#777777;background:#fff;text-decoration:none;border-bottom:1px solid #e1e1e1;} 5 | .menu_body a:hover{text-decoration:none;} -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/controller/AboutController.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.controller; 2 | 3 | import javax.servlet.http.HttpSession; 4 | 5 | import org.springframework.stereotype.Controller; 6 | import org.springframework.ui.Model; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | 9 | import com.taoxiuxia.model.SessionUser; 10 | import com.taoxiuxia.util.Constants; 11 | 12 | @Controller 13 | @RequestMapping("/aboutController") 14 | public class AboutController { 15 | 16 | @RequestMapping("/showAbout") 17 | public String showBorrows(Model model,HttpSession session) { 18 | SessionUser sessionUser= (SessionUser) session.getAttribute(Constants.SESSION_USER_KEY); 19 | model.addAttribute("sessionUser", sessionUser); 20 | return "pages/about"; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/webapp/pages/frame.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 2 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 3 | <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 4 | 5 | 6 | 7 | 8 | Account Book v2 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/main/webapp/pages/common/common.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/webapp/res/js/about.js: -------------------------------------------------------------------------------- 1 | function setLeftColumn(){ 2 | $("#income").addClass("left-column-button-inactive"); 3 | $("#income").addClass("left-column-button-inactive-font"); 4 | $("#expenditure").addClass("left-column-button-inactive"); 5 | $("#expenditure").addClass("left-column-button-inactive-font"); 6 | $("#history").addClass("left-column-button-inactive"); 7 | $("#history").addClass("left-column-button-inactive-font"); 8 | $("#itemsManagement").addClass("left-column-button-inactive"); 9 | $("#itemsManagement").addClass("left-column-button-inactive-font"); 10 | $("#payMethodsManagement").addClass("left-column-button-inactive"); 11 | $("#payMethodsManagement").addClass("left-column-button-inactive-font"); 12 | $("#about").addClass("left-column-button-active"); 13 | $("#about").addClass("left-column-button-active-font"); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/mapper/ExpenditureMapper.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.mapper; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import com.taoxiuxia.model.Expenditure; 8 | 9 | public interface ExpenditureMapper { 10 | 11 | List selectAllExpenditures(HashMap map); 12 | 13 | int updateByPrimaryKeySelective(Expenditure record); 14 | 15 | int insert(Expenditure record); 16 | 17 | List searchLast12Expenditure(Map map); 18 | 19 | List selectExpenditureGroupByItemName(Map map); 20 | 21 | List selectAllExpenditureGroupByItemName(Map map); 22 | 23 | //////////////////////////////////////////////////////////////// 24 | 25 | int deleteByPrimaryKey(Integer id); 26 | 27 | int insertSelective(Expenditure record); 28 | 29 | Expenditure selectByPrimaryKey(Integer id); 30 | } -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/controller/FrameController.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.controller; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.stereotype.Controller; 6 | import org.springframework.ui.Model; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | 9 | @Controller 10 | @RequestMapping("/frameController") 11 | public class FrameController { 12 | private Logger logger=LoggerFactory.getLogger(FrameController.class); 13 | 14 | /** 15 | * frame页面 16 | * @param model 17 | * @return 18 | */ 19 | @RequestMapping("/showframe") 20 | public String frame(Model model) { 21 | return "pages/frame"; 22 | } 23 | 24 | @RequestMapping("/head") 25 | public String head(Model model) { 26 | return "pages/head"; 27 | } 28 | 29 | @RequestMapping("/menu") 30 | public String menu(Model model) { 31 | return "pages/menu"; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/mapper/IncomeMapper.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.mapper; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import com.taoxiuxia.model.Income; 8 | 9 | public interface IncomeMapper { 10 | 11 | List selectAllIncomes(HashMap map); 12 | 13 | List selectIncomesAndExpenditure(HashMap map); 14 | 15 | int countIncomesAndExpenditure(HashMap map); 16 | 17 | int updateByPrimaryKeySelective(Income record); 18 | 19 | int insert(Income record); 20 | 21 | List searchLast12Income(Map map); 22 | 23 | List selectIncomeGroupByItemName(Map map); 24 | 25 | ///////////////////////////////////////////////////////// 26 | 27 | int deleteByPrimaryKey(Integer id); 28 | 29 | int insertSelective(Income record); 30 | 31 | Income selectByPrimaryKey(Integer id); 32 | 33 | int updateByPrimaryKey(Income record); 34 | } -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/service/IIncomeService.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.service; 2 | 3 | import java.util.Date; 4 | import java.util.List; 5 | 6 | import com.taoxiuxia.model.Income; 7 | 8 | public interface IIncomeService { 9 | 10 | /** 11 | * 加载全部income 12 | * @return 13 | */ 14 | List loadIncomes(int userId); 15 | 16 | /** 17 | * 增加收入 18 | * @param item 19 | * @param money 20 | * @param remark 21 | */ 22 | void addIncome(int userId, String date, int item, float money, String moneyType, String remark); 23 | 24 | /** 25 | * 修改收入 26 | * @param incomeId 27 | * @param money 28 | * @param itemId 29 | * @param remark 30 | */ 31 | void changeIncome(int incomeId,float money, String moneyType, int itemId ,String remark, Date date); 32 | 33 | /** 34 | * 删除收入 35 | * @param incomeId 36 | * @param itemId 37 | */ 38 | void deleIncome(int incomeId); 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/word/WordFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.word; 20 | 21 | public interface WordFactory { 22 | 23 | String getNextWord(); 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/service/CaptchaService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.service; 20 | 21 | public interface CaptchaService { 22 | 23 | Captcha getCaptcha(); 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/mapper/ItemMapper.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.mapper; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import com.taoxiuxia.model.Item; 9 | import com.taoxiuxia.model.ItemExample; 10 | 11 | public interface ItemMapper { 12 | 13 | List selectIncomeItemByUserId(int id); 14 | 15 | List selectExpenditureItemByUserId(int id); 16 | 17 | /*int insert(Item record);*/ 18 | 19 | Map insert(Map map); 20 | 21 | int updateByPrimaryKeySelective(Item record); 22 | 23 | /////////////////////////////////////////////////////// 24 | 25 | List selectByExample(ItemExample example); 26 | 27 | int updateByExampleSelective(@Param("record") Item record, @Param("example") ItemExample example); 28 | 29 | int updateByExample(@Param("record") Item record, @Param("example") ItemExample example); 30 | 31 | int updateByPrimaryKey(Item record); 32 | } -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/font/FontFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.font; 20 | 21 | import java.awt.*; 22 | 23 | public interface FontFactory { 24 | Font getFont(int index); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/demo/Sample.java: -------------------------------------------------------------------------------- 1 | package checkcode.patchca.demo; 2 | 3 | import java.awt.Color; 4 | import java.io.FileOutputStream; 5 | import java.io.IOException; 6 | 7 | import checkcode.patchca.color.SingleColorFactory; 8 | import checkcode.patchca.filter.predefined.*; 9 | import checkcode.patchca.service.ConfigurableCaptchaService; 10 | import checkcode.patchca.utils.encoder.EncoderHelper; 11 | 12 | /** 13 | * sample code 14 | * Created by shijinkui on 15/3/15. 15 | */ 16 | public class Sample { 17 | public static void main(String[] args) throws IOException { 18 | 19 | ConfigurableCaptchaService cs = new ConfigurableCaptchaService(); 20 | cs.setColorFactory(new SingleColorFactory(new Color(25, 60, 170))); 21 | cs.setFilterFactory(new CurvesRippleFilterFactory(cs.getColorFactory())); 22 | 23 | FileOutputStream fos = new FileOutputStream("F://patcha_demo.png"); 24 | EncoderHelper.getChallangeAndWriteImage(cs, "png", fos); 25 | fos.close(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/color/ColorFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.color; 20 | 21 | import java.awt.*; 22 | 23 | public interface ColorFactory { 24 | 25 | Color getColor(int index); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/service/IExpenditureService.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.service; 2 | 3 | import java.util.Date; 4 | import java.util.List; 5 | 6 | import com.taoxiuxia.model.Expenditure; 7 | 8 | public interface IExpenditureService { 9 | 10 | /** 11 | * 加载全部支出 12 | * @return 13 | */ 14 | List loadExpenditures(int userId); 15 | 16 | /** 17 | * 增加Expenditure 18 | * @param item 19 | * @param money 20 | * @param remark 21 | */ 22 | void addExpenditure(int userId, String date, int item, float money, String moneyType, String remark); 23 | 24 | /** 25 | * 修改Expenditure 26 | * @param ExpenditureId 27 | * @param money 28 | * @param itemId 29 | * @param remark 30 | * @param date 31 | */ 32 | void changeExpenditure(int ExpenditureId,float money, String moneyType, int itemId ,String remark, Date date); 33 | 34 | /** 35 | * 删除Expenditure 36 | * @param ExpenditureId 37 | * @param itemId 38 | */ 39 | void deleExpenditure(int ExpenditureId); 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/filter/FilterFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.filter; 20 | 21 | import java.awt.image.BufferedImage; 22 | 23 | public interface FilterFactory { 24 | 25 | BufferedImage applyFilters(BufferedImage source); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/background/BackgroundFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | 20 | package checkcode.patchca.background; 21 | 22 | import java.awt.image.BufferedImage; 23 | 24 | public interface BackgroundFactory { 25 | 26 | void fillBackground(BufferedImage dest); 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/service/IPayMethodService.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.service; 2 | 3 | import java.util.List; 4 | 5 | import com.taoxiuxia.model.PayMethod; 6 | 7 | public interface IPayMethodService { 8 | 9 | /** 10 | * 加载全部pay method 11 | * @return 12 | */ 13 | List loadPayMethods(int id, String inOrEx); 14 | 15 | /** 16 | * 增加pay method,income or expenditure 17 | * @param inOrEx 18 | */ 19 | void addPayMethod(int userId, String payMethodName,int isCountInThisMonthEx,String inOrEx, String remark); 20 | 21 | /** 22 | * 修改pay method只需要id定位到pay method就可以了,不需要userId inOrEx sort字段 23 | */ 24 | void changePayMethod(int payMethodId, String payMethodName, int isCountInThisMonthEx, String remark); 25 | 26 | /** 27 | * 删除pay method 只需id定位到pay method就可以了,其他的字段都不需要 28 | */ 29 | void delePayMethod(int payMethodId); 30 | 31 | /** 32 | * 上移下移pay method 33 | * @param userId 34 | * @param payMethodId 35 | * @param inOrEx 36 | * @param upAndDown 37 | * @return 38 | */ 39 | String upAndDownPayMethod(int userId, int payMethodId, String inOrEx, String upAndDown); 40 | } 41 | -------------------------------------------------------------------------------- /src/main/webapp/res/css/inOrOut.css: -------------------------------------------------------------------------------- 1 | /* 增加收入支出 */ 2 | .add-label{height: 25px;width: 100px;} 3 | .label2{width: 90px; text-align: right; font-weight: normal;} 4 | .label3{font-weight: normal;} 5 | .label4{width: 150px; text-align: right; font-weight: normal;} 6 | .label5{width: 50px; text-align: right; font-weight: normal;} 7 | 8 | .addIncome_div1{height: 30px;} 9 | .addIncome_div2{height: 55px;} 10 | .add-data{height: 25px;width: 200px;} 11 | .add-select{height: 25px;width: 200px; margin-left: -4px;} 12 | .add-money{height: 25px;width: 200px;} 13 | .add-money-type{height: 25px;width: 200px;} 14 | .add-money-remark{height: 50px;width: 200px; vertical-align: top; margin-left: -4px;} 15 | .add-button{height: 25px;width: 100px; margin-left: 90px;} 16 | 17 | /* 修改增加收入支出项 */ 18 | .changeLabel{height: 25px;width: 60px;} 19 | .changeInput{height: 25px;width: 150px;} 20 | 21 | .input2{height: 25px;width: 150px;} 22 | 23 | .div3{height: 35px;} 24 | 25 | .col1{width: 110px;} 26 | .col2{width: 250px;} 27 | .col3{width: 110px;} 28 | .col4{width: 120px;} 29 | .col5{width: 250px;} 30 | .col6{width: 120px;} 31 | 32 | -------------------------------------------------------------------------------- /src/main/webapp/res/js/user.login.js: -------------------------------------------------------------------------------- 1 | // 点击验证码图片换验证码 2 | function refreshCheckCodeButton(){ 3 | $(refreshCheckCode).find("img").attr("src", "checkCode.action?" + new Date()); 4 | } 5 | 6 | // 登录 7 | // 登录不对输入做校验,只注册才校验 8 | function login() 9 | { 10 | var account = $("#account").val(); 11 | var password = $("#password").val(); 12 | var checkCode = $("#checkCode").val(); 13 | var rememberMe = $("#rememberMe").is(':checked'); 14 | $.ajax({ 15 | type: "POST", 16 | url: "login.action", 17 | dataType:"json", 18 | data: { 19 | "account":account, 20 | "password":password, 21 | "checkCode":checkCode, 22 | "rememberMe":rememberMe 23 | }, 24 | success: function(msg){ 25 | if(msg.info=="登录成功"){ 26 | window.location.href="../frameController/showframe"; 27 | }else{ 28 | layer.msg(msg.info); 29 | } 30 | }, 31 | error: function () { 32 | alert("登录失败from前台"); 33 | } 34 | }); 35 | } 36 | 37 | // 按 enter 键提交 38 | $(document).keyup(function(event) { 39 | var code = event.keyCode; 40 | if (code == 13) { 41 | login(); 42 | } 43 | }) 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/main/webapp/res/css/public.css: -------------------------------------------------------------------------------- 1 | /* 顶部标题栏 */ 2 | .title{height: 55px; background-color: #c0c0c0; position: fixed; top: 0; width: 100%; z-index: 1;} 3 | .title-li{margin-top:10px;} 4 | .title-text{font-size:30px; color:#000000;} 5 | .userInfo{color: white; font-size: 20px; margin-left: 800px;} 6 | .logoutLink{color: white; margin-left:10px} 7 | 8 | /* 左侧选择栏 */ 9 | .left-column{background-color:#ECEEEE; margin-top:-20px; height:400px;} 10 | .left-column-button-active{background-color:#0664C1; height:50px;width:171px;margin-left:-15px; text-align: center;} 11 | .left-column-button-active-font{font-size:20px; color:#ffffff;margin-top:3px; } 12 | .left-column-button-inactive{background-color:#ECEEEE; height:50px;width:171px;margin-left:-15px; text-align: center;border: 2px solid #dfdfe8} 13 | .left-column-button-inactive-font{font-size:20px; color:#000000;margin-top:3px; } 14 | 15 | 16 | /* 导航栏 */ 17 | .navigation{ height: 30px; background-color: #f0f0f0; width: 100%; margin-top: 8px;} 18 | .navi-text{font-size: 15px; color: #666464;} 19 | .navi-li{margin-top: -2px;} 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/main/webapp/res/My97DatePicker/lang/zh-cn.js: -------------------------------------------------------------------------------- 1 | var $lang={ 2 | errAlertMsg: "\u4E0D\u5408\u6CD5\u7684\u65E5\u671F\u683C\u5F0F\u6216\u8005\u65E5\u671F\u8D85\u51FA\u9650\u5B9A\u8303\u56F4,\u9700\u8981\u64A4\u9500\u5417?", 3 | aWeekStr: ["\u5468","\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"], 4 | aLongWeekStr:["\u5468","\u661F\u671F\u65E5","\u661F\u671F\u4E00","\u661F\u671F\u4E8C","\u661F\u671F\u4E09","\u661F\u671F\u56DB","\u661F\u671F\u4E94","\u661F\u671F\u516D"], 5 | aMonStr: ["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00","\u5341\u4E8C"], 6 | aLongMonStr: ["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00\u6708","\u5341\u4E8C\u6708"], 7 | clearStr: "\u6E05\u7A7A", 8 | todayStr: "\u4ECA\u5929", 9 | okStr: "\u786E\u5B9A", 10 | updateStr: "\u786E\u5B9A", 11 | timeStr: "\u65F6\u95F4", 12 | quickStr: "\u5FEB\u901F\u9009\u62E9", 13 | err_1: '\u6700\u5C0F\u65E5\u671F\u4E0D\u80FD\u5927\u4E8E\u6700\u5927\u65E5\u671F!' 14 | } -------------------------------------------------------------------------------- /src/main/webapp/res/My97DatePicker/lang/zh-tw.js: -------------------------------------------------------------------------------- 1 | var $lang={ 2 | errAlertMsg: "\u4E0D\u5408\u6CD5\u7684\u65E5\u671F\u683C\u5F0F\u6216\u8005\u65E5\u671F\u8D85\u51FA\u9650\u5B9A\u7BC4\u570D,\u9700\u8981\u64A4\u92B7\u55CE?", 3 | aWeekStr: ["\u5468","\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"], 4 | aLongWeekStr:["\u5468","\u661F\u671F\u65E5","\u661F\u671F\u4E00","\u661F\u671F\u4E8C","\u661F\u671F\u4E09","\u661F\u671F\u56DB","\u661F\u671F\u4E94","\u661F\u671F\u516D"], 5 | aMonStr: ["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00","\u5341\u4E8C"], 6 | aLongMonStr: ["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00\u6708","\u5341\u4E8C\u6708"], 7 | clearStr: "\u6E05\u7A7A", 8 | todayStr: "\u4ECA\u5929", 9 | okStr: "\u78BA\u5B9A", 10 | updateStr: "\u78BA\u5B9A", 11 | timeStr: "\u6642\u9593", 12 | quickStr: "\u5FEB\u901F\u9078\u64C7", 13 | err_1: '\u6700\u5C0F\u65E5\u671F\u4E0D\u80FD\u5927\u65BC\u6700\u5927\u65E5\u671F!' 14 | } -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/service/IItemService.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.service; 2 | 3 | import java.util.List; 4 | 5 | import com.taoxiuxia.model.Item; 6 | 7 | public interface IItemService { 8 | 9 | /** 10 | * 加载全部income item,用于用户选择 11 | * @return 12 | */ 13 | List loadIncomeItems(int id); 14 | 15 | /** 16 | * 加载全部expenditure item,用于用户选择 17 | * @return 18 | */ 19 | List loadExpenditureItems(int id); 20 | 21 | /** 22 | * 增加项,income or expenditure 23 | * @param inOrEx 24 | */ 25 | void addItem(int userId, String itemName, String remark, String inOrEx); 26 | 27 | /** 28 | * 修改item,能够被修改的项只有itemName remark 29 | * 修改item只需要itemId定位到item就可以了,不需要userId inOrEx sort字段 30 | */ 31 | void changeItem(int itemId, String itemName, String remark); 32 | 33 | /** 34 | * 删除item 只需要itemId定位到item就可以了,其他的字段都不需要 35 | */ 36 | void deleItem(int itemId); 37 | 38 | /** 39 | * 上移下移item 40 | * @param userId 41 | * @param itemId 42 | * @param inOrEx 43 | * @param upAndDown 44 | * @return 45 | */ 46 | String upAndDownItem(int userId, int itemId, String inOrEx, String upAndDown); 47 | } 48 | -------------------------------------------------------------------------------- /src/main/webapp/pages/head.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 2 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 3 | <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 4 | 5 | 6 | 7 | 8 | Account Book v2 T 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 27 |
28 | 29 | 30 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/filter/library/BlurImageOp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.filter.library; 20 | 21 | public class BlurImageOp extends AbstractConvolveImageOp { 22 | 23 | private static final float[][] matrix = { { 1 / 16f, 2 / 16f, 1 / 16f }, 24 | { 2 / 16f, 4 / 16f, 2 / 16f }, { 1 / 16f, 2 / 16f, 1 / 16f } }; 25 | 26 | public BlurImageOp() { 27 | super(matrix); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/filter/library/SoftenImageOp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.filter.library; 20 | 21 | public class SoftenImageOp extends AbstractConvolveImageOp { 22 | 23 | private static final float[][] matrix = { { 0 / 16f, 1 / 16f, 0 / 16f }, 24 | { 1 / 16f, 12 / 16f, 1 / 16f }, { 0 / 16f, 1 / 16f, 0 / 16f } }; 25 | 26 | public SoftenImageOp() { 27 | super(matrix); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.mapper; 2 | 3 | import com.taoxiuxia.model.User; 4 | import com.taoxiuxia.model.UserExample; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | import org.apache.ibatis.annotations.Param; 9 | import org.springframework.stereotype.Repository; 10 | 11 | @Repository 12 | public interface UserMapper { 13 | 14 | int insert(User record); 15 | 16 | List findUserByUserName(Map map); 17 | 18 | List findUserByEmail(Map map); 19 | 20 | int updateByPrimaryKeySelective(User record); 21 | 22 | 23 | //////////////////////////////////////////////////////////////////////////////////// 24 | 25 | int countByExample(UserExample example); 26 | 27 | int deleteByExample(UserExample example); 28 | 29 | int deleteByPrimaryKey(Integer id); 30 | 31 | int insertSelective(User record); 32 | 33 | List selectByExample(UserExample example); 34 | 35 | User selectByPrimaryKey(Integer id); 36 | 37 | int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example); 38 | 39 | int updateByExample(@Param("record") User record, @Param("example") UserExample example); 40 | 41 | int updateByPrimaryKey(User record); 42 | } -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/service/IUserService.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.service; 2 | 3 | import com.taoxiuxia.model.User; 4 | 5 | public interface IUserService { 6 | 7 | /** 8 | * 用户注册 9 | * @param user 10 | */ 11 | public int register(User user); 12 | 13 | /** 14 | * @param account 帐号可以是用户名或者邮箱 15 | * @param password 16 | * @return User 17 | * @throws Exception 18 | * @throws BusinessException 19 | */ 20 | public User login(String account, String password, boolean hasMD5) throws Exception; 21 | 22 | /** 23 | * 更新用户 24 | * @param user 25 | */ 26 | public void update(User user); 27 | 28 | 29 | /** 30 | * 根据邮箱判断用户是否已经注册 31 | * @param email 32 | * @return 0:未注册 33 | * 1:已注册,未激活 34 | * 2:已注册,已激活 35 | */ 36 | public int isEmailRegister(String email); 37 | 38 | /** 39 | * 激活用户邮箱 40 | * @param user 41 | * @return 42 | */ 43 | public String active(String email, String activationCode); 44 | 45 | /** 46 | * 根据email查找user 47 | * @param email 48 | * @return 49 | */ 50 | User findUserByEmail(String email); 51 | 52 | /** 53 | * 根据username查找user 54 | * @param email 55 | * @return 56 | */ 57 | User findUserByUserName(String userName); 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/model/Balance.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.model; 2 | 3 | import java.time.LocalDate; 4 | import java.util.Date; 5 | 6 | public class Balance { 7 | private Integer id; 8 | 9 | private Integer userId; 10 | 11 | private Date month; 12 | 13 | private Float actualBalance; 14 | 15 | public Integer getId() { 16 | return id; 17 | } 18 | 19 | public void setId(Integer id) { 20 | this.id = id; 21 | } 22 | 23 | public Integer getUserId() { 24 | return userId; 25 | } 26 | 27 | public void setUserId(Integer userId) { 28 | this.userId = userId; 29 | } 30 | 31 | public Date getMonth() { 32 | return month; 33 | } 34 | 35 | public void setMonth(Date month) { 36 | this.month = month; 37 | } 38 | 39 | public Float getActualBalance() { 40 | return actualBalance; 41 | } 42 | 43 | public void setActualBalance(Float actualBalance) { 44 | this.actualBalance = actualBalance; 45 | } 46 | 47 | @Override 48 | public String toString() { 49 | return "Balance [id=" + id + ", userId=" + userId + ", month=" + month + ", actualBalance=" + actualBalance 50 | + "]"; 51 | } 52 | } -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/service/IMonthlyStatisticsService.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.service; 2 | 3 | import com.taoxiuxia.model.Balance; 4 | 5 | public interface IMonthlyStatisticsService { 6 | 7 | /** 8 | * 本月收入 9 | * 10 | * @param userId 11 | * @return 12 | */ 13 | float monthlyIncome(int userId); 14 | 15 | /** 16 | * 本月支出 17 | * 18 | * @param userId 19 | * @return 20 | */ 21 | float monthlyExpenditure(int userId); 22 | 23 | /** 24 | * 本月支出中花呗与信用卡的数额 25 | * 26 | * @param userId 27 | * @return 28 | */ 29 | float notActualExpenditure(int userId); 30 | 31 | /** 32 | * 查询月初结余,即上月末结余 33 | * 34 | * @param userId 35 | * @return 36 | */ 37 | Balance balanceInBeginOfMonth(int userId); 38 | 39 | /** 40 | * 本月结余,如果有就返回实际值,如果没有就返回null 41 | * 42 | * @param userId 43 | * @return 44 | */ 45 | Balance balanceOfThisMonth(int userId); 46 | 47 | /** 48 | * 向数据库中插入本月实际的结余(由于种种原因,实际的结余总是与记录的数有出入,比如忘记记录) 每月只能插入一次,第一次插入,之后都是修改 49 | * 50 | * @param balance 51 | * @param userId 52 | */ 53 | void addBalance(float balance, int userId); 54 | 55 | /** 56 | * 修改本月结余 57 | * @param month 58 | * @param changed_balance 59 | * @param userId 60 | */ 61 | void changeBalance(int balanceId, float changed_balance); 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/text/renderer/SimpleTextRenderer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.text.renderer; 20 | 21 | public class SimpleTextRenderer extends AbstractTextRenderer { 22 | 23 | @Override 24 | protected void arrangeCharacters(int width, int height, TextString ts) { 25 | double x = leftMargin; 26 | for (TextCharacter tc : ts.getCharacters()) { 27 | double y = topMargin + (height + tc.getAscent() * 0.7) / 2; 28 | tc.setX(x); 29 | tc.setY(y); 30 | x += tc.getWidth(); 31 | } 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/filter/ConfigurableFilterFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.filter; 20 | 21 | import java.awt.image.BufferedImageOp; 22 | import java.util.List; 23 | 24 | public class ConfigurableFilterFactory extends AbstractFilterFactory { 25 | 26 | private List filters; 27 | 28 | @Override 29 | public List getFilters() { 30 | return filters; 31 | } 32 | 33 | public void setFilters(List filters) { 34 | this.filters = filters; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/resources/spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | 16 | 17 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/color/SingleColorFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.color; 20 | 21 | import java.awt.*; 22 | 23 | public class SingleColorFactory implements ColorFactory { 24 | 25 | private Color color; 26 | 27 | public SingleColorFactory() { 28 | color = Color.BLACK; 29 | } 30 | 31 | public SingleColorFactory(Color color) { 32 | this.color = color; 33 | } 34 | 35 | @Override 36 | public Color getColor(int index) { 37 | return color; 38 | } 39 | 40 | public void setColor(Color color) { 41 | this.color = color; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/filter/library/DoubleRippleImageOp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.filter.library; 20 | 21 | public class DoubleRippleImageOp extends RippleImageOp { 22 | 23 | @Override 24 | protected void transform(int x, int y, double[] t) { 25 | double tx = Math.sin((double) y / yWavelength + yRandom) + 1.3 * Math.sin((double) 0.6 * y / yWavelength + yRandom); 26 | double ty = Math.cos((double) x / xWavelength + xRandom) + 1.3 * Math.cos((double) 0.6 * x / xWavelength + xRandom); 27 | t[0] = x + xAmplitude * tx; 28 | t[1] = y + yAmplitude * ty; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/text/renderer/TextRenderer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.text.renderer; 20 | 21 | import java.awt.image.BufferedImage; 22 | 23 | import checkcode.patchca.color.ColorFactory; 24 | import checkcode.patchca.font.FontFactory; 25 | 26 | public interface TextRenderer { 27 | 28 | void setLeftMargin(int leftMargin); 29 | 30 | void setRightMargin(int rightMargin); 31 | 32 | void setTopMargin(int topMargin); 33 | 34 | void setBottomMargin(int bottomMargin); 35 | 36 | void draw(String text, BufferedImage canvas, FontFactory fontFactory, ColorFactory colorFactory); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/utils/encoder/EncoderHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.utils.encoder; 20 | 21 | import javax.imageio.ImageIO; 22 | 23 | import checkcode.patchca.service.Captcha; 24 | import checkcode.patchca.service.CaptchaService; 25 | 26 | import java.io.IOException; 27 | import java.io.OutputStream; 28 | 29 | public class EncoderHelper { 30 | 31 | public static String getChallangeAndWriteImage(CaptchaService service, String format, OutputStream os) throws IOException { 32 | Captcha captcha = service.getCaptcha(); 33 | ImageIO.write(captcha.getImage(), format, os); 34 | return captcha.getChallenge(); 35 | } 36 | 37 | } 38 | 39 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/filter/predefined/DiffuseRippleFilterFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.filter.predefined; 20 | 21 | import java.awt.image.BufferedImageOp; 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | 25 | import checkcode.patchca.filter.library.DiffuseImageOp; 26 | 27 | 28 | public class DiffuseRippleFilterFactory extends RippleFilterFactory { 29 | 30 | protected DiffuseImageOp diffuse = new DiffuseImageOp(); 31 | 32 | @Override 33 | protected List getPreRippleFilters() { 34 | List list = new ArrayList(); 35 | list.add(diffuse); 36 | return list; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/filter/predefined/MarbleRippleFilterFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.filter.predefined; 20 | 21 | import java.awt.image.BufferedImageOp; 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | 25 | import checkcode.patchca.filter.library.MarbleImageOp; 26 | 27 | 28 | public class MarbleRippleFilterFactory extends RippleFilterFactory { 29 | 30 | protected MarbleImageOp marble = new MarbleImageOp(); 31 | 32 | @Override 33 | protected List getPreRippleFilters() { 34 | List list = new ArrayList(); 35 | list.add(marble); 36 | return list; 37 | } 38 | 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/mapper/PayMethodMapper.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.mapper; 2 | 3 | import com.taoxiuxia.model.PayMethod; 4 | import com.taoxiuxia.model.PayMethodExample; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | import org.apache.ibatis.annotations.Param; 9 | 10 | public interface PayMethodMapper { 11 | 12 | /** 13 | * 根据用户的id查找该用户设置的收入或支出方式 14 | * @param map 15 | * @return 16 | */ 17 | List selectPayMethodsByUserId(Map map); 18 | 19 | /** 20 | * 修改PayMethod, 和删除PayMethod 21 | * @param record 22 | * @return 23 | */ 24 | int updateByPrimaryKeySelective(PayMethod record); 25 | 26 | /** 27 | * 插入PayMethod 28 | * @param record 29 | * @return 30 | */ 31 | Map insert(Map map); 32 | 33 | 34 | 35 | ///////////////////////////////////////////////////////////// 36 | 37 | int countByExample(PayMethodExample example); 38 | 39 | int deleteByExample(PayMethodExample example); 40 | 41 | int deleteByPrimaryKey(Integer id); 42 | 43 | 44 | int insertSelective(PayMethod record); 45 | 46 | List selectByExample(PayMethodExample example); 47 | 48 | PayMethod selectByPrimaryKey(Integer id); 49 | 50 | int updateByExampleSelective(@Param("record") PayMethod record, @Param("example") PayMethodExample example); 51 | 52 | int updateByExample(@Param("record") PayMethod record, @Param("example") PayMethodExample example); 53 | 54 | 55 | int updateByPrimaryKey(PayMethod record); 56 | } -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/text/renderer/BestFitTextRenderer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.text.renderer; 20 | 21 | public class BestFitTextRenderer extends AbstractTextRenderer { 22 | 23 | @Override 24 | protected void arrangeCharacters(int width, int height, TextString ts) { 25 | double widthRemaining = (width - ts.getWidth() - leftMargin - rightMargin) / ts.getCharacters().size(); 26 | double x = leftMargin + widthRemaining / 2; 27 | height -= topMargin + bottomMargin; 28 | for (TextCharacter tc : ts.getCharacters()) { 29 | double y = topMargin + (height + tc.getAscent() * 0.7) / 2; 30 | tc.setX(x); 31 | tc.setY(y); 32 | x += tc.getWidth() + widthRemaining; 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/service/Captcha.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.service; 20 | 21 | import java.awt.image.BufferedImage; 22 | 23 | public class Captcha { 24 | 25 | private String challenge; 26 | private BufferedImage image; 27 | 28 | public Captcha(String challenge, BufferedImage image) { 29 | this.challenge = challenge; 30 | this.image = image; 31 | } 32 | 33 | public String getChallenge() { 34 | return challenge; 35 | } 36 | 37 | public void setChallenge(String challenge) { 38 | this.challenge = challenge; 39 | } 40 | 41 | public BufferedImage getImage() { 42 | return image; 43 | } 44 | 45 | public void setImage(BufferedImage image) { 46 | this.image = image; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/filter/predefined/WobbleRippleFilterFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.filter.predefined; 20 | 21 | import java.awt.image.BufferedImageOp; 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | 25 | import checkcode.patchca.filter.library.WobbleImageOp; 26 | 27 | 28 | public class WobbleRippleFilterFactory extends RippleFilterFactory { 29 | 30 | protected WobbleImageOp wobble; 31 | 32 | public WobbleRippleFilterFactory() { 33 | wobble = new WobbleImageOp(); 34 | } 35 | @Override 36 | protected List getPreRippleFilters() { 37 | List list = new ArrayList(); 38 | list.add(wobble); 39 | return list; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/model/Item.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.model; 2 | 3 | public class Item { 4 | private Integer id; 5 | 6 | private int userId; 7 | 8 | private String name; 9 | 10 | private String inOrEx; 11 | 12 | private String remark; 13 | 14 | private int dele; 15 | 16 | private int sort; 17 | 18 | public int getSort() { 19 | return sort; 20 | } 21 | 22 | public void setSort(int sort) { 23 | this.sort = sort; 24 | } 25 | 26 | public int getUserId() { 27 | return userId; 28 | } 29 | 30 | public void setUserId(int userId) { 31 | this.userId = userId; 32 | } 33 | 34 | public String getInOrEx() { 35 | return inOrEx; 36 | } 37 | 38 | public void setInOrEx(String inOrEx) { 39 | this.inOrEx = inOrEx; 40 | } 41 | 42 | public int getDele() { 43 | return dele; 44 | } 45 | 46 | public void setDele(int dele) { 47 | this.dele = dele; 48 | } 49 | 50 | public Integer getId() { 51 | return id; 52 | } 53 | 54 | public void setId(Integer id) { 55 | this.id = id; 56 | } 57 | 58 | public String getName() { 59 | return name; 60 | } 61 | 62 | public void setName(String name) { 63 | this.name = name == null ? null : name.trim(); 64 | } 65 | 66 | public String getRemark() { 67 | return remark; 68 | } 69 | 70 | public void setRemark(String remark) { 71 | this.remark = remark == null ? null : remark.trim(); 72 | } 73 | 74 | } -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/controller/MonthlyStatisticsController.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.controller; 2 | 3 | import javax.servlet.http.HttpSession; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Controller; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | 9 | import com.taoxiuxia.service.IMonthlyStatisticsService; 10 | import com.taoxiuxia.util.Constants; 11 | 12 | @Controller 13 | @RequestMapping("/monthlyStatisticsController") 14 | public class MonthlyStatisticsController { 15 | private IMonthlyStatisticsService monthlyStatisticsService; 16 | 17 | public IMonthlyStatisticsService getMonthlyStatisticsService() { 18 | return monthlyStatisticsService; 19 | } 20 | 21 | @Autowired 22 | public void setMonthlyStatisticsService(IMonthlyStatisticsService monthlyStatisticsService) { 23 | this.monthlyStatisticsService = monthlyStatisticsService; 24 | } 25 | 26 | /** 27 | * 增加Balance 28 | * 29 | */ 30 | @RequestMapping("/addBalance") 31 | public void addBalance(float actualBalance, HttpSession session) { 32 | int userId = (int)session.getAttribute(Constants.USER_ID); 33 | monthlyStatisticsService.addBalance(actualBalance, userId); 34 | } 35 | 36 | /** 37 | * 修改balance 38 | * @param balanceId 39 | * @param actualBalance 40 | */ 41 | @RequestMapping("/changeBalance") 42 | public void changeBalance(int balanceId,float changed_balance) { 43 | monthlyStatisticsService.changeBalance(balanceId, changed_balance); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/util/DateTimeUtil.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.util; 2 | 3 | import java.text.ParseException; 4 | import java.text.SimpleDateFormat; 5 | import java.time.LocalDate; 6 | import java.time.temporal.TemporalAdjusters; 7 | import java.util.Date; 8 | 9 | public class DateTimeUtil { 10 | 11 | 12 | /** 13 | * YYYY-MM-dd hh:mm:ss格式返回现在时间 14 | */ 15 | public static String nowTime() { 16 | SimpleDateFormat bartDateFormat = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss"); // HH24小时制,hh12小时制 17 | Date date = new Date(); 18 | return bartDateFormat.format(date); 19 | } 20 | 21 | public static int compareTimeByMin(String time1, String time2){ 22 | int hours = 0; 23 | try { 24 | SimpleDateFormat simpleFormat = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss"); 25 | long from = simpleFormat.parse(time1).getTime(); 26 | long to = simpleFormat.parse(time2).getTime(); 27 | hours = Math.abs((int) ((to - from)/(1000 * 60))); 28 | } catch (ParseException e) { 29 | e.printStackTrace(); 30 | } 31 | return hours; 32 | } 33 | 34 | /** 35 | * 本月第一天 36 | * @return 37 | */ 38 | public static String firstDayOfThisMonth(){ 39 | LocalDate today = LocalDate.now(); 40 | LocalDate firstday = LocalDate.of(today.getYear(),today.getMonth(),1); 41 | return firstday + ""; // 默认格式YYYY-MM-dd 42 | } 43 | 44 | /** 45 | * 本月最后一天 46 | * @return 47 | */ 48 | public static String lastDayOfThisMonth(){ 49 | LocalDate today = LocalDate.now(); 50 | LocalDate lastDay =today.with(TemporalAdjusters.lastDayOfMonth()); 51 | return lastDay + ""; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/color/GradientColorFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.color; 20 | 21 | import java.awt.*; 22 | 23 | public class GradientColorFactory implements ColorFactory { 24 | 25 | private Color start; 26 | private Color step; 27 | 28 | public GradientColorFactory() { 29 | start = new Color(192, 192, 0); 30 | step = new Color(192, 128, 128); 31 | } 32 | 33 | @Override 34 | public Color getColor(int index) { 35 | return new Color((start.getRed() + step.getRed() * index) % 256, 36 | (start.getGreen() + step.getGreen() * index) % 256, 37 | (start.getBlue() + step.getBlue() * index) % 256); 38 | } 39 | 40 | public void setStart(Color start) { 41 | this.start = start; 42 | } 43 | 44 | public void setStep(Color step) { 45 | this.step = step; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/webapp/pages/about.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 2 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 3 | <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 4 | 5 | 6 | 7 | 8 | Account Book v2 收入 9 | <%@ include file="common/common.jsp" %> 10 | 11 | 12 | 13 | 14 |
15 |
16 |
17 | 22 |
23 | 24 |
25 |
一毛钱,您买不了吃亏,一毛钱,您也买不了上当
26 |

27 |
28 | 29 |
30 |
31 | 32 |
33 | 34 |
您老随意
35 |
36 | 37 |
38 |
39 | 40 |
41 |
42 |
43 |
44 | 45 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/filter/AbstractFilterFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.filter; 20 | 21 | import java.awt.image.BufferedImage; 22 | import java.awt.image.BufferedImageOp; 23 | import java.util.List; 24 | 25 | public abstract class AbstractFilterFactory implements FilterFactory { 26 | 27 | protected abstract List getFilters(); 28 | 29 | public BufferedImage applyFilters(BufferedImage source) { 30 | BufferedImage dest = source; 31 | for (BufferedImageOp filter : getFilters()) { 32 | dest = filter.filter(dest, null); 33 | } 34 | int x = (source.getWidth() - dest.getWidth()) / 2; 35 | int y = (source.getHeight() - dest.getHeight()) / 2; 36 | source = new BufferedImage(source.getWidth(), source.getHeight(), source.getType()); 37 | source.getGraphics().drawImage(dest, x, y, null); 38 | return source; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/filter/predefined/DoubleRippleFilterFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.filter.predefined; 20 | 21 | import java.awt.image.BufferedImageOp; 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | 25 | import checkcode.patchca.filter.AbstractFilterFactory; 26 | import checkcode.patchca.filter.library.DoubleRippleImageOp; 27 | 28 | 29 | public class DoubleRippleFilterFactory extends AbstractFilterFactory { 30 | 31 | protected List filters; 32 | protected DoubleRippleImageOp ripple; 33 | 34 | public DoubleRippleFilterFactory() { 35 | ripple = new DoubleRippleImageOp(); 36 | } 37 | 38 | @Override 39 | public List getFilters() { 40 | if (filters == null) { 41 | filters = new ArrayList(); 42 | filters.add(ripple); 43 | } 44 | return filters; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/demo/PatchcaFilterDemoPNG.java: -------------------------------------------------------------------------------- 1 | package checkcode.patchca.demo; 2 | 3 | import java.awt.Color; 4 | import java.io.FileOutputStream; 5 | 6 | import checkcode.patchca.color.SingleColorFactory; 7 | import checkcode.patchca.filter.predefined.CurvesRippleFilterFactory; 8 | import checkcode.patchca.filter.predefined.DiffuseRippleFilterFactory; 9 | import checkcode.patchca.filter.predefined.DoubleRippleFilterFactory; 10 | import checkcode.patchca.filter.predefined.MarbleRippleFilterFactory; 11 | import checkcode.patchca.filter.predefined.WobbleRippleFilterFactory; 12 | import checkcode.patchca.service.ConfigurableCaptchaService; 13 | import checkcode.patchca.utils.encoder.EncoderHelper; 14 | 15 | public class PatchcaFilterDemoPNG { 16 | 17 | public static void main(String[] args) throws Exception { 18 | for (int counter = 0; counter < 5; counter++) { 19 | ConfigurableCaptchaService cs = new ConfigurableCaptchaService(); 20 | cs.setColorFactory(new SingleColorFactory(new Color(25, 60, 170))); 21 | switch (counter % 5) { 22 | case 0: 23 | cs.setFilterFactory(new CurvesRippleFilterFactory(cs.getColorFactory())); 24 | break; 25 | case 1: 26 | cs.setFilterFactory(new MarbleRippleFilterFactory()); 27 | break; 28 | case 2: 29 | cs.setFilterFactory(new DoubleRippleFilterFactory()); 30 | break; 31 | case 3: 32 | cs.setFilterFactory(new WobbleRippleFilterFactory()); 33 | break; 34 | case 4: 35 | cs.setFilterFactory(new DiffuseRippleFilterFactory()); 36 | break; 37 | } 38 | FileOutputStream fos = new FileOutputStream("patcha_demo" + counter + ".png"); 39 | EncoderHelper.getChallangeAndWriteImage(cs, "png", fos); 40 | fos.close(); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/text/renderer/RandomYBestFitTextRenderer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.text.renderer; 20 | 21 | import java.util.Random; 22 | 23 | public class RandomYBestFitTextRenderer extends AbstractTextRenderer { 24 | 25 | @Override 26 | protected void arrangeCharacters(int width, int height, TextString ts) { 27 | double widthRemaining = (width - ts.getWidth() - leftMargin - rightMargin) / ts.getCharacters().size(); 28 | double vmiddle = height / 2; 29 | double x = leftMargin + widthRemaining / 2; 30 | Random r = new Random(); 31 | height -= topMargin + bottomMargin; 32 | for (TextCharacter tc : ts.getCharacters()) { 33 | double heightRemaining = height - tc.getHeight(); 34 | double y = vmiddle + 0.35 * tc.getAscent() + (1 - 2 * r.nextDouble()) * heightRemaining; 35 | tc.setX(x); 36 | tc.setY(y); 37 | x += tc.getWidth() + widthRemaining; 38 | } 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/color/RandomColorFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.color; 20 | 21 | import java.awt.*; 22 | import java.util.Random; 23 | 24 | public class RandomColorFactory implements ColorFactory { 25 | 26 | private Color min; 27 | private Color max; 28 | private Color color; 29 | 30 | public RandomColorFactory() { 31 | min = new Color(20,40,80); 32 | max = new Color(21,50,140); 33 | } 34 | 35 | public void setMin(Color min) { 36 | this.min = min; 37 | } 38 | 39 | public void setMax(Color max) { 40 | this.max = max; 41 | } 42 | 43 | @Override 44 | public Color getColor(int index) { 45 | if (color == null) { 46 | Random r = new Random(); 47 | color = new Color( min.getRed() + r.nextInt((max.getRed() - min.getRed())), 48 | min.getGreen() + r.nextInt((max.getGreen() - min.getGreen())), 49 | min.getBlue() + r.nextInt((max.getBlue() - min.getBlue()))); 50 | } 51 | return color; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/webapp/pages/userActive.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 2 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 3 | <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 4 | 5 | 6 | 7 | 8 | ABV2 激活 9 | <%@ include file="common/common.jsp" %> 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |
18 | 21 |
22 |
23 |
24 | 25 |
26 | 27 | 28 | 页面失效,请返回 29 | 30 | 31 | 32 |
33 | 34 |
35 | 激活码已经发送到您的邮箱"${email }" 36 | 请输入激活码 37 |
38 | 39 |
40 | 41 | 42 |
43 | 44 |
45 | 46 |
47 |
48 |
49 |
50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/util/Constants.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.util; 2 | 3 | public class Constants { 4 | 5 | public static final int LENGTH_20 = 20; 6 | public static final int LENGTH_6 = 6; 7 | public static final int LENGTH_16 = 16; 8 | 9 | public static final String user_img_path_user_icon = "defusericon/usericon"; 10 | public static final String user_img_path_user_bg = "defbg/bg"; 11 | 12 | /** 13 | * 验证码 14 | */ 15 | public static final String check_code_key = "check_code"; 16 | 17 | public static final String SESSION_USER_KEY = "session_user_key"; 18 | 19 | public static final String USER_ID = "useId"; 20 | 21 | public static final String EMAIL = "email"; 22 | 23 | public static final String SESSION_ERROR_LOGIN_COUNT="session_error_login_count"; 24 | 25 | public static final int MAX_LOGIN_ERROR_COUNT = 3; 26 | 27 | public static final int CONTINUESIGNINCOUNT = 7; 28 | 29 | public static final String COOKIE_USER_INFO = "cookie4UserInfo"; 30 | 31 | public static final String ABSOLUTEPATH = "absolutePath"; 32 | 33 | /** 34 | * 每页显示的记录数 35 | */ 36 | public static final int RECORD_NUM_PER_PAGE = 20; 37 | 38 | /** 39 | * 没有被删除 40 | */ 41 | public static final int NOT_DELE = 1; 42 | 43 | /** 44 | * 被删除 45 | */ 46 | public static final int DELE = -1; 47 | 48 | /** 49 | * 只查询本月的数据 50 | */ 51 | public static final String ONLY_THIS_MONTH = "only_this_month"; 52 | 53 | /** 54 | * 查询全部的数据,而不只是本月的 55 | */ 56 | public static final String NOT_ONLY_THIS_MONTH = "not_only_this_month"; 57 | 58 | /** 59 | * 已经激活 60 | */ 61 | public static final Integer ACTIVE = 1; 62 | 63 | /** 64 | * 未激活 65 | */ 66 | public static final Integer NOT_ACTIVE = 0; 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/background/GradientBackgroundFactory.java: -------------------------------------------------------------------------------- 1 | package checkcode.patchca.background; 2 | import java.awt.Color; 3 | import java.awt.GradientPaint; 4 | import java.awt.Graphics2D; 5 | import java.awt.image.BufferedImage; 6 | 7 | public class GradientBackgroundFactory implements BackgroundFactory { 8 | 9 | public enum Direction { 10 | Horizontal, 11 | Vertical, 12 | TopLeftBottomRight, 13 | BottomLeftTopRight 14 | } 15 | 16 | private Color startColor; 17 | private Color endColor; 18 | private Direction direction; 19 | 20 | public GradientBackgroundFactory() { 21 | this(new Color(192, 192, 0), new Color(192, 128, 128), Direction.Horizontal); 22 | } 23 | 24 | public GradientBackgroundFactory(Color startColor, Color endColor, Direction direction) { 25 | this.startColor = startColor; 26 | this.endColor = endColor; 27 | this.direction = direction; 28 | } 29 | 30 | public void fillBackground(BufferedImage dest) { 31 | 32 | float x1, y1, x2, y2; 33 | 34 | switch (direction) { 35 | default: 36 | case Horizontal: 37 | x1 = 0; 38 | y1 = 0; 39 | x2 = dest.getWidth(); 40 | y2 = 0; 41 | break; 42 | case Vertical: 43 | x1 = 0; 44 | y1 = 0; 45 | x2 = 0; 46 | y2 = dest.getHeight(); 47 | break; 48 | case BottomLeftTopRight: 49 | x1 = 0; 50 | y1 = dest.getHeight(); 51 | x2 = dest.getWidth(); 52 | y2 = 0; 53 | break; 54 | case TopLeftBottomRight: 55 | x1 = 0; 56 | y1 = 0; 57 | x2 = dest.getWidth(); 58 | y2 = dest.getHeight(); 59 | break; 60 | } 61 | 62 | GradientPaint gp = new GradientPaint(x1, y1, startColor, x2, y2, endColor); 63 | 64 | Graphics2D g = dest.createGraphics(); 65 | g.setPaint(gp); 66 | g.fillRect(0, 0, dest.getWidth(), dest.getHeight()); 67 | } 68 | 69 | } -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/background/SingleColorBackgroundFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.background; 20 | import java.awt.*; 21 | import java.awt.image.BufferedImage; 22 | 23 | import checkcode.patchca.color.ColorFactory; 24 | import checkcode.patchca.color.SingleColorFactory; 25 | 26 | 27 | public class SingleColorBackgroundFactory implements BackgroundFactory { 28 | 29 | private ColorFactory colorFactory; 30 | 31 | public SingleColorBackgroundFactory() { 32 | colorFactory = new SingleColorFactory(Color.WHITE); 33 | } 34 | 35 | public SingleColorBackgroundFactory(Color color) { 36 | colorFactory = new SingleColorFactory(color); 37 | } 38 | 39 | public void setColorFactory(ColorFactory colorFactory) { 40 | this.colorFactory = colorFactory; 41 | } 42 | 43 | @Override 44 | public void fillBackground(BufferedImage dest) { 45 | Graphics g = dest.getGraphics(); 46 | g.setColor(colorFactory.getColor(0)); 47 | g.fillRect(0, 0, dest.getWidth(), dest.getHeight()); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/webapp/res/js/monthlyStatistics.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 在“本月实际结余”输入框中填入数值(如果有的话),并且将其变为不可用 3 | * @param actualSurplus 4 | */ 5 | function unenableInput(actualSurplus){ 6 | if(actualSurplus!=-1){ //-1表示没有内容 7 | $("#actual_balance").val(actualSurplus); 8 | $("#actual_balance").attr("disabled","disabled"); 9 | $("#submitBalanceButton").attr("disabled","disabled"); 10 | } 11 | } 12 | 13 | /** 14 | * 用在收入和支出页面 15 | */ 16 | 17 | function submitBalance(){ 18 | var actualBalance = $("#actual_balance").val(); 19 | if(!validateNumOnly(actualBalance, "金额只能是数字")){ 20 | return false; 21 | } 22 | $.post("../monthlyStatisticsController/addBalance",{ 23 | "actualBalance":actualBalance 24 | }); 25 | setTimeout('location.reload()', 1000); 26 | } 27 | 28 | /** 29 | * 修改balance 30 | * @param month 31 | */ 32 | function changeBalance(month, value1, balanceId){ // 如果参数month为last,表示修改上月balance;如果参数为this,表示修改本月balance 33 | layer.confirm( 34 | $("#changeBalance").html(),{ 35 | btn: ['修改','返回'], //按钮 36 | success: function(layero, index){ 37 | var content = $(".layui-layer-content"); 38 | if(month=="last"){ 39 | content.find("#month_label").text("修改本月初/上月末结余:"); 40 | }else{ 41 | content.find("#month_label").text("修改本月末结余:"); 42 | } 43 | content.find("#changed_balance").val(value1); 44 | } 45 | }, function(){ 46 | var content = $(".layui-layer-content"); 47 | var changed_balance = content.find("#changed_balance").val(); 48 | if(!validateNumOnly(changed_balance, "金额只能是数字")){ 49 | return false; 50 | } 51 | $.post("../monthlyStatisticsController/changeBalance",{ 52 | "changed_balance":changed_balance, 53 | "balanceId":balanceId 54 | }); 55 | setTimeout('location.reload()', 1000); 56 | }); 57 | } 58 | -------------------------------------------------------------------------------- /src/main/webapp/res/js/common/validator.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 本js包含了公共校验方法 3 | */ 4 | 5 | // 校验只能是数字 6 | function validateNumOnly(str, tip){ 7 | str = $.trim(str); 8 | if(isNaN(Number(str))){ //当输入不是数字的时候,Number后返回的值是NaN;然后用isNaN判断。 9 | alert(tip); 10 | return false; 11 | } 12 | return true; 13 | } 14 | 15 | // 校验密码 16 | function validatePassword(str){ 17 | str = $.trim(str); 18 | if(str == null || "" == str){ 19 | alert("请输入密码") 20 | return false; 21 | } 22 | var pwdReg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,12}$/; 23 | if (!pwdReg.test(str)) { 24 | alert("密码必须同时包含字母和数字,且只能包含字母和数字,6-12位"); 25 | return false; 26 | } 27 | return true; 28 | } 29 | 30 | // 校验email 31 | function validateEmail(str){ 32 | str = $.trim(str); 33 | if(str == null || "" == str){ 34 | alert("请输入邮箱") 35 | return false; 36 | } 37 | email = $.trim(str); 38 | var emailReg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/; 39 | if (!emailReg.test(str)) { 40 | alert("邮箱格式不正确"); 41 | return false; 42 | } 43 | return true; 44 | } 45 | 46 | // 校验账户 47 | function validateAccount(str){ 48 | validateNotEmpty(str,"请输入帐号"); 49 | 50 | str = $.trim(str); 51 | var accountReg = /^[A-Za-z0-9]{1,12}$/; 52 | if (!accountReg.test(str)) { 53 | alert("账户只能包含字母和数字,1-12位"); 54 | return false; 55 | } 56 | return true; 57 | } 58 | 59 | // 校验输入不能为空 60 | function validateNotEmpty(str, tip){ 61 | str = $.trim(str); 62 | if(str == null || "" == str){ 63 | if($.trim(tip) == null || $.trim(tip) == ""){ 64 | tip = "输入不能为空"; 65 | } 66 | alert(tip) 67 | return false; 68 | } 69 | return true; 70 | } 71 | 72 | //校验字符串长度,最短-最长 73 | function validateLength(str, shortLen, longLen, tip){ 74 | str = $.trim(str); 75 | var len = str.length; 76 | if(len < shortLen || len > longLen){ 77 | alert(tip) 78 | return false; 79 | } 80 | return true; 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/filter/library/DiffuseImageOp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.filter.library; 20 | 21 | import java.util.Random; 22 | 23 | public class DiffuseImageOp extends AbstractTransformImageOp { 24 | 25 | double[] tx; 26 | double[] ty; 27 | double amount; 28 | 29 | public DiffuseImageOp() { 30 | amount = 1.6; 31 | } 32 | 33 | public double getAmount() { 34 | return amount; 35 | } 36 | 37 | public void setAmount(double amount) { 38 | this.amount = amount; 39 | } 40 | 41 | @Override 42 | protected synchronized void init() { 43 | tx = new double[256]; 44 | ty = new double[256]; 45 | for (int i = 0; i < 256; i++) { 46 | double angle = 2 * Math.PI * i / 256; 47 | tx[i] = amount * Math.sin(angle); 48 | ty[i] = amount * Math.cos(angle); 49 | } 50 | } 51 | 52 | @Override 53 | protected void transform(int x, int y, double[] t) { 54 | Random r = new Random(); 55 | int angle = (int) (r.nextFloat() * 255); 56 | t[0] = x + tx[angle]; 57 | t[1] = y + ty[angle]; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/service/IHistoryService.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.service; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | public interface IHistoryService { 7 | 8 | /** 9 | * 根据条件加载全部income和expenditure 10 | * @param userId 11 | * @param inOrEx 12 | * @param year 13 | * @param month 14 | * @param keyword 15 | * @return 16 | */ 17 | List loadIncomesAndExpenditure(int userId,String inOrEx,int year, int month, String keyword, String sortBy, int curPage, int totalPages); 18 | 19 | /** 20 | * 根据条件查询全部income和expenditure的条数 21 | * @param userId 22 | * @param inOrEx 23 | * @param year 24 | * @param month 25 | * @param keyword 26 | * @return 27 | */ 28 | int countIncomesAndExpenditure(int userId,String inOrEx,int year, int month, String keyword); 29 | 30 | /** 31 | * 查询过去12个月的每月收入 32 | * @return 33 | */ 34 | List last12Income(int userId); 35 | 36 | /** 37 | * 查询过去12个月的每月支出 38 | * @return 39 | */ 40 | List last12Expenditure(int userId); 41 | 42 | /** 43 | * 按照日期搜索income,并按照item name分组 44 | * @param userId 45 | * @param startTime 46 | * @param endTime 47 | * @return 48 | */ 49 | List selectIncomeGroupByItemName(int userId, String startTime, String endTime); 50 | 51 | /** 52 | * 按照日期搜索expenditure,并按照item name分组,本月花呗与信用卡算入下月支出 53 | * @param userId 54 | * @param startTime 55 | * @param endTime 56 | * @return 57 | */ 58 | List selectExpenditureGroupByItemName(int userId, String startTime, String endTime); 59 | 60 | /** 61 | * 按照日期搜索expenditure,并按照item name分组,本月花呗与信用卡算入本月支出,同时上月花呗与信用卡也算入本月支出(还款) 62 | * @param userId 63 | * @param startTime 64 | * @param endTime 65 | * @return 66 | */ 67 | List selectAllExpenditureGroupByItemName(int userId, String startTime, String endTime); 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/service/ConfigurableCaptchaService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.service; 20 | 21 | import checkcode.patchca.background.SingleColorBackgroundFactory; 22 | import checkcode.patchca.color.SingleColorFactory; 23 | import checkcode.patchca.filter.predefined.CurvesRippleFilterFactory; 24 | import checkcode.patchca.font.RandomFontFactory; 25 | import checkcode.patchca.text.renderer.BestFitTextRenderer; 26 | import checkcode.patchca.word.AdaptiveRandomWordFactory; 27 | 28 | public class ConfigurableCaptchaService extends AbstractCaptchaService { 29 | 30 | public ConfigurableCaptchaService() { 31 | backgroundFactory = new SingleColorBackgroundFactory(); 32 | wordFactory = new AdaptiveRandomWordFactory(); 33 | fontFactory = new RandomFontFactory(); 34 | textRenderer = new BestFitTextRenderer(); 35 | colorFactory = new SingleColorFactory(); 36 | filterFactory = new CurvesRippleFilterFactory(colorFactory); 37 | textRenderer.setLeftMargin(10); 38 | textRenderer.setRightMargin(10); 39 | width = 140; 40 | height = 60; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/webapp/pages/userRegister.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 2 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 3 | <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 4 | 5 | 6 | 7 | 8 | ABV2 注册 9 | <%@ include file="common/common.jsp" %> 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |
18 | 21 |
22 |
23 |
24 | 25 |
26 |
27 | 28 | 29 |
30 |
31 | 32 | 33 |
34 |
35 | 36 | 37 |
38 |
39 | 40 | 41 |
42 |
43 | 44 | 已有账号,登录 45 |
46 |
47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/filter/library/AbstractTransformImageOp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.filter.library; 20 | 21 | 22 | public abstract class AbstractTransformImageOp extends AbstractImageOp { 23 | 24 | protected abstract void transform(int x, int y, double[] t); 25 | 26 | protected void init() { 27 | } 28 | 29 | private boolean initialized; 30 | 31 | public AbstractTransformImageOp() { 32 | setEdgeMode(EDGE_CLAMP); 33 | } 34 | 35 | @Override 36 | protected void filter(int[] inPixels, int[] outPixels, int width, int height) { 37 | if (!initialized) { 38 | init(); 39 | initialized = true; 40 | } 41 | long time1 = System.currentTimeMillis(); 42 | double[]t = new double[2]; 43 | for (int y = 0; y < height; y++) { 44 | for (int x = 0; x < width; x++) { 45 | transform(x, y, t); 46 | int pixel = getPixelBilinear(inPixels, t[0], t[1], width, height, getEdgeMode()); 47 | outPixels[x + y * width] = pixel; 48 | } 49 | } 50 | long time2 = System.currentTimeMillis() - time1; 51 | //System.out.println("AbstractTransformImageOp " + time2); 52 | } 53 | 54 | } 55 | 56 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/model/PayMethod.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.model; 2 | 3 | public class PayMethod { 4 | private Integer id; 5 | 6 | private Integer userId; 7 | 8 | private String name; 9 | 10 | private Integer isCountInThisMonthEx; 11 | 12 | private String inOrEx; 13 | 14 | private String remark; 15 | 16 | private Integer dele; 17 | 18 | private Integer sort; 19 | 20 | public Integer getId() { 21 | return id; 22 | } 23 | 24 | public void setId(Integer id) { 25 | this.id = id; 26 | } 27 | 28 | public Integer getUserId() { 29 | return userId; 30 | } 31 | 32 | public void setUserId(Integer userId) { 33 | this.userId = userId; 34 | } 35 | 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name == null ? null : name.trim(); 42 | } 43 | 44 | public Integer getIsCountInThisMonthEx() { 45 | return isCountInThisMonthEx; 46 | } 47 | 48 | public void setIsCountInThisMonthEx(Integer isCountInThisMonthEx) { 49 | this.isCountInThisMonthEx = isCountInThisMonthEx; 50 | } 51 | 52 | public String getInOrEx() { 53 | return inOrEx; 54 | } 55 | 56 | public void setInOrEx(String inOrEx) { 57 | this.inOrEx = inOrEx == null ? null : inOrEx.trim(); 58 | } 59 | 60 | public String getRemark() { 61 | return remark; 62 | } 63 | 64 | public void setRemark(String remark) { 65 | this.remark = remark == null ? null : remark.trim(); 66 | } 67 | 68 | public Integer getDele() { 69 | return dele; 70 | } 71 | 72 | public void setDele(Integer dele) { 73 | this.dele = dele; 74 | } 75 | 76 | public Integer getSort() { 77 | return sort; 78 | } 79 | 80 | public void setSort(Integer sort) { 81 | this.sort = sort; 82 | } 83 | } -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/word/RandomWordFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.word; 20 | 21 | import java.util.Random; 22 | 23 | public class RandomWordFactory implements WordFactory { 24 | 25 | protected String characters; 26 | protected int minLength; 27 | protected int maxLength; 28 | 29 | public void setCharacters(String characters) { 30 | this.characters = characters; 31 | } 32 | 33 | public void setMinLength(int minLength) { 34 | this.minLength = minLength; 35 | } 36 | 37 | public void setMaxLength(int maxLength) { 38 | this.maxLength = maxLength; 39 | } 40 | 41 | public RandomWordFactory() { 42 | characters = "absdegkmnopwx23456789"; 43 | minLength = 4; 44 | maxLength = 4; 45 | } 46 | 47 | @Override 48 | public String getNextWord() { 49 | Random rnd = new Random(); 50 | StringBuffer sb = new StringBuffer(); 51 | int l = minLength + (maxLength > minLength ? rnd.nextInt(maxLength - minLength) : 0); 52 | for (int i = 0; i < l; i++) { 53 | int j = rnd.nextInt(characters.length()); 54 | sb.append(characters.charAt(j)); 55 | } 56 | return sb.toString(); 57 | } 58 | 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/webapp/pages/userLogin.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 2 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 3 | <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 4 | 5 | 6 | 7 | 8 | ABV2 登录 9 | <%@ include file="common/common.jsp" %> 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |
18 | 21 |
22 |
23 |
24 | 25 |
26 |
27 | 28 | 29 |
30 | 31 |
32 | 33 | 34 |
35 | 36 |
37 | 38 | 39 | 40 |
41 | 42 |
43 | 44 | 45 |
46 | 47 |
48 | 49 | 注册 50 |
51 |
52 | 53 | 54 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/filter/predefined/RippleFilterFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.filter.predefined; 20 | 21 | import java.awt.image.BufferedImageOp; 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | 25 | import checkcode.patchca.filter.AbstractFilterFactory; 26 | import checkcode.patchca.filter.library.RippleImageOp; 27 | 28 | 29 | public class RippleFilterFactory extends AbstractFilterFactory { 30 | 31 | protected List filters; 32 | protected RippleImageOp ripple; 33 | 34 | public RippleFilterFactory() { 35 | ripple = new RippleImageOp(); 36 | } 37 | 38 | protected List getPreRippleFilters() { 39 | return new ArrayList(); 40 | } 41 | 42 | protected List getPostRippleFilters() { 43 | return new ArrayList(); 44 | 45 | } 46 | 47 | @Override 48 | public List getFilters() { 49 | if (filters == null) { 50 | filters = new ArrayList(); 51 | filters.addAll(getPreRippleFilters()); 52 | filters.add(ripple); 53 | filters.addAll(getPostRippleFilters()); 54 | } 55 | return filters; 56 | } 57 | 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/filter/predefined/CurvesRippleFilterFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.filter.predefined; 20 | 21 | import java.awt.image.BufferedImageOp; 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | 25 | import checkcode.patchca.color.ColorFactory; 26 | import checkcode.patchca.filter.library.CurvesImageOp; 27 | 28 | public class CurvesRippleFilterFactory extends RippleFilterFactory { 29 | 30 | protected CurvesImageOp curves = new CurvesImageOp(); 31 | 32 | public CurvesRippleFilterFactory() { 33 | } 34 | 35 | public CurvesRippleFilterFactory(ColorFactory colorFactory) { 36 | setColorFactory(colorFactory); 37 | } 38 | 39 | @Override 40 | protected List getPreRippleFilters() { 41 | List list = new ArrayList(); 42 | list.add(curves); 43 | return list; 44 | } 45 | 46 | public void setStrokeMin(float strokeMin) { 47 | curves.setStrokeMin(strokeMin); 48 | } 49 | 50 | public void setStrokeMax(float strokeMax) { 51 | curves.setStrokeMax(strokeMax); 52 | } 53 | 54 | public void setColorFactory(ColorFactory colorFactory) { 55 | curves.setColorFactory(colorFactory); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/util/PasswordUtil.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.util; 2 | 3 | import java.security.MessageDigest; 4 | import java.util.Random; 5 | 6 | import org.apache.commons.codec.binary.Hex; 7 | 8 | public class PasswordUtil { 9 | 10 | 11 | /** 12 | * 生成含有随机盐的密码 13 | */ 14 | public static String geneMD5WithSalt(String password) { 15 | Random r = new Random(); 16 | StringBuilder sb = new StringBuilder(16); // 生成一个16位的salt 17 | sb.append(r.nextInt(99999999)).append(r.nextInt(99999999)); // 随机数,即使密码是一样的,生成的密文也是不一样的 18 | int len = sb.length(); 19 | if (len < 16) { 20 | for (int i = 0; i < 16 - len; i++) { 21 | sb.append("0"); 22 | } 23 | } 24 | String salt = sb.toString(); // 生成的salt 25 | password = md5Hex(password + salt); // 32位 26 | char[] cs = new char[48]; 27 | for (int i = 0; i < 48; i += 3) { // 32位的md5密文与16位的salt混合,生成48位的密码 28 | cs[i] = password.charAt(i / 3 * 2); 29 | cs[i + 1] = salt.charAt(i / 3); 30 | cs[i + 2] = password.charAt(i / 3 * 2 + 1); 31 | } 32 | return new String(cs); 33 | } 34 | 35 | /** 36 | * 校验密码是否正确 37 | * 38 | * @param password 是被校验的密码() 39 | * @param md5 数据库中存储的密码(密文) 40 | * @return 41 | */ 42 | public static boolean verifyPassword(String password, String md5) { 43 | char[] cs1 = new char[32]; 44 | char[] cs2 = new char[16]; 45 | for (int i = 0; i < 48; i += 3) { // 将md5密文与salt分离 46 | cs1[i / 3 * 2] = md5.charAt(i); 47 | cs1[i / 3 * 2 + 1] = md5.charAt(i + 2); 48 | cs2[i / 3] = md5.charAt(i + 1); 49 | } 50 | String salt = new String(cs2); 51 | return md5Hex(password + salt).equals(new String(cs1)); 52 | } 53 | 54 | /** 55 | * 获取十六进制字符串形式的MD5摘要 56 | */ 57 | public static String md5Hex(String src) { 58 | try { 59 | MessageDigest md5 = MessageDigest.getInstance("MD5"); 60 | byte[] bs = md5.digest(src.getBytes()); 61 | return new String(new Hex().encode(bs)); 62 | } catch (Exception e) { 63 | return null; 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/word/AdaptiveRandomWordFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.word; 20 | 21 | import java.util.Random; 22 | 23 | public class AdaptiveRandomWordFactory extends RandomWordFactory { 24 | 25 | protected String wideCharacters; 26 | 27 | public void setWideCharacters(String wideCharacters) { 28 | this.wideCharacters = wideCharacters; 29 | } 30 | 31 | public AdaptiveRandomWordFactory() { 32 | characters = "absdegkmnopwx23456789"; 33 | wideCharacters = "mw"; 34 | } 35 | 36 | @Override 37 | public String getNextWord() { 38 | Random rnd = new Random(); 39 | StringBuffer sb = new StringBuffer(); 40 | StringBuffer chars = new StringBuffer(characters); 41 | int l = minLength + (maxLength > minLength ? rnd.nextInt(maxLength - minLength) : 0); 42 | for (int i = 0; i < l; i++) { 43 | int j = rnd.nextInt(chars.length()); 44 | char c = chars.charAt(j); 45 | if (wideCharacters.indexOf(c) != -1) { 46 | for (int k = 0; k < wideCharacters.length(); k++) { 47 | int idx = chars.indexOf(String.valueOf(wideCharacters.charAt(k))); 48 | if (idx != -1) { 49 | chars.deleteCharAt(idx); 50 | } 51 | } 52 | } 53 | sb.append(c); 54 | } 55 | return sb.toString(); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/mapper/BalanceMapper.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.mapper; 2 | 3 | import com.taoxiuxia.model.Balance; 4 | import com.taoxiuxia.model.BalanceExample; 5 | import java.util.List; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | public interface BalanceMapper { 9 | 10 | /** 11 | * 本月收入 12 | * @param userId 13 | * @return 14 | */ 15 | float selectMonthlyIncome(int userId); 16 | 17 | /** 18 | * 本月支出 19 | * @param userId 20 | * @return 21 | */ 22 | float selectMonthlyExpenditure(int userId); 23 | 24 | /** 25 | * 本月支出中花呗与信用卡的数额 26 | * 27 | * @param userId 28 | * @return 29 | */ 30 | float selectNotActualExpenditure(int userId); 31 | 32 | /** 33 | * 查询月初结余,即上月末结余 34 | * @param userId 35 | * @return 36 | */ 37 | Balance selectBalanceInBeginOfMonth(int userId); 38 | 39 | /** 40 | * 查询本月结余,如果有就返回实际值,如果没有就返回null 41 | * @param userId 42 | * @return 43 | */ 44 | Balance selectBalanceOfThisMonth(int userId); 45 | 46 | /** 47 | * 向数据库中插入本月实际的结余(由于种种原因,实际的结余总是与记录的数有出入,比如忘记记录) 48 | * 每月只能插入一次,第一次插入,之后都是修改 49 | * @param balance 50 | */ 51 | void insertBalance(Balance balance); 52 | 53 | /** 54 | * 修改本月结余 55 | * @param balance 56 | */ 57 | void updateByPrimaryKeySelective(Balance balance); 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | /////////////////////////////////////////////////////////// 67 | 68 | int countByExample(BalanceExample example); 69 | 70 | int deleteByExample(BalanceExample example); 71 | 72 | int deleteByPrimaryKey(Integer id); 73 | 74 | int insert(Balance record); 75 | 76 | int insertSelective(Balance record); 77 | 78 | List selectByExample(BalanceExample example); 79 | 80 | Balance selectByPrimaryKey(Integer id); 81 | 82 | int updateByExampleSelective(@Param("record") Balance record, @Param("example") BalanceExample example); 83 | 84 | int updateByExample(@Param("record") Balance record, @Param("example") BalanceExample example); 85 | 86 | int updateByPrimaryKey(Balance record); 87 | } -------------------------------------------------------------------------------- /src/main/webapp/res/js/manageItems.js: -------------------------------------------------------------------------------- 1 | function addItem(inOrEx){ 2 | layer.confirm( 3 | $("#addItemLayer").html(),{ 4 | btn: ['添加','返回'] //按钮 5 | }, function(){ 6 | var content = $(".layui-layer-content"); 7 | var itemName = content.find("#addedItemName").val(); 8 | var remark = content.find("#addedItemRemark").val(); 9 | 10 | if(!validateNotEmpty(itemName, "项目名称不能为空")){ 11 | return false; 12 | } 13 | if(!validateLength(itemName, 0, 199, "项目名称不能超过199个字符")){ 14 | return false; 15 | } 16 | if(!validateLength(remark, 0, 199, "备注不能超过199个字符")){ 17 | return false; 18 | } 19 | 20 | $.post("../itemController/addItem",{ 21 | "itemName":itemName, 22 | "remark":remark, 23 | "inOrEx":inOrEx 24 | }); 25 | setTimeout('location.reload()', 1000); 26 | }); 27 | } 28 | 29 | function changeItem(itemId, itemName,remark,inOrEx){ 30 | layer.confirm( 31 | $("#addItemLayer").html(),{ 32 | btn: ['修改','返回'], //按钮 33 | success: function(layero, index){ 34 | var content = $(".layui-layer-content"); 35 | content.find("#addedItemName").val(itemName); 36 | content.find("#addedItemRemark").val(remark); 37 | } 38 | }, function(){ 39 | var content = $(".layui-layer-content"); 40 | var itemName = content.find("#addedItemName").val(); 41 | var remark = content.find("#addedItemRemark").val(); 42 | if(!validateNotEmpty(itemName, "项目名称不能为空")){ 43 | return false; 44 | } 45 | if(!validateLength(itemName, 0, 199, "项目名称不能超过199个字符")){ 46 | return false; 47 | } 48 | if(!validateLength(remark, 0, 199, "备注不能超过199个字符")){ 49 | return false; 50 | } 51 | $.post("../itemController/changeItem",{ 52 | "itemId":itemId, 53 | "itemName":itemName, 54 | "remark":remark, 55 | "inOrEx":inOrEx 56 | }); 57 | setTimeout('location.reload()', 1000); 58 | }); 59 | } 60 | 61 | function delItem(itemId){ 62 | layer.confirm('确认删除?', { 63 | btn: ['删除','返回'] //按钮 64 | }, function(){ 65 | $.post("../itemController/deleItem",{ 66 | "itemId":itemId, 67 | }); 68 | setTimeout('location.reload()', 1000); 69 | }, function(){ 70 | }); 71 | } 72 | -------------------------------------------------------------------------------- /src/main/webapp/res/js/common/common.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 在日期框中填入今天的日期,(默认当前日期); 3 | */ 4 | function fillUpDate(){ 5 | var myDate = new Date().Format("yyyy-MM-dd"); 6 | $("#date").val(myDate); 7 | } 8 | 9 | 10 | // 来源: http://www.cnblogs.com/zhangpengshou/archive/2012/07/19/2599053.html 11 | // 对Date的扩展,将 Date转化为指定格式的String 12 | // 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符, 13 | // 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字) 14 | // 例子: 15 | // (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423 16 | // (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18 17 | Date.prototype.Format = function (fmt) { //author: meizz 18 | var o = { 19 | "M+": this.getMonth() + 1, //月份 20 | "d+": this.getDate(), //日 21 | "h+": this.getHours(), //小时 22 | "m+": this.getMinutes(), //分 23 | "s+": this.getSeconds(), //秒 24 | "q+": Math.floor((this.getMonth() + 3) / 3), //季度 25 | "S": this.getMilliseconds() //毫秒 26 | }; 27 | if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); 28 | for (var k in o) 29 | if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); 30 | return fmt; 31 | } 32 | 33 | //列表项上移下移,用于项目管理和收支方式管理 34 | function upAndDown(type, inOrex, id, upAndDown){ 35 | var target; 36 | if(type == "item"){ 37 | targetUrl = "../itemController/upAndDownItem"; 38 | }else if(type == "payMethod"){ 39 | targetUrl = "../payMethodController/upAndDownPayMethod"; // 收入支出方式的url 40 | } 41 | $.ajax({ 42 | type: "POST", 43 | url: targetUrl, 44 | data: { 45 | "inOrEx":inOrex, 46 | "itemId":id, 47 | "payMethodId":id, 48 | "upAndDown":upAndDown 49 | }, 50 | success: function(msg){ 51 | layer.msg(msg.info); 52 | setTimeout(function(){ 53 | location.reload(); 54 | },1000); 55 | }, 56 | error: function (msg) {//XMLHttpRequest, textStatus, errorThrown 57 | alert("请求失败"); 58 | } 59 | }); 60 | } 61 | 62 | function replaceEnter2Space(str){ 63 | str = str.replace(/\r\n/g," "); //将回车符和换行符替换成空格,否则页面会报错 64 | str = str.replace(/\n/g," "); 65 | return str; 66 | } -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/text/renderer/TextString.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.text.renderer; 20 | 21 | import java.util.ArrayList; 22 | 23 | public class TextString { 24 | 25 | private ArrayList characters = new ArrayList(); 26 | 27 | public void clear() { 28 | characters.clear(); 29 | } 30 | 31 | public void addCharacter(TextCharacter tc) { 32 | characters.add(tc); 33 | } 34 | 35 | public ArrayList getCharacters() { 36 | return characters; 37 | } 38 | 39 | public double getWidth() { 40 | double minx = 0; 41 | double maxx = 0; 42 | boolean first = true; 43 | for (TextCharacter tc : characters) { 44 | if (first) { 45 | minx = tc.getX(); 46 | maxx = tc.getX() + tc.getWidth(); 47 | first = false; 48 | } else { 49 | if (minx > tc.getX()) { 50 | minx = tc.getX(); 51 | } 52 | if (maxx < tc.getX() + tc.getWidth()) { 53 | maxx = tc.getX() + tc.getWidth(); 54 | } 55 | } 56 | 57 | } 58 | return maxx - minx; 59 | } 60 | 61 | public double getHeight() { 62 | double miny = 0; 63 | double maxy = 0; 64 | boolean first = true; 65 | for (TextCharacter tc : characters) { 66 | if (first) { 67 | miny = tc.getY(); 68 | maxy = tc.getY() + tc.getHeight(); 69 | first = false; 70 | } else { 71 | if (miny > tc.getY()) { 72 | miny = tc.getY(); 73 | } 74 | if (maxy < tc.getY() + tc.getHeight()) { 75 | maxy = tc.getY() + tc.getHeight(); 76 | } 77 | } 78 | 79 | } 80 | return maxy - miny; 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /src/main/webapp/res/foldingMenu/js/html5.js: -------------------------------------------------------------------------------- 1 | /* 2 | HTML5 Shiv v3.7.0 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed 3 | */ 4 | (function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag(); 5 | a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x"; 6 | c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode|| 7 | "undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:"3.7.0",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f); 8 | if(g)return a.createDocumentFragment();for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d. 18 | */ 19 | package checkcode.patchca.filter.library; 20 | 21 | 22 | public class RippleImageOp extends AbstractTransformImageOp { 23 | 24 | protected double xWavelength; 25 | protected double yWavelength; 26 | protected double xAmplitude; 27 | protected double yAmplitude; 28 | protected double xRandom; 29 | protected double yRandom; 30 | 31 | public RippleImageOp() { 32 | xWavelength = 20; 33 | yWavelength = 10; 34 | xAmplitude = 5; 35 | yAmplitude = 5; 36 | xRandom = 5 * Math.random(); 37 | yRandom = 5 * Math.random(); 38 | } 39 | 40 | public double getxWavelength() { 41 | return xWavelength; 42 | } 43 | 44 | public void setxWavelength(double xWavelength) { 45 | this.xWavelength = xWavelength; 46 | } 47 | 48 | public double getyWavelength() { 49 | return yWavelength; 50 | } 51 | 52 | public void setyWavelength(double yWavelength) { 53 | this.yWavelength = yWavelength; 54 | } 55 | 56 | public double getxAmplitude() { 57 | return xAmplitude; 58 | } 59 | 60 | public void setxAmplitude(double xAmplitude) { 61 | this.xAmplitude = xAmplitude; 62 | } 63 | 64 | public double getyAmplitude() { 65 | return yAmplitude; 66 | } 67 | 68 | public void setyAmplitude(double yAmplitude) { 69 | this.yAmplitude = yAmplitude; 70 | } 71 | 72 | @Override 73 | protected void transform(int x, int y, double[] t) { 74 | double tx = Math.sin((double) y / yWavelength + yRandom); 75 | double ty = Math.cos((double) x / xWavelength + xRandom); 76 | t[0] = x + xAmplitude * tx; 77 | t[1] = y + yAmplitude * ty; 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/model/Income.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.model; 2 | 3 | import java.util.Date; 4 | 5 | public class Income { 6 | 7 | private int id; 8 | 9 | private int itemId; 10 | 11 | private String itemName; 12 | 13 | private int userId; 14 | 15 | private Float money; 16 | 17 | private String type_of_money; 18 | 19 | private Date date; 20 | 21 | private String remark; 22 | 23 | private int dele; 24 | 25 | private String payMethodName; 26 | 27 | private int payMethodId; 28 | 29 | public int getPayMethodId() { 30 | return payMethodId; 31 | } 32 | 33 | public void setPayMethodId(int payMethodId) { 34 | this.payMethodId = payMethodId; 35 | } 36 | 37 | public String getPayMethodName() { 38 | return payMethodName; 39 | } 40 | 41 | public void setPayMethodName(String payMethodName) { 42 | this.payMethodName = payMethodName; 43 | } 44 | 45 | public int getItemId() { 46 | return itemId; 47 | } 48 | 49 | public int getId() { 50 | return id; 51 | } 52 | 53 | public void setId(int id) { 54 | this.id = id; 55 | } 56 | 57 | public void setItemId(int itemId) { 58 | this.itemId = itemId; 59 | } 60 | 61 | public int getUserId() { 62 | return userId; 63 | } 64 | 65 | public void setUserId(int userId) { 66 | this.userId = userId; 67 | } 68 | 69 | public int getDele() { 70 | return dele; 71 | } 72 | 73 | public void setDele(int dele) { 74 | this.dele = dele; 75 | } 76 | 77 | public Float getMoney() { 78 | return money; 79 | } 80 | 81 | public void setMoney(Float money) { 82 | this.money = money; 83 | } 84 | 85 | public String getType_of_money() { 86 | return type_of_money; 87 | } 88 | 89 | public void setType_of_money(String type_of_money) { 90 | this.type_of_money = type_of_money; 91 | } 92 | 93 | public Date getDate() { 94 | return date; 95 | } 96 | 97 | public void setDate(Date date) { 98 | this.date = date; 99 | } 100 | 101 | public String getRemark() { 102 | return remark; 103 | } 104 | 105 | public void setRemark(String remark) { 106 | this.remark = remark; 107 | } 108 | 109 | public String getItemName() { 110 | return itemName; 111 | } 112 | 113 | public void setItemName(String itemName) { 114 | this.itemName = itemName; 115 | } 116 | } -------------------------------------------------------------------------------- /src/main/resources/spring-mvc.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 36 | 37 | 38 | text/plain;charset=UTF-8 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/model/Expenditure.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.model; 2 | 3 | import java.util.Date; 4 | 5 | public class Expenditure { 6 | private Integer id; 7 | 8 | private Integer itemId; 9 | 10 | private String itemName; 11 | 12 | private Integer userId; 13 | 14 | private Float money; 15 | 16 | private String type_of_money; 17 | 18 | private Date date; 19 | 20 | private String remark; 21 | 22 | private Integer dele; 23 | 24 | private String payMethodName; 25 | 26 | public String getPayMethodName() { 27 | return payMethodName; 28 | } 29 | 30 | public void setPayMethodName(String payMethodName) { 31 | this.payMethodName = payMethodName; 32 | } 33 | 34 | public Integer getId() { 35 | return id; 36 | } 37 | 38 | public void setId(Integer id) { 39 | this.id = id; 40 | } 41 | 42 | public Integer getItemId() { 43 | return itemId; 44 | } 45 | 46 | public String getItemName() { 47 | return itemName; 48 | } 49 | 50 | public void setItemName(String itemName) { 51 | this.itemName = itemName; 52 | } 53 | 54 | public void setItemId(Integer itemId) { 55 | this.itemId = itemId; 56 | } 57 | 58 | public Integer getUserId() { 59 | return userId; 60 | } 61 | 62 | public void setUserId(Integer userId) { 63 | this.userId = userId; 64 | } 65 | 66 | public Float getMoney() { 67 | return money; 68 | } 69 | 70 | public void setMoney(Float money) { 71 | this.money = money; 72 | } 73 | 74 | public String getType_of_money() { 75 | return type_of_money; 76 | } 77 | 78 | public void setType_of_money(String type_of_money) { 79 | this.type_of_money = type_of_money; 80 | } 81 | 82 | public Date getDate() { 83 | return date; 84 | } 85 | 86 | public void setDate(Date date) { 87 | this.date = date; 88 | } 89 | 90 | public String getRemark() { 91 | return remark; 92 | } 93 | 94 | public void setRemark(String remark) { 95 | this.remark = remark == null ? null : remark.trim(); 96 | } 97 | 98 | public Integer getDele() { 99 | return dele; 100 | } 101 | 102 | public void setDele(Integer dele) { 103 | this.dele = dele; 104 | } 105 | } -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/service/SimpleCaptchaService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.service; 20 | 21 | import java.awt.*; 22 | 23 | import checkcode.patchca.background.SingleColorBackgroundFactory; 24 | import checkcode.patchca.color.SingleColorFactory; 25 | import checkcode.patchca.filter.FilterFactory; 26 | import checkcode.patchca.font.RandomFontFactory; 27 | import checkcode.patchca.text.renderer.BestFitTextRenderer; 28 | import checkcode.patchca.word.AdaptiveRandomWordFactory; 29 | 30 | public class SimpleCaptchaService extends AbstractCaptchaService { 31 | 32 | public SimpleCaptchaService(int width, int height, Color textColor, Color backgroundColor, int fontSize, FilterFactory ff) { 33 | backgroundFactory = new SingleColorBackgroundFactory(backgroundColor); 34 | wordFactory = new AdaptiveRandomWordFactory(); 35 | fontFactory = new RandomFontFactory(); 36 | textRenderer = new BestFitTextRenderer(); 37 | colorFactory = new SingleColorFactory(textColor); 38 | filterFactory = ff; 39 | this.width = width; 40 | this.height = height; 41 | } 42 | 43 | public SimpleCaptchaService(int width, int height, Color textColor, Color backgroundColor, int fontSize, String[]fontNames, FilterFactory ff) { 44 | backgroundFactory = new SingleColorBackgroundFactory(backgroundColor); 45 | wordFactory = new AdaptiveRandomWordFactory(); 46 | fontFactory = new RandomFontFactory(fontNames); 47 | textRenderer = new BestFitTextRenderer(); 48 | colorFactory = new SingleColorFactory(textColor); 49 | filterFactory = ff; 50 | this.width = width; 51 | this.height = height; 52 | } 53 | 54 | @Override 55 | public Captcha getCaptcha() { 56 | return null; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/service/impl/IncomeServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.service.impl; 2 | 3 | import java.util.Date; 4 | import java.util.HashMap; 5 | import java.util.List; 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | 10 | import com.taoxiuxia.mapper.IncomeMapper; 11 | import com.taoxiuxia.model.Income; 12 | import com.taoxiuxia.service.IIncomeService; 13 | import com.taoxiuxia.util.Constants; 14 | import com.taoxiuxia.util.MyDateFormat; 15 | 16 | @Service("incomeService") 17 | public class IncomeServiceImpl implements IIncomeService { 18 | 19 | private IncomeMapper incomeMapper; 20 | 21 | public IncomeMapper getIncomeMapper() { 22 | return incomeMapper; 23 | } 24 | 25 | @Autowired 26 | public void setIncomeMapper(IncomeMapper incomeMapper) { 27 | this.incomeMapper = incomeMapper; 28 | } 29 | 30 | /** 31 | * 加载用户的本月的收入 32 | */ 33 | @Override 34 | public List loadIncomes(int userId) { 35 | HashMap map = new HashMap(); 36 | map.put("userId", userId); 37 | map.put("dataScale", Constants.ONLY_THIS_MONTH); 38 | return incomeMapper.selectAllIncomes(map); 39 | } 40 | 41 | /** 42 | * 添加收入income 43 | */ 44 | @Override 45 | public void addIncome(int userId, String date, int item, float money, String moneyType, String remark) { 46 | Income income = new Income(); 47 | income.setItemId(item); 48 | income.setUserId(userId); 49 | income.setDele(Constants.NOT_DELE); 50 | income.setMoney(money); 51 | income.setType_of_money(moneyType); 52 | income.setDate(MyDateFormat.dateFormat(date)); 53 | income.setRemark(remark); 54 | incomeMapper.insert(income); 55 | } 56 | 57 | /** 58 | * 修改income 59 | */ 60 | @Override 61 | public void changeIncome(int incomeId, float money, String moneyType, int itemId, String remark, Date date) { 62 | Income income = new Income(); 63 | income.setId(incomeId); 64 | income.setItemId(itemId); 65 | income.setMoney(money); 66 | income.setType_of_money(moneyType); 67 | income.setRemark(remark); 68 | income.setDate(date); 69 | incomeMapper.updateByPrimaryKeySelective(income); 70 | } 71 | 72 | /** 73 | * 删除income,只需要incomeId定位,其他的字段都不需要 74 | */ 75 | @Override 76 | public void deleIncome(int incomeId) { 77 | Income income = new Income(); 78 | income.setId(incomeId); 79 | income.setDele(Constants.DELE); 80 | incomeMapper.updateByPrimaryKeySelective(income); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/util/StringTools.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.util; 2 | 3 | public class StringTools { 4 | /* 5 | private final static String[] hexDigits = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f" }; 6 | 7 | private static String byteArrayToHexString(byte[] b) { 8 | StringBuffer resultSb = new StringBuffer(); 9 | for (int i = 0; i < b.length; i++) { 10 | resultSb.append(byteToHexString(b[i])); 11 | } 12 | return resultSb.toString(); 13 | } 14 | 15 | private static String byteToHexString(byte b) { 16 | int n = b; 17 | if (n < 0) { 18 | n = 256 + n; 19 | } 20 | int d1 = n / 16; 21 | int d2 = n % 16; 22 | return hexDigits[d1] + hexDigits[d2]; 23 | } 24 | */ 25 | /** 26 | * 判断是否为空 27 | * 28 | * @param str 29 | * @return 30 | */ 31 | public static boolean isEmpty(String str) { 32 | if (null == str || "".equals(str)||"null".equals(str)) { 33 | return true; 34 | } else if ("".equals(str.trim())) { 35 | return true; 36 | } 37 | return false; 38 | } 39 | 40 | 41 | /** 42 | * 校验是否是数字 43 | * 44 | * @param str 45 | * @return 46 | */ 47 | public static boolean isNumber(String str) { 48 | String checkPassword = "^[0-9]+$"; 49 | if (null == str) { 50 | return false; 51 | } 52 | if (!str.matches(checkPassword)) { 53 | return false; 54 | } 55 | return true; 56 | } 57 | 58 | /** 59 | * 校验邮箱格式 60 | * 61 | * @param email 62 | * @return 63 | */ 64 | public static boolean checkEmail(String email) { 65 | String checkEamil = "^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$"; 66 | if (!isEmpty(email)) { 67 | return email.matches(checkEamil); 68 | } else { 69 | return false; 70 | } 71 | } 72 | 73 | /** 74 | * 校验用户名格式 75 | * 76 | * @param userName 77 | * @return 78 | */ 79 | public static boolean checkUsername(String userName) { 80 | String checkUsername = "^[\\w\\u4e00-\\u9fa5]+$"; 81 | if (!isEmpty(userName)) { 82 | return userName.matches(checkUsername); 83 | } else { 84 | return false; 85 | } 86 | } 87 | 88 | /** 89 | * 校验密码格式 90 | * 91 | * @param password 92 | * @return 93 | */ 94 | public static boolean checkPassword(String password) { 95 | String checkPassword = "^[0-9a-zA-Z]+$"; 96 | if (!isEmpty(password)) { 97 | return password.matches(checkPassword); 98 | } else { 99 | return false; 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/filter/library/AbstractConvolveImageOp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.filter.library; 20 | 21 | public abstract class AbstractConvolveImageOp extends AbstractImageOp { 22 | 23 | private float[][] matrix; 24 | 25 | protected AbstractConvolveImageOp(float[][] matrix) { 26 | this.matrix = matrix; 27 | } 28 | 29 | @Override 30 | protected void filter(int[] inPixels, int[] outPixels, int width, int height) { 31 | long time1 = System.currentTimeMillis(); 32 | int matrixWidth = matrix[0].length; 33 | int matrixHeight = matrix.length; 34 | int mattrixLeft = - matrixWidth / 2; 35 | int matrixTop = - matrixHeight / 2; 36 | for (int y = 0; y < height; y++) { 37 | int ytop = y + matrixTop; 38 | int ybottom = y + matrixTop + matrixHeight; 39 | for (int x = 0; x < width; x++) { 40 | float[] sum = {0.5f, 0.5f, 0.5f, 0.5f}; 41 | int xleft = x + mattrixLeft; 42 | int xright = x + mattrixLeft + matrixWidth; 43 | int matrixY = 0; 44 | for (int my = ytop; my < ybottom; my ++, matrixY++) { 45 | int matrixX = 0; 46 | for (int mx = xleft; mx < xright; mx ++, matrixX ++) { 47 | int pixel = getPixel(inPixels, mx, my, width, height, EDGE_ZERO); 48 | float m = matrix[matrixY][matrixX]; 49 | sum[0] += m * ((pixel >> 24) & 0xff); 50 | sum[1] += m * ((pixel >> 16) & 0xff); 51 | sum[2] += m * ((pixel >> 8) & 0xff); 52 | sum[3] += m * (pixel & 0xff); 53 | } 54 | } 55 | outPixels[x + y * width] = (limitByte((int)sum[0]) << 24) | (limitByte((int) sum[1]) << 16) | (limitByte((int)sum[2]) << 8) | (limitByte((int)sum[3])); 56 | } 57 | } 58 | long time2 = System.currentTimeMillis() - time1; 59 | //System.out.println("AbstractConvolveImageOp " + time2); 60 | 61 | } 62 | 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/webapp/pages/menu.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 2 | <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 3 | 4 | 5 | 6 | 7 | Account Book v2 T 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 40 | 41 | 42 | 64 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/font/RandomFontFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.font; 20 | 21 | import java.awt.*; 22 | import java.util.ArrayList; 23 | import java.util.Arrays; 24 | import java.util.List; 25 | import java.util.Random; 26 | 27 | public class RandomFontFactory implements FontFactory { 28 | 29 | protected List families; 30 | protected int minSize; 31 | protected int maxSize; 32 | protected boolean randomStyle; 33 | 34 | public RandomFontFactory() { 35 | families = new ArrayList(); 36 | families.add("Verdana"); 37 | families.add("Tahoma"); 38 | minSize = 45; 39 | maxSize = 45; 40 | } 41 | 42 | public RandomFontFactory(List families) { 43 | this(); 44 | this.families = families; 45 | } 46 | 47 | public RandomFontFactory(String[] families) { 48 | this(); 49 | this.families = Arrays.asList(families); 50 | } 51 | 52 | public RandomFontFactory(int size, List families) { 53 | this(families); 54 | minSize = maxSize = size; 55 | } 56 | 57 | public RandomFontFactory(int size, String[] families) { 58 | this(families); 59 | minSize = maxSize = size; 60 | } 61 | 62 | public void setFamilies(List families) { 63 | this.families = families; 64 | } 65 | 66 | public void setMinSize(int minSize) { 67 | this.minSize = minSize; 68 | } 69 | 70 | public void setMaxSize(int maxSize) { 71 | this.maxSize = maxSize; 72 | } 73 | 74 | public void setRandomStyle(boolean randomStyle) { 75 | this.randomStyle = randomStyle; 76 | } 77 | 78 | @Override 79 | public Font getFont(int index) { 80 | Random r = new Random(); 81 | String family = families.get(r.nextInt(families.size())); 82 | boolean bold = r.nextBoolean() && randomStyle; 83 | int size = minSize; 84 | if (maxSize - minSize > 0) { 85 | size += r.nextInt(maxSize - minSize); 86 | } 87 | return new Font(family, bold ? Font.BOLD : Font.PLAIN, size); 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/service/impl/ExpenditureServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.service.impl; 2 | 3 | import java.util.Date; 4 | import java.util.HashMap; 5 | import java.util.List; 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | 10 | import com.taoxiuxia.mapper.ExpenditureMapper; 11 | import com.taoxiuxia.model.Expenditure; 12 | import com.taoxiuxia.service.IExpenditureService; 13 | import com.taoxiuxia.util.Constants; 14 | import com.taoxiuxia.util.MyDateFormat; 15 | 16 | @Service("expenditureService") 17 | public class ExpenditureServiceImpl implements IExpenditureService { 18 | 19 | private ExpenditureMapper expenditureMapper; 20 | 21 | public ExpenditureMapper getExpenditureMapper() { 22 | return expenditureMapper; 23 | } 24 | 25 | @Autowired 26 | public void setExpenditureMapper(ExpenditureMapper expenditureMapper) { 27 | this.expenditureMapper = expenditureMapper; 28 | } 29 | 30 | /** 31 | * 加载用户的全部支出 32 | */ 33 | @Override 34 | public List loadExpenditures(int userId) { 35 | HashMap map = new HashMap(); 36 | map.put("userId", userId); 37 | map.put("dataScale", Constants.ONLY_THIS_MONTH); 38 | return expenditureMapper.selectAllExpenditures(map); 39 | } 40 | 41 | /** 42 | * 添加支出 43 | */ 44 | @Override 45 | public void addExpenditure(int userId, String date, int item, float money, String moneyType, String remark) { 46 | Expenditure expenditure = new Expenditure(); 47 | expenditure.setItemId(item); 48 | expenditure.setUserId(userId); 49 | expenditure.setDele(Constants.NOT_DELE); 50 | expenditure.setMoney(money); 51 | expenditure.setType_of_money(moneyType); 52 | expenditure.setDate(MyDateFormat.dateFormat(date)); 53 | expenditure.setRemark(remark); 54 | expenditureMapper.insert(expenditure); 55 | } 56 | 57 | /** 58 | * 修改支出 59 | */ 60 | @Override 61 | public void changeExpenditure(int expenditureId, float money, String moneyType, int itemId, String remark,Date date) { 62 | Expenditure expenditure = new Expenditure(); 63 | expenditure.setId(expenditureId); 64 | expenditure.setItemId(itemId); 65 | expenditure.setMoney(money); 66 | expenditure.setType_of_money(moneyType); 67 | expenditure.setRemark(remark); 68 | expenditure.setDate(date); 69 | expenditureMapper.updateByPrimaryKeySelective(expenditure); 70 | } 71 | 72 | /** 73 | * 删除支出,只需要expenditureId定位,其他的字段都不需要 74 | */ 75 | @Override 76 | public void deleExpenditure(int expenditureId) { 77 | Expenditure expenditure = new Expenditure(); 78 | expenditure.setId(expenditureId); 79 | expenditure.setDele(Constants.DELE); 80 | expenditureMapper.updateByPrimaryKeySelective(expenditure); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/filter/library/MarbleImageOp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.filter.library; 20 | 21 | public class MarbleImageOp extends AbstractTransformImageOp { 22 | 23 | double scale; 24 | double amount; 25 | double turbulence; 26 | double[] tx; 27 | double[] ty; 28 | double randomX; 29 | double randomY; 30 | 31 | public MarbleImageOp() { 32 | scale = 15; 33 | amount = 1.1; 34 | turbulence = 6.2; 35 | randomX = 256 * Math.random(); 36 | randomY = 256 * Math.random(); 37 | } 38 | 39 | public double getScale() { 40 | return scale; 41 | } 42 | 43 | public void setScale(double scale) { 44 | this.scale = scale; 45 | } 46 | 47 | public double getAmount() { 48 | return amount; 49 | } 50 | 51 | public void setAmount(double amount) { 52 | this.amount = amount; 53 | } 54 | 55 | public double getTurbulence() { 56 | return turbulence; 57 | } 58 | 59 | public void setTurbulence(double turbulence) { 60 | this.turbulence = turbulence; 61 | } 62 | 63 | @Override 64 | protected synchronized void init() { 65 | tx = new double[256]; 66 | ty = new double[256]; 67 | for (int i = 0; i < 256; i++) { 68 | double angle = 2 * Math.PI * i * turbulence / 256; 69 | tx[i] = amount * Math.sin(angle); 70 | ty[i] = amount * Math.cos(angle); 71 | } 72 | } 73 | 74 | @Override 75 | protected void transform(int x, int y, double[] t) { 76 | int d = limitByte((int) (127 * (1 + PerlinNoise.noise2D(((double)x) / scale + randomX, ((double)y) / scale + randomY)))); 77 | t[0] = x + tx[d]; 78 | t[1] = y + ty[d]; 79 | } 80 | 81 | protected void filter2(int[] inPixels, int[] outPixels, int width, int height) { 82 | for (int y = 0; y < height; y++) { 83 | for (int x = 0; x < width; x++) { 84 | int pixel = limitByte((int) (127 * (1 + PerlinNoise.noise2D(((double)x) / scale + randomX, ((double)y) / scale + randomY)))); 85 | outPixels[x + y * width] = (limitByte((int)255) << 24) | (limitByte((int)pixel) << 16) | (limitByte((int)pixel) << 8) | (limitByte((int)pixel)); 86 | } 87 | } 88 | } 89 | 90 | 91 | } 92 | -------------------------------------------------------------------------------- /src/main/webapp/res/js/common/incomeAndExpenditure.js: -------------------------------------------------------------------------------- 1 | //本文件中的js方法用于income和Expenditure页面中的搜索和页面跳转 2 | //现在还没有做 3 | 4 | /** 5 | * 前一页/后一页 6 | * @param forOrBackward 7 | * @param totalPages 8 | */ 9 | function gotoPage(forOrBackward, totalPages){ 10 | var page = parseInt($("#curPage").text()) + parseInt(forOrBackward); 11 | if(page < 1){ 12 | page = 1; 13 | }else if(page>totalPages){ 14 | page = totalPages; 15 | } 16 | search(page); 17 | } 18 | 19 | /** 20 | * 搜索第n页的数据 21 | * @param page 22 | */ 23 | function search(page){ 24 | var type = $("#type option:selected").val(); 25 | var year = $("#year option:selected").val(); 26 | var month = $("#month option:selected").val(); 27 | var keyword = $("#keyword").val(); 28 | var sortBy = $("#sortBy option:selected").val(); 29 | $.ajax({ 30 | type: "POST", 31 | url: "searchHistory", 32 | data: { 33 | "type":type, 34 | "year":year, 35 | "month":month, 36 | "keyword":keyword, 37 | "sortBy":sortBy, 38 | "curPage":page 39 | }, 40 | success: function(msg){ 41 | $("#details tr:not(:first)").empty(""); // 将表格置为空 42 | if(msg.list!=null){ 43 | var len = msg.list.length; 44 | for(var i=0;i修改   "+ 56 | "删除"; 61 | 62 | //处理金额money:如果金额为整数,如10元,则处理为10.0元 63 | var money; 64 | if(msg.list[i].money*100%100==0){ 65 | money = msg.list[i].money+".0"; 66 | }else{ 67 | money =msg.list[i].money 68 | } 69 | 70 | $("#detailItems").append( 71 | ""+ 72 | " "+ msg.dateList[i] +""+ 73 | " "+ msg.typeList[i] +""+ 74 | " "+ msg.list[i].itemName +""+ 75 | " "+ msg.list[i].type_of_money +""+ 76 | " "+ money +""+ 77 | " "+ msg.list[i].remark +""+ 78 | " "+ operation +""+ 79 | "" 80 | ) 81 | } 82 | } 83 | $("#curPage").text(msg.curPage); 84 | $("#totalPages").text(msg.totalPages); 85 | $("#totalRecords").text(msg.totalRecords); 86 | }, 87 | error: function (msg) {//XMLHttpRequest, textStatus, errorThrown 88 | alert("请求失败"); 89 | } 90 | }); 91 | } 92 | 93 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/filter/library/WobbleImageOp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.filter.library; 20 | 21 | 22 | public class WobbleImageOp extends AbstractTransformImageOp { 23 | 24 | private double xWavelength; 25 | private double yWavelength; 26 | private double xAmplitude; 27 | private double yAmplitude; 28 | private double xRandom; 29 | private double yRandom; 30 | private double xScale; 31 | private double yScale; 32 | 33 | public WobbleImageOp() { 34 | xWavelength = 15; 35 | yWavelength = 15; 36 | xAmplitude = 4.0; 37 | yAmplitude = 3.0; 38 | xScale = 1.0; 39 | yScale = 1.0; 40 | xRandom = 3 * Math.random(); 41 | yRandom = 10 * Math.random(); 42 | } 43 | 44 | public double getxWavelength() { 45 | return xWavelength; 46 | } 47 | 48 | public void setxWavelength(double xWavelength) { 49 | this.xWavelength = xWavelength; 50 | } 51 | 52 | public double getyWavelength() { 53 | return yWavelength; 54 | } 55 | 56 | public void setyWavelength(double yWavelength) { 57 | this.yWavelength = yWavelength; 58 | } 59 | 60 | public double getxAmplitude() { 61 | return xAmplitude; 62 | } 63 | 64 | public void setxAmplitude(double xAmplitude) { 65 | this.xAmplitude = xAmplitude; 66 | } 67 | 68 | public double getyAmplitude() { 69 | return yAmplitude; 70 | } 71 | 72 | public void setyAmplitude(double yAmplitude) { 73 | this.yAmplitude = yAmplitude; 74 | } 75 | 76 | public double getxScale() { 77 | return xScale; 78 | } 79 | 80 | public void setxScale(double xScale) { 81 | this.xScale = xScale; 82 | } 83 | 84 | public double getyScale() { 85 | return yScale; 86 | } 87 | 88 | public void setyScale(double yScale) { 89 | this.yScale = yScale; 90 | } 91 | 92 | @Override 93 | protected void transform(int x, int y, double[] t) { 94 | double tx = Math.cos((double) (xScale * x + y) / xWavelength + xRandom); 95 | double ty = Math.sin((double) (yScale * y + x) / yWavelength + yRandom); 96 | t[0] = x + xAmplitude * tx; 97 | t[1] = y + yAmplitude * ty; 98 | 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/text/renderer/TextCharacter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.text.renderer; 20 | 21 | import java.awt.*; 22 | import java.awt.font.TextAttribute; 23 | import java.text.AttributedCharacterIterator; 24 | import java.text.AttributedString; 25 | 26 | public class TextCharacter { 27 | 28 | private double x; 29 | private double y; 30 | private double width; 31 | private double height; 32 | private double ascent; 33 | private double descent; 34 | private char character; 35 | private Font font; 36 | private Color color; 37 | 38 | public double getX() { 39 | return x; 40 | } 41 | 42 | public void setX(double x) { 43 | this.x = x; 44 | } 45 | 46 | public double getY() { 47 | return y; 48 | } 49 | 50 | public void setY(double y) { 51 | this.y = y; 52 | } 53 | 54 | public double getWidth() { 55 | return width; 56 | } 57 | 58 | public void setWidth(double width) { 59 | this.width = width; 60 | } 61 | 62 | public double getHeight() { 63 | return height; 64 | } 65 | 66 | public void setHeight(double height) { 67 | this.height = height; 68 | } 69 | 70 | public char getCharacter() { 71 | return character; 72 | } 73 | 74 | public void setCharacter(char character) { 75 | this.character = character; 76 | } 77 | 78 | public Font getFont() { 79 | return font; 80 | } 81 | 82 | public void setFont(Font font) { 83 | this.font = font; 84 | } 85 | 86 | public Color getColor() { 87 | return color; 88 | } 89 | 90 | public void setColor(Color color) { 91 | this.color = color; 92 | } 93 | 94 | public double getAscent() { 95 | return ascent; 96 | } 97 | 98 | public void setAscent(double ascent) { 99 | this.ascent = ascent; 100 | } 101 | 102 | public double getDescent() { 103 | return descent; 104 | } 105 | 106 | public void setDescent(double descent) { 107 | this.descent = descent; 108 | } 109 | 110 | public AttributedCharacterIterator iterator() { 111 | AttributedString aString = new AttributedString(String 112 | .valueOf(character)); 113 | aString.addAttribute(TextAttribute.FONT, font, 0, 1); 114 | return aString.getIterator(); 115 | } 116 | 117 | } 118 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | SSM configuration 7 | 8 | 9 | org.springframework.web.context.ContextLoaderListener 10 | 11 | 12 | org.springframework.web.context.request.RequestContextListener 13 | 14 | 15 | 16 | 17 | characterEncodingFilter 18 | org.springframework.web.filter.CharacterEncodingFilter 19 | 20 | encoding 21 | UTF-8 22 | 23 | 24 | 25 | characterEncodingFilter 26 | /* 27 | 28 | 29 | 30 | 31 | contextConfigLocation 32 | classpath:spring.xml,classpath:mybatis-spring.xml 33 | 34 | 35 | 36 | org.springframework.web.context.ContextLoaderListener 37 | 38 | 39 | 40 | 41 | default 42 | *.js 43 | 44 | 45 | default 46 | *.css 47 | 48 | 49 | 50 | 51 | default 52 | *.png 53 | 54 | 55 | default 56 | *.gif 57 | 58 | 59 | 60 | 61 | 62 | springDispatcherServlet 63 | org.springframework.web.servlet.DispatcherServlet 64 | 65 | contextConfigLocation 66 | classpath:spring-mvc.xml 67 | 68 | 1 69 | 70 | 71 | springDispatcherServlet 72 | / 73 | 74 | 75 | 76 | 77 | autoLogin 78 | com.taoxiuxia.filter.AuthorityFilter 79 | 80 | 81 | autoLogin 82 | /* 83 | 84 | 85 | 86 | 87 | userController/showUserLogin.action 88 | 89 | 90 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/model/User.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.model; 2 | 3 | import java.util.Date; 4 | 5 | public class User { 6 | private Integer id; 7 | 8 | private String name; 9 | 10 | private String email; 11 | 12 | private String password; 13 | 14 | private Integer age; 15 | 16 | private String sex; 17 | 18 | private String remark; 19 | 20 | private Date registerTime; 21 | 22 | private Date lastLoginTime; 23 | 24 | private Integer isActive; 25 | 26 | private String activationCode; 27 | 28 | private String activationCodeTime; 29 | 30 | public Integer getIsActive() { 31 | return isActive; 32 | } 33 | 34 | public void setIsActive(Integer isActive) { 35 | this.isActive = isActive; 36 | } 37 | 38 | public String getActivationCodeTime() { 39 | return activationCodeTime; 40 | } 41 | 42 | public void setActivationCodeTime(String activationCodeTime) { 43 | this.activationCodeTime = activationCodeTime; 44 | } 45 | 46 | public Integer getId() { 47 | return id; 48 | } 49 | 50 | public void setId(Integer id) { 51 | this.id = id; 52 | } 53 | 54 | public String getName() { 55 | return name; 56 | } 57 | 58 | public void setName(String name) { 59 | this.name = name == null ? null : name.trim(); 60 | } 61 | 62 | public String getEmail() { 63 | return email; 64 | } 65 | 66 | public void setEmail(String email) { 67 | this.email = email == null ? null : email.trim(); 68 | } 69 | 70 | public String getPassword() { 71 | return password; 72 | } 73 | 74 | public void setPassword(String password) { 75 | this.password = password == null ? null : password.trim(); 76 | } 77 | 78 | public Integer getAge() { 79 | return age; 80 | } 81 | 82 | public void setAge(Integer age) { 83 | this.age = age; 84 | } 85 | 86 | public String getSex() { 87 | return sex; 88 | } 89 | 90 | public void setSex(String sex) { 91 | this.sex = sex == null ? null : sex.trim(); 92 | } 93 | 94 | public String getRemark() { 95 | return remark; 96 | } 97 | 98 | public void setRemark(String remark) { 99 | this.remark = remark == null ? null : remark.trim(); 100 | } 101 | 102 | public Date getRegisterTime() { 103 | return registerTime; 104 | } 105 | 106 | public void setRegisterTime(Date registerTime) { 107 | this.registerTime = registerTime; 108 | } 109 | 110 | public Date getLastLoginTime() { 111 | return lastLoginTime; 112 | } 113 | 114 | public void setLastLoginTime(Date lastLoginTime) { 115 | this.lastLoginTime = lastLoginTime; 116 | } 117 | 118 | public String getActivationCode() { 119 | return activationCode; 120 | } 121 | 122 | public void setActivationCode(String activationCode) { 123 | this.activationCode = activationCode == null ? null : activationCode.trim(); 124 | } 125 | } -------------------------------------------------------------------------------- /src/main/webapp/res/js/income.js: -------------------------------------------------------------------------------- 1 | // 设置flag,防止充分点击,多次提交 2 | var flag = true; 3 | 4 | /** 5 | * 增加收入 6 | */ 7 | function addMoney(){ 8 | if(flag==true){ 9 | var date = $("#date").val(); 10 | var item = $("#item option:selected").val(); 11 | var money = $("#money").val(); 12 | var moneyType = $("#money-type option:selected").val(); 13 | var remark = $("#remarkForIncome").val(); 14 | remark = $.trim(replaceEnter2Space(remark)); 15 | if(!validateNotEmpty(money, "请输入金额")){ 16 | return false; 17 | } 18 | if(!validateNumOnly(money, "金额只能是数字")){ 19 | return false; 20 | } 21 | if(!validateLength(remark, 0, 199, "备注不能超过199个字符")){ 22 | return false; 23 | } 24 | flag = false; 25 | $.post("addIncome",{ 26 | "date":date, 27 | "item":item, 28 | "money":money, 29 | "moneyType":moneyType, 30 | "remark":remark 31 | }); 32 | setTimeout('location.reload()', 1000); 33 | } 34 | } 35 | 36 | /** 37 | * 修改收入 38 | * @param incomeId 39 | * @param date 40 | * @param money 41 | * @param itemId 42 | * @param remark 43 | * @param money_type 44 | */ 45 | function changeIncome(incomeId,date,money,itemId,remark,money_type){ 46 | layer.confirm( 47 | $("#addContent").html(),{ 48 | btn: ['修改','返回'], //按钮 49 | success: function(layero, index){ 50 | var content = $(".layui-layer-content"); 51 | content.find("#changedDate").val(date); 52 | content.find("#changedMoney").val(money); 53 | content.find("#changedItem").val(itemId); 54 | content.find("#changed-money-type").val(money_type); 55 | content.find("#changedRemark").val(remark); 56 | } 57 | }, function(){ 58 | var content = $(".layui-layer-content"); 59 | var date = content.find("#changedDate").val(); 60 | var money = content.find("#changedMoney").val(); 61 | var changed_money_type = content.find("#changed-money-type").val(); 62 | var itemId = content.find("#changedItem option:selected").val(); 63 | var remark = content.find("#changedRemark").val(); 64 | remark = $.trim(replaceEnter2Space(remark)); 65 | if(!validateNotEmpty(money, "请输入金额")){ 66 | return false; 67 | } 68 | if(!validateNumOnly(money, "金额只能是数字")){ 69 | return false; 70 | } 71 | if(!validateLength(remark, 0, 199, "备注不能超过199个字符")){ 72 | return false; 73 | } 74 | $.post("../incomeController/changeIncome",{ 75 | "incomeId":incomeId, 76 | "money":money, 77 | "moneyType":changed_money_type, 78 | "itemId":itemId, 79 | "remark":remark, 80 | "date":date 81 | }); 82 | //不能刷新页面,应该使用ajax停留在当前的第n页 83 | setTimeout('location.reload()', 1000); 84 | }); 85 | } 86 | 87 | /** 88 | * 删除收入 89 | * @param incomeId 90 | * @param itemId 91 | */ 92 | function delIncome(incomeId){ 93 | layer.confirm('确认删除?', { 94 | btn: ['删除','返回'] //按钮 95 | }, function(){ 96 | $.post("../incomeController/deleIncome",{ 97 | "incomeId":incomeId, 98 | }); 99 | setTimeout('location.reload()', 1000); 100 | }, function(){ 101 | }); 102 | } 103 | 104 | -------------------------------------------------------------------------------- /src/main/webapp/res/js/expenditure.js: -------------------------------------------------------------------------------- 1 | // 设置flag,防止充分点击,多次提交 2 | var flag = true; 3 | 4 | /** 5 | * 添加支出 6 | */ 7 | function addMoney(){ 8 | if(flag == true){ 9 | var date = $("#date").val(); 10 | var item = $("#item option:selected").val(); 11 | var money = $("#money").val(); 12 | var moneyType = $("#money-type option:selected").val(); 13 | var remark = $("#remarkForExpenditure").val(); 14 | remark = $.trim(replaceEnter2Space(remark)); 15 | if(!validateNotEmpty(money, "请输入金额")){ 16 | return false; 17 | } 18 | if(!validateNumOnly(money, "金额只能是数字")){ 19 | return false; 20 | } 21 | if(!validateLength(remark, 0, 199, "备注不能超过199个字符")){ 22 | return false; 23 | } 24 | flag = false; 25 | $.post("addExpenditure",{ 26 | "date":date, 27 | "item":item, 28 | "money":money, 29 | "moneyType":moneyType, 30 | "remark":remark 31 | }); 32 | setTimeout('location.reload()', 1000); 33 | } 34 | } 35 | 36 | /** 37 | * 修改支出 38 | * @param expenditureId 39 | * @param date 40 | * @param money 41 | * @param itemId 42 | * @param remark 43 | */ 44 | function changeExpenditure(expenditureId,date,money,itemId,remark,money_type){ 45 | layer.confirm( 46 | $("#addContent").html(),{ 47 | btn: ['修改','返回'], 48 | success: function(layero, index){ 49 | var content = $(".layui-layer-content"); 50 | content.find("#changedDate").val(date); 51 | content.find("#changedMoney").val(money); 52 | content.find("#changedItem").val(itemId); 53 | content.find("#changed-money-type").val(money_type); 54 | content.find("#changedRemark").val(remark); 55 | }//按钮 56 | }, function(){ 57 | var content = $(".layui-layer-content"); 58 | var date = content.find("#changedDate").val(); 59 | var money = content.find("#changedMoney").val(); 60 | var changed_money_type = content.find("#changed-money-type").val(); 61 | var itemId = content.find("#changedItem option:selected").val(); 62 | var remark = content.find("#changedRemark").val(); 63 | remark = $.trim(replaceEnter2Space(remark)); 64 | if(!validateNotEmpty(money, "请输入金额")){ 65 | return false; 66 | } 67 | if(!validateNumOnly(money, "金额只能是数字")){ 68 | return false; 69 | } 70 | if(!validateLength(remark, 0, 199, "备注不能超过199个字符")){ 71 | return false; 72 | } 73 | $.post("../expenditureController/changeExpenditure",{ 74 | "expenditureId":expenditureId, 75 | "money":money, 76 | "moneyType":changed_money_type, 77 | "itemId":itemId, 78 | "remark":remark, 79 | "date":date 80 | }); 81 | setTimeout('location.reload()', 1000); 82 | }); 83 | } 84 | 85 | /** 86 | * 删除支出 87 | * @param expenditureId 88 | * @param itemId 89 | */ 90 | function delExpenditure(expenditureId){ 91 | layer.confirm('确认删除?', { 92 | btn: ['删除','返回'] //按钮 93 | }, function(){ 94 | $.post("../expenditureController/deleExpenditure",{ 95 | "expenditureId":expenditureId, 96 | }); 97 | setTimeout('location.reload()', 1000); 98 | }, function(){ 99 | }); 100 | } 101 | -------------------------------------------------------------------------------- /src/main/webapp/res/js/user.register.js: -------------------------------------------------------------------------------- 1 | // 点击验证码图片换验证码 2 | function refreshCheckCodeButton(){ 3 | $(refreshCheckCode).find("img").attr("src", "checkCode.action?" + new Date()); 4 | } 5 | 6 | // 注册 7 | function register() { 8 | if(!validator()){ 9 | return; 10 | } 11 | 12 | var userName = $("#userName").val(); 13 | var email = $("#email").val(); 14 | var password = $("#password").val(); 15 | var repassword = $("#repassword").val(); 16 | var checkCode = $("#checkCode").val(); 17 | 18 | // loading 19 | var index = layer.load(1, { 20 | shade: [0.8,'#fff'] //0.1透明度的白色背景 21 | }); 22 | 23 | $.ajax({ 24 | type: "POST", 25 | url: "register.action", 26 | data: { 27 | "userName":userName, 28 | "email":email, 29 | "password":password, 30 | "checkCode":checkCode 31 | }, 32 | success: function(msg){ 33 | if(msg.info=="下一步"){ 34 | window.location.href="../userController/showUserActive.action"; 35 | } 36 | if(msg.info=="注册成功,请登录"){ 37 | layer.msg(msg.info); 38 | setTimeout(function(){ 39 | window.location.href="../userController/showUserLogin.action"; 40 | },2000); 41 | } 42 | if(msg.info=="邮箱已经注册,请登录"){ 43 | alert(msg.info); 44 | window.location.href="../userController/showUserLogin.action"; 45 | } 46 | if(msg.info=="用户名被占用,请修改用户名"){ 47 | alert(msg.info); 48 | window.location.reload(); 49 | } 50 | }, 51 | error: function () { 52 | alert("注册失败"); 53 | } 54 | }); 55 | } 56 | 57 | // 按 enter 键提交 58 | $(document).keyup(function(event) { 59 | var code = event.keyCode; 60 | if (code == 13) { 61 | register(); 62 | } 63 | }) 64 | 65 | // 激活用户 66 | function active(){ 67 | 68 | $.ajax({ 69 | type : 'POST', 70 | url : 'active.action', 71 | contentType: "application/json; charset=utf-8", 72 | data : $("#User").serializeArray(), 73 | contentType: "application/x-www-form-urlencoded", 74 | success: function(msg){ 75 | if(msg.info=="激活成功"){ 76 | alert("激活成功,请登录"); 77 | window.location.href="../userController/showUserLogin.action"; 78 | }else if(msg.info=="激活码失效,请重新注册"){ 79 | alert("激活码失效,请重新注册"); 80 | window.location.href="../userController/showUserRegister.action"; 81 | }else if(msg.info=="激活码为空"){ 82 | alert("激活码为空,请输入激活码"); 83 | }else{ 84 | alert("激活失败") 85 | } 86 | }, 87 | error: function () { 88 | alert("注册失败"); 89 | } 90 | }); 91 | } 92 | 93 | function validator() { 94 | var userName = document.getElementById("userName").value; 95 | if(!validateAccount(userName)){ 96 | return false; 97 | } 98 | 99 | var email = document.getElementById("email").value; 100 | if(!validateEmail(email)){ 101 | return false; 102 | } 103 | 104 | var password = document.getElementById("password").value; 105 | if(!validatePassword(password)){ 106 | return false; 107 | } 108 | var repassword = document.getElementById("repassword").value; 109 | if(!validatePassword(repassword)){ 110 | return false; 111 | } 112 | if (password != repassword) { 113 | alert("两次输入的密码不一致"); 114 | return false; 115 | } 116 | 117 | return true; 118 | } -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/demo/PatchcaFilterDemo.java: -------------------------------------------------------------------------------- 1 | package checkcode.patchca.demo; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.Button; 5 | import java.awt.Color; 6 | import java.awt.Dimension; 7 | import java.awt.Frame; 8 | import java.awt.Graphics; 9 | import java.awt.Panel; 10 | import java.awt.Toolkit; 11 | import java.awt.event.ActionEvent; 12 | import java.awt.event.ActionListener; 13 | import java.awt.event.WindowAdapter; 14 | import java.awt.event.WindowEvent; 15 | import java.awt.image.BufferedImage; 16 | 17 | import checkcode.patchca.color.SingleColorFactory; 18 | import checkcode.patchca.filter.predefined.CurvesRippleFilterFactory; 19 | import checkcode.patchca.filter.predefined.DiffuseRippleFilterFactory; 20 | import checkcode.patchca.filter.predefined.DoubleRippleFilterFactory; 21 | import checkcode.patchca.filter.predefined.MarbleRippleFilterFactory; 22 | import checkcode.patchca.filter.predefined.WobbleRippleFilterFactory; 23 | import checkcode.patchca.service.ConfigurableCaptchaService; 24 | 25 | public class PatchcaFilterDemo extends Frame implements ActionListener { 26 | 27 | private static final long serialVersionUID = 6698906953413370733L; 28 | private BufferedImage img; 29 | private Button reloadButton; 30 | private int counter; 31 | 32 | public PatchcaFilterDemo() { 33 | super("Patchca demo"); 34 | setSize(150, 100); 35 | Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); 36 | int x = (dim.width-this.getSize().width)/2; 37 | int y = (dim.height-this.getSize().height)/2; 38 | setLocation(x, y); 39 | Panel bottom = new Panel(); 40 | reloadButton = new Button("Next filter"); 41 | reloadButton.addActionListener(this); 42 | bottom.add(reloadButton); 43 | add(BorderLayout.SOUTH, bottom); 44 | addWindowListener(new WindowAdapter() { 45 | public void windowClosing(WindowEvent we) { 46 | dispose(); 47 | } 48 | }); 49 | } 50 | 51 | public void update(Graphics g) { 52 | paint(g); 53 | } 54 | 55 | public void paint(Graphics g) { 56 | if (img == null) { 57 | createImage(); 58 | } 59 | if (img != null) { 60 | g.drawImage(img, 20, 30, this); 61 | } 62 | } 63 | 64 | public void createImage() { 65 | ConfigurableCaptchaService cs = new ConfigurableCaptchaService(); 66 | cs.setColorFactory(new SingleColorFactory(new Color(25, 60, 170))); 67 | switch (counter % 5) { 68 | case 0: 69 | cs.setFilterFactory(new CurvesRippleFilterFactory(cs.getColorFactory())); 70 | break; 71 | case 1: 72 | cs.setFilterFactory(new MarbleRippleFilterFactory()); 73 | break; 74 | case 2: 75 | cs.setFilterFactory(new DoubleRippleFilterFactory()); 76 | break; 77 | case 3: 78 | cs.setFilterFactory(new WobbleRippleFilterFactory()); 79 | break; 80 | case 4: 81 | cs.setFilterFactory(new DiffuseRippleFilterFactory()); 82 | break; 83 | } 84 | img = cs.getCaptcha().getImage(); 85 | counter++; 86 | } 87 | 88 | @Override 89 | public void actionPerformed(ActionEvent evt) { 90 | if (evt.getSource() == reloadButton) { 91 | createImage(); 92 | repaint(); 93 | } 94 | 95 | } 96 | 97 | public static void main(String[] args) { 98 | PatchcaFilterDemo f = new PatchcaFilterDemo(); 99 | f.setVisible(true); 100 | } 101 | 102 | } 103 | -------------------------------------------------------------------------------- /src/main/webapp/res/js/managePayMethods.js: -------------------------------------------------------------------------------- 1 | function changePayMethod(payMethodId, payMethodName, isCountInThisMonthEx, remark, inOrEx){ 2 | layer.confirm( 3 | $("#addPayMethodLayer").html(),{ 4 | btn: ['修改','返回'], //按钮 5 | area: ['420px', '350px'], //宽高 6 | success: function(layero, index){ 7 | var content = $(".layui-layer-content"); 8 | content.find("#addedPayMethodName").val(payMethodName); 9 | content.find("#addedPayMethodRemark").val(remark); 10 | if(inOrEx == "in"){ //收入 11 | var div1 = content.find("#isCountInThisMonthExDiv"); //这样得到的div1是一个集合 12 | div1[0].style.display = "none"; 13 | }else{ //支出 14 | content.find("#added_isCountInThisMonthEx").val(isCountInThisMonthEx); 15 | } 16 | } 17 | }, function(){ 18 | var content = $(".layui-layer-content"); 19 | var payMethodName = content.find("#addedPayMethodName").val(); 20 | var isCountInThisMonthEx = content.find("#added_isCountInThisMonthEx").val(); 21 | if(isCountInThisMonthEx == "" || isCountInThisMonthEx == " "|| isCountInThisMonthEx == null){ 22 | var isCountInThisMonthEx = -1; 23 | } 24 | var remark = content.find("#addedPayMethodRemark").val(); 25 | if(!validateNotEmpty(payMethodName, "收支方式名称不能为空")){ 26 | return false; 27 | } 28 | if(!validateLength(payMethodName, 0, 199, "收支方式名称不能超过199个字符")){ 29 | return false; 30 | } 31 | if(!validateLength(remark, 0, 199, "备注不能超过199个字符")){ 32 | return false; 33 | } 34 | $.post("../payMethodController/changePayMethod",{ 35 | "payMethodId":payMethodId, 36 | "payMethodName":payMethodName, 37 | "isCountInThisMonthEx":isCountInThisMonthEx, 38 | "remark":remark 39 | }); 40 | setTimeout('location.reload()', 1000); 41 | }); 42 | } 43 | 44 | function delPayMethod(payMethodId){ 45 | layer.confirm('确认删除?', { 46 | btn: ['删除','返回'] //按钮 47 | }, function(){ 48 | $.post("../payMethodController/delePayMethod",{ 49 | "payMethodId":payMethodId, 50 | }); 51 | setTimeout('location.reload()', 1000); 52 | }, function(){ 53 | }); 54 | } 55 | 56 | function addPayMethod(inOrEx){ 57 | layer.confirm( 58 | $("#addPayMethodLayer").html(),{ 59 | btn: ['添加','返回'], //按钮 60 | area: ['420px', '350px'], //宽高 61 | success: function(layero, index){ 62 | var content = $(".layui-layer-content"); 63 | if(inOrEx == "in"){ //收入 64 | var div1 = content.find("#isCountInThisMonthExDiv"); 65 | div1[0].style.display = "none"; 66 | } 67 | } 68 | }, function(){ 69 | var content = $(".layui-layer-content"); 70 | var payMethodName = content.find("#addedPayMethodName").val(); 71 | var isCountInThisMonthEx = content.find("#added_isCountInThisMonthEx option:selected").val(); 72 | if(inOrEx == "in"){ 73 | var isCountInThisMonthEx = -1; 74 | } 75 | var remark = content.find("#addedPayMethodRemark").val(); 76 | 77 | if(!validateNotEmpty(payMethodName, "收支方式名称不能为空")){ 78 | return false; 79 | } 80 | if(!validateLength(payMethodName, 0, 199, "收支方式名称不能超过199个字符")){ 81 | return false; 82 | } 83 | if(!validateLength(remark, 0, 199, "备注不能超过199个字符")){ 84 | return false; 85 | } 86 | 87 | $.post("../payMethodController/addPayMethod",{ 88 | "payMethodName":payMethodName, 89 | "isCountInThisMonthEx":isCountInThisMonthEx, 90 | "remark":remark, 91 | "inOrEx":inOrEx 92 | }); 93 | setTimeout('location.reload()', 1000); 94 | }); 95 | } 96 | 97 | -------------------------------------------------------------------------------- /src/main/resources/mybatis-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/service/impl/MonthlyStatisticsServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.service.impl; 2 | 3 | import java.time.Instant; 4 | import java.time.LocalDate; 5 | import java.time.ZoneId; 6 | import java.util.Date; 7 | 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Service; 10 | 11 | import com.taoxiuxia.mapper.BalanceMapper; 12 | import com.taoxiuxia.model.Balance; 13 | import com.taoxiuxia.service.IMonthlyStatisticsService; 14 | 15 | @Service("monthlyStatisticsService") 16 | public class MonthlyStatisticsServiceImpl implements IMonthlyStatisticsService { 17 | 18 | private BalanceMapper balanceMapper; 19 | 20 | public BalanceMapper getBalanceMapper() { 21 | return balanceMapper; 22 | } 23 | 24 | @Autowired 25 | public void setBalanceMapper(BalanceMapper balanceMapper) { 26 | this.balanceMapper = balanceMapper; 27 | } 28 | 29 | @Override 30 | public float monthlyIncome(int userId) { 31 | return balanceMapper.selectMonthlyIncome(userId); 32 | } 33 | 34 | @Override 35 | public float monthlyExpenditure(int userId) { 36 | return balanceMapper.selectMonthlyExpenditure(userId); 37 | } 38 | 39 | @Override 40 | public float notActualExpenditure(int userId) { 41 | return balanceMapper.selectNotActualExpenditure(userId); 42 | } 43 | 44 | /** 45 | * 本月初的实际结余balance,也就是上月末的实际balance 46 | */ 47 | @Override 48 | public Balance balanceInBeginOfMonth(int userId) { 49 | //如果查出来的是null,说明上月没有balance数据 50 | //就插入一条actual_balance为0的数据 51 | if(balanceMapper.selectBalanceInBeginOfMonth(userId) == null){ 52 | Balance balance = new Balance(); 53 | balance.setUserId(userId); 54 | balance.setMonth(getLastMonth()); 55 | balance.setActualBalance(0f); 56 | balanceMapper.insertBalance(balance); // 在成功插入balance到数据库后,id已经自动注入到balance中 57 | return balance; 58 | } 59 | return balanceMapper.selectBalanceInBeginOfMonth(userId); 60 | } 61 | 62 | /** 63 | * 本月末的balance 64 | */ 65 | @Override 66 | public Balance balanceOfThisMonth(int userId) { 67 | return balanceMapper.selectBalanceOfThisMonth(userId); 68 | } 69 | 70 | /** 71 | * 添加balance 72 | */ 73 | @Override 74 | public void addBalance(float balanceMoney, int userId) { 75 | Balance balance = new Balance(); 76 | balance.setUserId(userId); 77 | balance.setActualBalance(balanceMoney); 78 | // balance.setMonth(LocalDate.now()); 79 | balance.setMonth(new Date()); 80 | balanceMapper.insertBalance(balance); 81 | } 82 | 83 | // 修改balance 84 | @Override 85 | public void changeBalance(int balanceId, float changed_balance) { 86 | Balance balance = new Balance(); 87 | balance.setId(balanceId); 88 | balance.setActualBalance(changed_balance); 89 | balanceMapper.updateByPrimaryKeySelective(balance); 90 | } 91 | 92 | /** 93 | * 获取上个月的时间,只处理年和月,不关心日 94 | * JDK1.8已弃用相关Date的方法,所以使用LocalDate来处理 95 | * 96 | * 以后把项目中的全部Date替换成LocalDate 97 | * 98 | * @return 99 | */ 100 | public Date getLastMonth(){ 101 | LocalDate localDate = LocalDate.now(); 102 | localDate = localDate.minusMonths(1); 103 | // LocalDate 转 Date 104 | ZoneId zone = ZoneId.systemDefault(); 105 | Instant instant = localDate.atStartOfDay().atZone(zone).toInstant(); 106 | Date date = Date.from(instant); 107 | 108 | return date; 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /src/main/java/com/taoxiuxia/controller/ItemController.java: -------------------------------------------------------------------------------- 1 | package com.taoxiuxia.controller; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import javax.servlet.http.HttpSession; 8 | 9 | import org.slf4j.Logger; 10 | import org.slf4j.LoggerFactory; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Controller; 13 | import org.springframework.ui.Model; 14 | import org.springframework.web.bind.annotation.RequestMapping; 15 | import org.springframework.web.bind.annotation.ResponseBody; 16 | 17 | import com.taoxiuxia.model.Item; 18 | import com.taoxiuxia.model.SessionUser; 19 | import com.taoxiuxia.service.IItemService; 20 | import com.taoxiuxia.util.Constants; 21 | 22 | @Controller 23 | @RequestMapping("/itemController") 24 | public class ItemController { 25 | private Logger logger=LoggerFactory.getLogger(ItemController.class); 26 | 27 | private IItemService itemService; 28 | 29 | public IItemService getItemService() { 30 | return itemService; 31 | } 32 | 33 | @Autowired 34 | public void setItemService(IItemService itemService) { 35 | this.itemService = itemService; 36 | } 37 | 38 | /** 39 | * 项目管理页面 40 | * 41 | * @param model 42 | * @return 43 | */ 44 | @RequestMapping("/showManageItems") 45 | public String showManageItems(Model model,HttpSession session) { 46 | SessionUser sessionUser = (SessionUser) session.getAttribute(Constants.SESSION_USER_KEY); 47 | int userId = sessionUser.getUserId(); 48 | List expenditureItems = itemService.loadExpenditureItems(userId); 49 | List incomeItems = itemService.loadIncomeItems(userId); 50 | model.addAttribute("expenditureItems", expenditureItems); 51 | model.addAttribute("incomeItems", incomeItems); 52 | model.addAttribute("sessionUser", sessionUser); 53 | 54 | return "pages/manageItems"; 55 | } 56 | 57 | /** 58 | * 增加item 59 | * @param itemName 60 | * @param remark 61 | */ 62 | @RequestMapping("/addItem") 63 | public void addItem(HttpSession session,String itemName, String remark, String inOrEx) { 64 | SessionUser sessionUser = (SessionUser) session.getAttribute(Constants.SESSION_USER_KEY); 65 | int userId = sessionUser.getUserId(); 66 | itemService.addItem(userId, itemName, remark, inOrEx); 67 | } 68 | 69 | /** 70 | * 修改item 71 | * 72 | * @param itemId 73 | * @param itemName 74 | * @param remark 75 | * @param inOrEx 76 | */ 77 | @RequestMapping("/changeItem") 78 | public void changeItem(int itemId, String itemName, String remark, String inOrEx) { 79 | itemService.changeItem(itemId, itemName, remark); 80 | } 81 | 82 | /** 83 | * 删除item 84 | * @param itemId 85 | */ 86 | @RequestMapping("/deleItem") 87 | public void deleItem(int itemId) { 88 | itemService.deleItem(itemId); 89 | } 90 | 91 | /** 92 | * item的上移和下移 93 | * @param session 94 | * @param itemId 95 | * @param inOrEx 96 | * @param upAndDown 97 | * @return 98 | */ 99 | @RequestMapping(value = "/upAndDownItem", produces = "application/json;charset=UTF-8") 100 | public @ResponseBody Map upAndDownItem(HttpSession session, int itemId, String inOrEx, String upAndDown) { 101 | Map map = new HashMap(); 102 | SessionUser sessionUser = (SessionUser) session.getAttribute(Constants.SESSION_USER_KEY); 103 | int userId = sessionUser.getUserId(); 104 | String msg = itemService.upAndDownItem(userId, itemId, inOrEx, upAndDown); 105 | map.put("info", msg); 106 | return map; 107 | } 108 | 109 | } 110 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/service/AbstractCaptchaService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.service; 20 | 21 | import java.awt.image.BufferedImage; 22 | 23 | import checkcode.patchca.background.BackgroundFactory; 24 | import checkcode.patchca.color.ColorFactory; 25 | import checkcode.patchca.filter.FilterFactory; 26 | import checkcode.patchca.font.FontFactory; 27 | import checkcode.patchca.text.renderer.TextRenderer; 28 | import checkcode.patchca.word.WordFactory; 29 | 30 | public abstract class AbstractCaptchaService implements CaptchaService { 31 | 32 | protected FontFactory fontFactory; 33 | protected WordFactory wordFactory; 34 | protected ColorFactory colorFactory; 35 | protected BackgroundFactory backgroundFactory; 36 | protected TextRenderer textRenderer; 37 | protected FilterFactory filterFactory; 38 | protected int width; 39 | protected int height; 40 | 41 | public void setFontFactory(FontFactory fontFactory) { 42 | this.fontFactory = fontFactory; 43 | } 44 | 45 | public void setWordFactory(WordFactory wordFactory) { 46 | this.wordFactory = wordFactory; 47 | } 48 | 49 | public void setColorFactory(ColorFactory colorFactory) { 50 | this.colorFactory = colorFactory; 51 | } 52 | 53 | public void setBackgroundFactory(BackgroundFactory backgroundFactory) { 54 | this.backgroundFactory = backgroundFactory; 55 | } 56 | 57 | public void setTextRenderer(TextRenderer textRenderer) { 58 | this.textRenderer = textRenderer; 59 | } 60 | 61 | public void setFilterFactory(FilterFactory filterFactory) { 62 | this.filterFactory = filterFactory; 63 | } 64 | 65 | public FontFactory getFontFactory() { 66 | return fontFactory; 67 | } 68 | 69 | public WordFactory getWordFactory() { 70 | return wordFactory; 71 | } 72 | 73 | public ColorFactory getColorFactory() { 74 | return colorFactory; 75 | } 76 | 77 | public BackgroundFactory getBackgroundFactory() { 78 | return backgroundFactory; 79 | } 80 | 81 | public TextRenderer getTextRenderer() { 82 | return textRenderer; 83 | } 84 | 85 | public FilterFactory getFilterFactory() { 86 | return filterFactory; 87 | } 88 | 89 | public int getWidth() { 90 | return width; 91 | } 92 | 93 | public int getHeight() { 94 | return height; 95 | } 96 | 97 | public void setWidth(int width) { 98 | this.width = width; 99 | } 100 | 101 | public void setHeight(int height) { 102 | this.height = height; 103 | } 104 | 105 | @Override 106 | public Captcha getCaptcha() { 107 | BufferedImage bufImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); 108 | backgroundFactory.fillBackground(bufImage); 109 | String word = wordFactory.getNextWord(); 110 | textRenderer.draw(word, bufImage, fontFactory, colorFactory); 111 | bufImage = filterFactory.applyFilters(bufImage); 112 | return new Captcha(word, bufImage); 113 | } 114 | 115 | } 116 | -------------------------------------------------------------------------------- /src/main/java/checkcode/patchca/text/renderer/AbstractTextRenderer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Piotr Piastucki 3 | * 4 | * This file is part of Patchca CAPTCHA library. 5 | * 6 | * Patchca is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Patchca is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with Patchca. If not, see . 18 | */ 19 | package checkcode.patchca.text.renderer; 20 | 21 | import java.awt.*; 22 | import java.awt.font.FontRenderContext; 23 | import java.awt.geom.Rectangle2D; 24 | import java.awt.image.BufferedImage; 25 | 26 | import checkcode.patchca.color.ColorFactory; 27 | import checkcode.patchca.font.FontFactory; 28 | 29 | public abstract class AbstractTextRenderer implements TextRenderer { 30 | 31 | protected int leftMargin; 32 | protected int rightMargin; 33 | protected int topMargin; 34 | protected int bottomMargin; 35 | 36 | protected abstract void arrangeCharacters(int width, int height, TextString ts); 37 | 38 | public AbstractTextRenderer() { 39 | leftMargin = rightMargin = 5; 40 | topMargin = bottomMargin = 5; 41 | } 42 | 43 | @Override 44 | public void setLeftMargin(int leftMargin) { 45 | this.leftMargin = leftMargin; 46 | } 47 | 48 | @Override 49 | public void setRightMargin(int rightMargin) { 50 | this.rightMargin = rightMargin; 51 | } 52 | 53 | @Override 54 | public void setTopMargin(int topMargin) { 55 | this.topMargin = topMargin; 56 | } 57 | 58 | @Override 59 | public void setBottomMargin(int bottomMargin) { 60 | this.bottomMargin = bottomMargin; 61 | } 62 | 63 | @Override 64 | public void draw(String text, BufferedImage canvas, FontFactory fontFactory, ColorFactory colorFactory) { 65 | Graphics2D g = (Graphics2D) canvas.getGraphics(); 66 | TextString ts = convertToCharacters(text, g, fontFactory, colorFactory); 67 | arrangeCharacters(canvas.getWidth(), canvas.getHeight(), ts); 68 | g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 69 | g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); 70 | g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); 71 | for (TextCharacter tc : ts.getCharacters()) { 72 | g.setColor(tc.getColor()); 73 | g.drawString(tc.iterator(), (float) tc.getX(), (float) tc.getY()); 74 | } 75 | } 76 | 77 | protected TextString convertToCharacters(String text, Graphics2D g, FontFactory fontFactory, ColorFactory colorFactory) { 78 | TextString characters = new TextString(); 79 | FontRenderContext frc = g.getFontRenderContext(); 80 | double lastx = 0; 81 | for (int i = 0; i < text.length(); i++) { 82 | Font font = fontFactory.getFont(i); 83 | char c = text.charAt(i); 84 | FontMetrics fm = g.getFontMetrics(font); 85 | Rectangle2D bounds = font.getStringBounds(String.valueOf(c), frc); 86 | TextCharacter tc = new TextCharacter(); 87 | tc.setCharacter(c); 88 | tc.setFont(font); 89 | tc.setWidth(fm.charWidth(c)); 90 | tc.setHeight(fm.getAscent() + fm.getDescent()); 91 | tc.setAscent(fm.getAscent()); 92 | tc.setDescent(fm.getDescent()); 93 | tc.setX(lastx); 94 | tc.setY(0); 95 | tc.setFont(font); 96 | tc.setColor(colorFactory.getColor(i)); 97 | lastx += bounds.getWidth(); 98 | characters.addCharacter(tc); 99 | } 100 | return characters; 101 | } 102 | 103 | } 104 | --------------------------------------------------------------------------------