From 5e2ef15bac8d43c1b6fc7eca372ef92a06205484 Mon Sep 17 00:00:00 2001 From: SolaKun Date: Thu, 19 May 2016 20:01:45 +0800 Subject: [PATCH 01/17] add ToolsCheck pojo --- .../love/sola/netsupport/pojo/ToolsCheck.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/main/java/love/sola/netsupport/pojo/ToolsCheck.java diff --git a/src/main/java/love/sola/netsupport/pojo/ToolsCheck.java b/src/main/java/love/sola/netsupport/pojo/ToolsCheck.java new file mode 100644 index 0000000..3e57151 --- /dev/null +++ b/src/main/java/love/sola/netsupport/pojo/ToolsCheck.java @@ -0,0 +1,34 @@ +package love.sola.netsupport.pojo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.hibernate.annotations.DynamicInsert; + +import javax.persistence.*; +import java.util.Date; + +/** + * @author Sola {@literal } + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Entity +@Table(name = "toolschk") +@DynamicInsert +public class ToolsCheck { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + @ManyToOne(optional = false) + @JoinColumn(name = "opsid") + private User operator; + private Integer block; + @Column(name = "chktime") + private Date checkTime = new Date(); + @OrderColumn + private Integer status = 0; + +} From abb6b34aeb450a92b407283409d7a56d6f70ba32 Mon Sep 17 00:00:00 2001 From: Sola Date: Sat, 21 May 2016 18:54:41 +0800 Subject: [PATCH 02/17] update ToolsCheck table index --- src/main/java/love/sola/netsupport/pojo/ToolsCheck.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/love/sola/netsupport/pojo/ToolsCheck.java b/src/main/java/love/sola/netsupport/pojo/ToolsCheck.java index 3e57151..8b55d87 100644 --- a/src/main/java/love/sola/netsupport/pojo/ToolsCheck.java +++ b/src/main/java/love/sola/netsupport/pojo/ToolsCheck.java @@ -15,7 +15,10 @@ import java.util.Date; @AllArgsConstructor @NoArgsConstructor @Entity -@Table(name = "toolschk") +@Table(name = "toolschk", indexes = { + @Index(columnList = "block,chktime,status"), + @Index(columnList = "block,chktime") +}) @DynamicInsert public class ToolsCheck { @@ -28,7 +31,6 @@ public class ToolsCheck { private Integer block; @Column(name = "chktime") private Date checkTime = new Date(); - @OrderColumn private Integer status = 0; } From 402dc2985e3a76a54b7ef6433a4916fde4ebeaa0 Mon Sep 17 00:00:00 2001 From: Sola Date: Sun, 22 May 2016 16:28:15 +0800 Subject: [PATCH 03/17] add toolscheck api --- .../java/love/sola/netsupport/api/API.java | 19 ++++ .../love/sola/netsupport/api/APIRouter.java | 5 + .../sola/netsupport/api/stuff/TicketLog.java | 5 - .../sola/netsupport/api/stuff/ToolsCheck.java | 104 ++++++++++++++++++ .../love/sola/netsupport/pojo/ToolsCheck.java | 12 +- src/main/resources/hibernate.cfg.xml | 1 + 6 files changed, 137 insertions(+), 9 deletions(-) create mode 100644 src/main/java/love/sola/netsupport/api/stuff/ToolsCheck.java diff --git a/src/main/java/love/sola/netsupport/api/API.java b/src/main/java/love/sola/netsupport/api/API.java index b8d524c..91acea3 100644 --- a/src/main/java/love/sola/netsupport/api/API.java +++ b/src/main/java/love/sola/netsupport/api/API.java @@ -20,8 +20,11 @@ package love.sola.netsupport.api; import love.sola.netsupport.enums.Access; import love.sola.netsupport.session.WxSession; import love.sola.netsupport.wechat.Command; +import org.apache.commons.lang3.time.DateUtils; import javax.servlet.http.HttpServletRequest; +import java.util.Calendar; +import java.util.Date; /** * @author Sola {@literal } @@ -43,4 +46,20 @@ public abstract class API { '}'; } + public static String getParameterWithDefault(String obj, String def) { + return obj == null ? def : obj; + } + + public static Date getParameterAsDate(String obj, Date def) { + return obj == null ? def : new Date(Long.valueOf(obj)); + } + + public static Date getToday() { + return DateUtils.truncate(new Date(), Calendar.DAY_OF_MONTH); + } + + public static Date getDay(Date date) { + return DateUtils.truncate(date, Calendar.DAY_OF_MONTH); + } + } diff --git a/src/main/java/love/sola/netsupport/api/APIRouter.java b/src/main/java/love/sola/netsupport/api/APIRouter.java index e9eb696..a74b4e7 100644 --- a/src/main/java/love/sola/netsupport/api/APIRouter.java +++ b/src/main/java/love/sola/netsupport/api/APIRouter.java @@ -131,6 +131,11 @@ public class APIRouter extends HttpServlet { } } + @Override + protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + doGet(req, resp); + } + private static WxSession getSession(HttpServletRequest req) { String t = req.getParameter("token"); if (t == null || t.isEmpty()) return null; diff --git a/src/main/java/love/sola/netsupport/api/stuff/TicketLog.java b/src/main/java/love/sola/netsupport/api/stuff/TicketLog.java index 07dbd24..fe8b3db 100644 --- a/src/main/java/love/sola/netsupport/api/stuff/TicketLog.java +++ b/src/main/java/love/sola/netsupport/api/stuff/TicketLog.java @@ -31,7 +31,6 @@ import org.hibernate.envers.query.AuditEntity; import javax.servlet.http.HttpServletRequest; import java.text.SimpleDateFormat; -import java.util.Calendar; import java.util.Date; /** @@ -70,8 +69,4 @@ public class TicketLog extends API { } } - private static Date getToday() { - return DateUtils.truncate(new Date(), Calendar.DAY_OF_MONTH); - } - } diff --git a/src/main/java/love/sola/netsupport/api/stuff/ToolsCheck.java b/src/main/java/love/sola/netsupport/api/stuff/ToolsCheck.java new file mode 100644 index 0000000..bc28376 --- /dev/null +++ b/src/main/java/love/sola/netsupport/api/stuff/ToolsCheck.java @@ -0,0 +1,104 @@ +/* + * This file is part of WechatTicketSystem. + * + * WechatTicketSystem is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * WechatTicketSystem is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with WechatTicketSystem. If not, see . + */ + +package love.sola.netsupport.api.stuff; + +import love.sola.netsupport.api.API; +import love.sola.netsupport.api.Error; +import love.sola.netsupport.enums.Access; +import love.sola.netsupport.enums.Attribute; +import love.sola.netsupport.pojo.Operator; +import love.sola.netsupport.session.WxSession; +import love.sola.netsupport.sql.SQLCore; +import love.sola.netsupport.wechat.Command; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.time.DateUtils; +import org.hibernate.Criteria; +import org.hibernate.Session; +import org.hibernate.criterion.Restrictions; +import org.hibernate.type.IntegerType; +import org.hibernate.type.Type; + +import javax.servlet.http.HttpServletRequest; +import java.util.Date; + +/** + * @author Sola + */ +public class ToolsCheck extends API { + + public ToolsCheck() { + url = "/admin/toolscheck"; + access = Access.MEMBER; + authorize = Command.LOGIN; + } + + @Override + protected Object process(HttpServletRequest req, WxSession session) throws Exception { + if (req.getMethod().equals("GET")) { + return query(req, session); + } else if (req.getMethod().equals("POST")) { + return submit(req, session); + } + return null; + } + + private Object submit(HttpServletRequest req, WxSession session) { + Operator op = session.getAttribute(Attribute.OPERATOR); + int status = Integer.valueOf(getParameterWithDefault(req.getParameter("status"), "0")); + String remark = req.getParameter("remark"); + if (status != 0 && StringUtils.isBlank(remark)) { + return Error.PARAMETER_REQUIRED; + } + try (Session s = SQLCore.sf.openSession()) { + s.beginTransaction(); + s.save(new love.sola.netsupport.pojo.ToolsCheck( + null, + op, + op.getBlock(), + new Date(), + status, + remark + ) + ); + s.getTransaction().commit(); + return Error.OK; + } + } + + private Object query(HttpServletRequest req, WxSession session) { + int status = Integer.valueOf(getParameterWithDefault(req.getParameter("status"), "0")); + Date after = getParameterAsDate(req.getParameter("after"), getToday()); + Date before = getParameterAsDate(req.getParameter("before"), getToday()); + before = DateUtils.addDays(before, 1); + int block = Integer.valueOf(getParameterWithDefault(req.getParameter("block"), "0")); + try (Session s = SQLCore.sf.openSession()) { + Criteria query = s.createCriteria(love.sola.netsupport.pojo.ToolsCheck.class); + query.add( + Restrictions.sqlRestriction( + "{alias}.status & ? = ?", + new Object[]{status, status}, + new Type[]{IntegerType.INSTANCE, IntegerType.INSTANCE} + ) + ); + query.add(Restrictions.between("checkTime", after, before)); + if (block != 0) query.add(Restrictions.eq("block", block)); + return query.list(); + } + } + +} diff --git a/src/main/java/love/sola/netsupport/pojo/ToolsCheck.java b/src/main/java/love/sola/netsupport/pojo/ToolsCheck.java index 8b55d87..aa1ffe4 100644 --- a/src/main/java/love/sola/netsupport/pojo/ToolsCheck.java +++ b/src/main/java/love/sola/netsupport/pojo/ToolsCheck.java @@ -3,6 +3,7 @@ package love.sola.netsupport.pojo; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import org.hibernate.annotations.ColumnDefault; import org.hibernate.annotations.DynamicInsert; import javax.persistence.*; @@ -17,7 +18,7 @@ import java.util.Date; @Entity @Table(name = "toolschk", indexes = { @Index(columnList = "block,chktime,status"), - @Index(columnList = "block,chktime") + @Index(columnList = "chktime,status") }) @DynamicInsert public class ToolsCheck { @@ -26,11 +27,14 @@ public class ToolsCheck { @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @ManyToOne(optional = false) - @JoinColumn(name = "opsid") - private User operator; + @JoinColumn(name = "opsid", nullable = false) + private Operator operator; + @Column(nullable = false) private Integer block; - @Column(name = "chktime") + @Column(name = "chktime", nullable = false) private Date checkTime = new Date(); + @ColumnDefault("0") private Integer status = 0; + private String remark; } diff --git a/src/main/resources/hibernate.cfg.xml b/src/main/resources/hibernate.cfg.xml index de389c1..8952ade 100644 --- a/src/main/resources/hibernate.cfg.xml +++ b/src/main/resources/hibernate.cfg.xml @@ -40,6 +40,7 @@ + From 715c285a91f705e311e96eb38be32effd777aec5 Mon Sep 17 00:00:00 2001 From: Sola Date: Sun, 22 May 2016 16:44:00 +0800 Subject: [PATCH 04/17] fix build issue --- src/test/java/love/sola/netsupport/api/ReflectionTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/love/sola/netsupport/api/ReflectionTest.java b/src/test/java/love/sola/netsupport/api/ReflectionTest.java index f8e2f66..91a7d25 100644 --- a/src/test/java/love/sola/netsupport/api/ReflectionTest.java +++ b/src/test/java/love/sola/netsupport/api/ReflectionTest.java @@ -14,7 +14,7 @@ public class ReflectionTest { public void test() { Reflections reflections = new Reflections(getClass().getPackage().getName()); Set> set = reflections.getSubTypesOf(API.class); - assert set.size() == 14; + assert set.size() == 15; } } From 5128ce4b6fa6cafe7903b2933ad66143bf06d7c2 Mon Sep 17 00:00:00 2001 From: Sola Date: Fri, 27 May 2016 16:37:50 +0800 Subject: [PATCH 05/17] fix missing date truncating --- src/main/java/love/sola/netsupport/api/stuff/ToolsCheck.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/love/sola/netsupport/api/stuff/ToolsCheck.java b/src/main/java/love/sola/netsupport/api/stuff/ToolsCheck.java index bc28376..b51513b 100644 --- a/src/main/java/love/sola/netsupport/api/stuff/ToolsCheck.java +++ b/src/main/java/love/sola/netsupport/api/stuff/ToolsCheck.java @@ -82,8 +82,8 @@ public class ToolsCheck extends API { private Object query(HttpServletRequest req, WxSession session) { int status = Integer.valueOf(getParameterWithDefault(req.getParameter("status"), "0")); - Date after = getParameterAsDate(req.getParameter("after"), getToday()); - Date before = getParameterAsDate(req.getParameter("before"), getToday()); + Date after = getDay(getParameterAsDate(req.getParameter("after"), getToday())); + Date before = getDay(getParameterAsDate(req.getParameter("before"), getToday())); before = DateUtils.addDays(before, 1); int block = Integer.valueOf(getParameterWithDefault(req.getParameter("block"), "0")); try (Session s = SQLCore.sf.openSession()) { From f6e8152b0f73f1a91067ba0d0ffb909ea681313d Mon Sep 17 00:00:00 2001 From: Sola Date: Mon, 6 Jun 2016 22:18:06 +0800 Subject: [PATCH 06/17] add response for OPTIONS request. --- src/main/java/love/sola/netsupport/api/APIRouter.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/love/sola/netsupport/api/APIRouter.java b/src/main/java/love/sola/netsupport/api/APIRouter.java index a74b4e7..cf1eee5 100644 --- a/src/main/java/love/sola/netsupport/api/APIRouter.java +++ b/src/main/java/love/sola/netsupport/api/APIRouter.java @@ -136,6 +136,13 @@ public class APIRouter extends HttpServlet { doGet(req, resp); } + @Override + protected void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + resp.addHeader("Access-Control-Allow-Method", "POST, GET, OPTIONS"); + resp.addHeader("Access-Control-Allow-Origin", "*"); + resp.setStatus(HttpServletResponse.SC_NO_CONTENT); + } + private static WxSession getSession(HttpServletRequest req) { String t = req.getParameter("token"); if (t == null || t.isEmpty()) return null; From 595dfc8ae091ae3ab85ff9555fae982ee37810d6 Mon Sep 17 00:00:00 2001 From: Sola Date: Tue, 20 Sep 2016 02:52:20 +0800 Subject: [PATCH 07/17] add formatter off --- src/main/java/love/sola/netsupport/enums/Block.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/love/sola/netsupport/enums/Block.java b/src/main/java/love/sola/netsupport/enums/Block.java index 59f7dc3..9bcf37b 100644 --- a/src/main/java/love/sola/netsupport/enums/Block.java +++ b/src/main/java/love/sola/netsupport/enums/Block.java @@ -70,6 +70,7 @@ public class Block { public static final int[][] AVAILABLE = new int[62][0]; static { + // @formatter:off // -------------------------------------------- // // THANKS DATA PROVIDED BY Lai Juncheng // -------------------------------------------- // @@ -98,6 +99,7 @@ public class Block { AVAILABLE[XH_C] = new int[]{126, 226, 326, 426, 526, 626, 726, 826, 926, 1026, 1126, 1226}; AVAILABLE[XH_D] = new int[]{128, 228, 328, 428, 528, 628, 728, 828, 928, 1028, 1128, 1228}; AVAILABLE[FX_6] = new int[0]; + // @formatter:on } public static boolean checkRoom(int block, int room) { From 94340aae2f64a4b10855df3b3aca3d2fa9bce172 Mon Sep 17 00:00:00 2001 From: Sola Date: Tue, 20 Sep 2016 05:13:26 +0800 Subject: [PATCH 08/17] make it legal --- src/main/java/love/sola/netsupport/util/Checker.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/love/sola/netsupport/util/Checker.java b/src/main/java/love/sola/netsupport/util/Checker.java index 139a1f9..0e2b041 100644 --- a/src/main/java/love/sola/netsupport/util/Checker.java +++ b/src/main/java/love/sola/netsupport/util/Checker.java @@ -25,7 +25,7 @@ import love.sola.netsupport.enums.ISP; */ public class Checker { - public static final String STUDENT_ID_REGEX = "^(2010|2012|2013|2014|2015)[0-9]{9}$"; + public static final String STUDENT_ID_REGEX = "^(2010|2012|2013|2014|2015|2016)[0-9]{9}$"; public static final String PHONE_NUMBER_REGEX = "^1[34578][0-9]{9}$"; public static boolean hasNull(Object... v) { From c431340294541e054dba5c7b0ac2cbbd586a31d5 Mon Sep 17 00:00:00 2001 From: Sola Date: Mon, 3 Oct 2016 15:11:05 +0800 Subject: [PATCH 09/17] update to new host --- src/main/resources/lang.yml | 14 +++++++------- src/main/resources/menu.json | 6 +++--- .../love/sola/netsupport/util/URLEncodeTest.java | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/resources/lang.yml b/src/main/resources/lang.yml index cabfc96..031aec3 100644 --- a/src/main/resources/lang.yml +++ b/src/main/resources/lang.yml @@ -63,13 +63,13 @@ Operator_Info: | 若以上信息有误,请及时联系@15-沙子森。 #URL -User_Register_Link: 'http://topaz.sinaapp.com/nm/v2/user/reg.html?token={0}' -User_Query_Link: 'http://topaz.sinaapp.com/nm/v2/user/list.html?token={0}' -User_Submit_Link: 'http://topaz.sinaapp.com/nm/v2/user/rrepair.html?token={0}&name={1}&isp={2}&room={3}&block={4}&phone={5,number,#}' -User_Profile_Link: 'http://topaz.sinaapp.com/nm/v2/user/modi.html?token={0}&name={1}&isp={2}&username={3}&block={4}&room={5}&phone={6,number,#}' -Result_Page: 'http://topaz.sinaapp.com/nm/v2/result.html' -Operator_Home_Page: 'http://topaz.sinaapp.com/nm/v2/man/home.html?token={0}' -Operator_Login_Page: 'http://topaz.sinaapp.com/nm/v2/man/login.html?pkey={0}' +User_Register_Link: 'http://s.wts.sola.love/nm/v2/user/reg.html?token={0}' +User_Query_Link: 'http://s.wts.sola.love/nm/v2/user/list.html?token={0}' +User_Submit_Link: 'http://s.wts.sola.love/nm/v2/user/rrepair.html?token={0}&name={1}&isp={2}&room={3}&block={4}&phone={5,number,#}' +User_Profile_Link: 'http://s.wts.sola.love/nm/v2/user/modi.html?token={0}&name={1}&isp={2}&username={3}&block={4}&room={5}&phone={6,number,#}' +Result_Page: 'http://s.wts.sola.love/nm/v2/result.html' +Operator_Home_Page: 'http://s.wts.sola.love/nm/v2/man/home.html?token={0}' +Operator_Login_Page: 'http://s.wts.sola.love/nm/v2/man/login.html?pkey={0}' #Localized #Status diff --git a/src/main/resources/menu.json b/src/main/resources/menu.json index d6be280..8cd55f1 100644 --- a/src/main/resources/menu.json +++ b/src/main/resources/menu.json @@ -51,17 +51,17 @@ { "type": "view", "name": "关于报修系统", - "url": "http://topaz.sinaapp.com/nm/v2/" + "url": "http://s.wts.sola.love/nm/v2/" }, { "type": "view", "name": "联系我们", - "url": "http://topaz.sinaapp.com/nm/v2/404.html" + "url": "http://s.wts.sola.love/nm/v2/404.html" }, { "type": "view", "name": "关于网维", - "url": "http://topaz.sinaapp.com/nm/v2/404.html" + "url": "http://s.wts.sola.love/nm/v2/404.html" } ] } diff --git a/src/test/java/love/sola/netsupport/util/URLEncodeTest.java b/src/test/java/love/sola/netsupport/util/URLEncodeTest.java index 852b53b..ad345bf 100644 --- a/src/test/java/love/sola/netsupport/util/URLEncodeTest.java +++ b/src/test/java/love/sola/netsupport/util/URLEncodeTest.java @@ -24,7 +24,7 @@ public class URLEncodeTest { .title("Test Title") .msg("Test Message") .toString(), - equalTo("http://topaz.sinaapp.com/nm/v2/result.html?type=1&title=Test%20Title&msg=Test%20Message&") + equalTo("http://s.wts.sola.love/nm/v2/result.html?type=1&title=Test%20Title&msg=Test%20Message&") ); } From 287d44d80ca9b7a465b638321637088cc0104b0b Mon Sep 17 00:00:00 2001 From: Sola Date: Wed, 5 Oct 2016 17:20:04 +0800 Subject: [PATCH 10/17] add new block --- .../love/sola/netsupport/enums/Block.java | 20 ++++++++++++++++++- src/main/resources/lang.yml | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main/java/love/sola/netsupport/enums/Block.java b/src/main/java/love/sola/netsupport/enums/Block.java index 9bcf37b..408af21 100644 --- a/src/main/java/love/sola/netsupport/enums/Block.java +++ b/src/main/java/love/sola/netsupport/enums/Block.java @@ -51,6 +51,15 @@ public class Block { public static final int FX_4 = 53; public static final int FX_5 = 54; public static final int FX_6 = 55; + public static final int BS_1 = 60; + public static final int BS_2 = 61; + public static final int BS_3 = 62; + public static final int BS_4 = 63; + public static final int BS_5 = 64; + public static final int BS_6 = 65; + public static final int BS_7 = 66; + public static final int BS_8 = 67; + public static final int BS_9 = 68; public static final Map inverseMap = new HashMap<>(); @@ -67,7 +76,7 @@ public class Block { } } - public static final int[][] AVAILABLE = new int[62][0]; + private static final int[][] AVAILABLE = new int[62][0]; static { // @formatter:off @@ -99,6 +108,15 @@ public class Block { AVAILABLE[XH_C] = new int[]{126, 226, 326, 426, 526, 626, 726, 826, 926, 1026, 1126, 1226}; AVAILABLE[XH_D] = new int[]{128, 228, 328, 428, 528, 628, 728, 828, 928, 1028, 1128, 1228}; AVAILABLE[FX_6] = new int[0]; + AVAILABLE[BS_1] = new int[]{102, 203, 301}; + AVAILABLE[BS_2] = new int[]{102, 203, 301}; + AVAILABLE[BS_3] = new int[]{103, 203, 302}; + AVAILABLE[BS_4] = new int[]{102, 203, 301}; + AVAILABLE[BS_5] = new int[]{102, 203, 301}; + AVAILABLE[BS_6] = new int[]{102, 203, 302}; + AVAILABLE[BS_7] = new int[]{102, 203, 301}; + AVAILABLE[BS_8] = new int[]{102, 203, 301}; + AVAILABLE[BS_9] = new int[]{103, 203, 302}; // @formatter:on } diff --git a/src/main/resources/lang.yml b/src/main/resources/lang.yml index 031aec3..e6f654b 100644 --- a/src/main/resources/lang.yml +++ b/src/main/resources/lang.yml @@ -13,7 +13,7 @@ REGEX_PROFILE: '^(?i)(EditProfile)|(修改资料)|(修改信息)|(xgzl)|(xgxx)$' REGEX_OPERATOR_INFO: '^(?i)(OpInfo)|(网维资料)|(wwzl)$' #Misc -Invalid_Operation: 'Whoops,报修姬找不到你想要的东西啦 (╯‵□′)╯︵┻━┻。' +Invalid_Operation: 'Whoops,本报修平台暂未开放聊天功能哦,请点击下方菜单选择你想进行的操作。' Message_Spam: '你的打字速度太快了,喝一杯82年的Java压压惊吧。' #Subscribe Event_Subscribe: "欢迎使用电子科技大学中山学院网络维护科微信自助报修平台。\n\n{0}" From 3736d66e74861af4db12d859d184e49482c1710e Mon Sep 17 00:00:00 2001 From: Sola Date: Sun, 9 Oct 2016 01:40:28 +0800 Subject: [PATCH 11/17] new new host --- src/main/resources/lang.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/resources/lang.yml b/src/main/resources/lang.yml index e6f654b..ec27f20 100644 --- a/src/main/resources/lang.yml +++ b/src/main/resources/lang.yml @@ -63,13 +63,13 @@ Operator_Info: | 若以上信息有误,请及时联系@15-沙子森。 #URL -User_Register_Link: 'http://s.wts.sola.love/nm/v2/user/reg.html?token={0}' -User_Query_Link: 'http://s.wts.sola.love/nm/v2/user/list.html?token={0}' -User_Submit_Link: 'http://s.wts.sola.love/nm/v2/user/rrepair.html?token={0}&name={1}&isp={2}&room={3}&block={4}&phone={5,number,#}' -User_Profile_Link: 'http://s.wts.sola.love/nm/v2/user/modi.html?token={0}&name={1}&isp={2}&username={3}&block={4}&room={5}&phone={6,number,#}' -Result_Page: 'http://s.wts.sola.love/nm/v2/result.html' -Operator_Home_Page: 'http://s.wts.sola.love/nm/v2/man/home.html?token={0}' -Operator_Login_Page: 'http://s.wts.sola.love/nm/v2/man/login.html?pkey={0}' +User_Register_Link: 'http://s.wts.zsxyww.com/nm/v2/user/reg.html?token={0}' +User_Query_Link: 'http://s.wts.zsxyww.com/nm/v2/user/list.html?token={0}' +User_Submit_Link: 'http://s.wts.zsxyww.com/nm/v2/user/rrepair.html?token={0}&name={1}&isp={2}&room={3}&block={4}&phone={5,number,#}' +User_Profile_Link: 'http://s.wts.zsxyww.com/nm/v2/user/modi.html?token={0}&name={1}&isp={2}&username={3}&block={4}&room={5}&phone={6,number,#}' +Result_Page: 'http://s.wts.zsxyww.com/nm/v2/result.html' +Operator_Home_Page: 'http://s.wts.zsxyww.com/nm/v2/man/home.html?token={0}' +Operator_Login_Page: 'http://s.wts.zsxyww.com/nm/v2/man/login.html?pkey={0}' #Localized #Status From 82d61269cdd36c66d639c79a66123a7851a74a6a Mon Sep 17 00:00:00 2001 From: Sola Date: Tue, 11 Oct 2016 07:36:31 +0800 Subject: [PATCH 12/17] new new new host --- src/main/resources/lang.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/resources/lang.yml b/src/main/resources/lang.yml index ec27f20..f24d6b1 100644 --- a/src/main/resources/lang.yml +++ b/src/main/resources/lang.yml @@ -63,13 +63,13 @@ Operator_Info: | 若以上信息有误,请及时联系@15-沙子森。 #URL -User_Register_Link: 'http://s.wts.zsxyww.com/nm/v2/user/reg.html?token={0}' -User_Query_Link: 'http://s.wts.zsxyww.com/nm/v2/user/list.html?token={0}' -User_Submit_Link: 'http://s.wts.zsxyww.com/nm/v2/user/rrepair.html?token={0}&name={1}&isp={2}&room={3}&block={4}&phone={5,number,#}' -User_Profile_Link: 'http://s.wts.zsxyww.com/nm/v2/user/modi.html?token={0}&name={1}&isp={2}&username={3}&block={4}&room={5}&phone={6,number,#}' -Result_Page: 'http://s.wts.zsxyww.com/nm/v2/result.html' -Operator_Home_Page: 'http://s.wts.zsxyww.com/nm/v2/man/home.html?token={0}' -Operator_Login_Page: 'http://s.wts.zsxyww.com/nm/v2/man/login.html?pkey={0}' +User_Register_Link: 'http://zscnm.applinzi.com/nm/v2/user/reg.html?token={0}' +User_Query_Link: 'http://zscnm.applinzi.com/nm/v2/user/list.html?token={0}' +User_Submit_Link: 'http://zscnm.applinzi.com/nm/v2/user/rrepair.html?token={0}&name={1}&isp={2}&room={3}&block={4}&phone={5,number,#}' +User_Profile_Link: 'http://zscnm.applinzi.com/nm/v2/user/modi.html?token={0}&name={1}&isp={2}&username={3}&block={4}&room={5}&phone={6,number,#}' +Result_Page: 'http://zscnm.applinzi.com/nm/v2/result.html' +Operator_Home_Page: 'http://zscnm.applinzi.com/nm/v2/man/home.html?token={0}' +Operator_Login_Page: 'http://zscnm.applinzi.com/nm/v2/man/login.html?pkey={0}' #Localized #Status From 179c28e31cc2f2a2b11f2007f3f9a984d66a91ac Mon Sep 17 00:00:00 2001 From: Sola Date: Tue, 11 Oct 2016 08:17:38 +0800 Subject: [PATCH 13/17] fix index out of bound --- src/main/java/love/sola/netsupport/enums/Block.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/love/sola/netsupport/enums/Block.java b/src/main/java/love/sola/netsupport/enums/Block.java index 408af21..eb15eb7 100644 --- a/src/main/java/love/sola/netsupport/enums/Block.java +++ b/src/main/java/love/sola/netsupport/enums/Block.java @@ -76,7 +76,7 @@ public class Block { } } - private static final int[][] AVAILABLE = new int[62][0]; + private static final int[][] AVAILABLE = new int[70][0]; static { // @formatter:off From 91ba67514f8031e5f7cf10d59f94f8652e7e9eb3 Mon Sep 17 00:00:00 2001 From: Sola Date: Wed, 19 Oct 2016 18:01:35 +0800 Subject: [PATCH 14/17] remove converter --- .../sola/netsupport/api/user/Register.java | 41 ------------------- .../wechat/handler/SubscribeHandler.java | 3 -- 2 files changed, 44 deletions(-) diff --git a/src/main/java/love/sola/netsupport/api/user/Register.java b/src/main/java/love/sola/netsupport/api/user/Register.java index 7b60935..3cc338c 100644 --- a/src/main/java/love/sola/netsupport/api/user/Register.java +++ b/src/main/java/love/sola/netsupport/api/user/Register.java @@ -94,48 +94,7 @@ public class Register extends API { String dupKey = e.getConstraintName(); return Error.INVALID_PARAMETER.withMsg("Duplicated_" + dupKey.toUpperCase()); // PHONE ACCOUNT WECHAT } - // FIXME: 2015/12/30 Temporary converter - converterWithRetry(user); return Error.OK; } - public static void converterWithRetry(User u) { - Throwable last = null; - for (int i = 0; i < 3; i++) { - try { - converter(u); - return; - } catch (WxErrorException | SQLException e) { - last = e; - } - } - last.printStackTrace(); - try { - WxMpServlet.instance.wxMpService.customMessageSend(WxMpCustomMessage.TEXT().toUser(u.getWechatId()).content("数据转换失败").build()); - } catch (WxErrorException e) { - e.printStackTrace(); - } - } - - public static void converter(User u) throws WxErrorException, SQLException { - try (Connection conn = SQLCore.ds.getConnection()) { - PreparedStatement ps = conn.prepareStatement("SELECT wechat FROM `convert` WHERE id=?"); - ps.setLong(1, u.getId()); - ResultSet rs = ps.executeQuery(); - if (rs.next()) { - WxMpServlet.instance.wxMpService - .userUpdateGroup(u.getWechatId(), 100L); - String old = rs.getString(1); - ps = conn.prepareStatement("UPDATE `operators` SET wechat=? WHERE wechat=?"); - ps.setString(1, u.getWechatId()); - ps.setString(2, old); - if (ps.executeUpdate() == 1) { - WxMpServlet.instance.wxMpService.customMessageSend(WxMpCustomMessage.TEXT().toUser(u.getWechatId()).content("数据转换成功").build()); - } else { - WxMpServlet.instance.wxMpService.customMessageSend(WxMpCustomMessage.TEXT().toUser(u.getWechatId()).content("已进行过数据转换").build()); - } - } - } - } - } diff --git a/src/main/java/love/sola/netsupport/wechat/handler/SubscribeHandler.java b/src/main/java/love/sola/netsupport/wechat/handler/SubscribeHandler.java index b03741f..0252c13 100644 --- a/src/main/java/love/sola/netsupport/wechat/handler/SubscribeHandler.java +++ b/src/main/java/love/sola/netsupport/wechat/handler/SubscribeHandler.java @@ -17,7 +17,6 @@ package love.sola.netsupport.wechat.handler; -import love.sola.netsupport.api.user.Register; import love.sola.netsupport.enums.Attribute; import love.sola.netsupport.pojo.Operator; import love.sola.netsupport.pojo.User; @@ -58,8 +57,6 @@ public class SubscribeHandler implements WxMpMessageHandler { Operator op = TableOperator.get(fromUser); if (op != null) { wxMpService.userUpdateGroup(fromUser, 100L); - } else { - Register.converterWithRetry(u); //TODO remove me } } else { session.setAttribute(Attribute.AUTHORIZED, Command.REGISTER); From f1e73b8945516ce95e507ad3194a03a3c62f1a23 Mon Sep 17 00:00:00 2001 From: Sola Date: Thu, 20 Oct 2016 23:19:26 +0800 Subject: [PATCH 15/17] enable operator signning --- .../java/love/sola/netsupport/wechat/Command.java | 5 ++++- .../wechat/handler/admin/SignHandler.java | 14 +++++++++----- src/main/resources/lang.yml | 1 + 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/main/java/love/sola/netsupport/wechat/Command.java b/src/main/java/love/sola/netsupport/wechat/Command.java index b710391..19e3883 100644 --- a/src/main/java/love/sola/netsupport/wechat/Command.java +++ b/src/main/java/love/sola/netsupport/wechat/Command.java @@ -20,6 +20,7 @@ package love.sola.netsupport.wechat; import love.sola.netsupport.wechat.handler.*; import love.sola.netsupport.wechat.handler.admin.LoginHandler; import love.sola.netsupport.wechat.handler.admin.OperatorInfoHandler; +import love.sola.netsupport.wechat.handler.admin.SignHandler; import me.chanjar.weixin.mp.api.WxMpMessageHandler; import java.util.HashMap; @@ -38,7 +39,9 @@ public enum Command { CANCEL(3, CancelHandler.class), PROFILE(4, ProfileHandler.class), LOGIN(10, LoginHandler.class), - OPERATOR_INFO(11, OperatorInfoHandler.class),; + OPERATOR_INFO(11, OperatorInfoHandler.class), + SIGN(12, SignHandler.class), //FIXME + ; private static final Map ID_MAP = new HashMap<>(); diff --git a/src/main/java/love/sola/netsupport/wechat/handler/admin/SignHandler.java b/src/main/java/love/sola/netsupport/wechat/handler/admin/SignHandler.java index d4418f0..143fd5e 100644 --- a/src/main/java/love/sola/netsupport/wechat/handler/admin/SignHandler.java +++ b/src/main/java/love/sola/netsupport/wechat/handler/admin/SignHandler.java @@ -35,11 +35,15 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; /** + * @deprecated limited time only * @author Sola {@literal } */ +@Deprecated public class SignHandler implements WxMpMessageHandler { - public static Pattern pat = Pattern.compile("(?i)^Auth (\\d{4})"); + public static Pattern pat = Pattern.compile("^(?i)Auth (\\d{4})"); + public static final int INVALID_ID = -1; + public static final int SIGNED_ID = -2; @Override public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map context, WxMpService wxMpService, WxSessionManager sessionManager) throws WxErrorException { @@ -52,10 +56,10 @@ public class SignHandler implements WxMpMessageHandler { int id = Integer.parseInt(mat.group(1)); try (Connection conn = SQLCore.ds.getConnection()) { switch (checkID(conn, id)) { - case -1: + case INVALID_ID: out.content("无效ID。"); break root; - case -2: + case SIGNED_ID: out.content("该ID已登记过。"); break root; } @@ -86,9 +90,9 @@ public class SignHandler implements WxMpMessageHandler { ps.setInt(1, id); ResultSet rs = ps.executeQuery(); if (rs.next()) { - return rs.getString("wechat") != null ? -2 : 0; + return rs.getString("wechat") != null ? SIGNED_ID : 0; } else { - return -1; + return INVALID_ID; } } diff --git a/src/main/resources/lang.yml b/src/main/resources/lang.yml index f24d6b1..c94af66 100644 --- a/src/main/resources/lang.yml +++ b/src/main/resources/lang.yml @@ -11,6 +11,7 @@ REGEX_CANCEL: '^(?i)(Cancel)|(取消)|(撤销)|(qx)|(cx)$' REGEX_LOGIN: '^(?i)Authme$' REGEX_PROFILE: '^(?i)(EditProfile)|(修改资料)|(修改信息)|(xgzl)|(xgxx)$' REGEX_OPERATOR_INFO: '^(?i)(OpInfo)|(网维资料)|(wwzl)$' +REGEX_SIGN: '^(?i)Auth (\d{4})$' #Misc Invalid_Operation: 'Whoops,本报修平台暂未开放聊天功能哦,请点击下方菜单选择你想进行的操作。' From c32a938dc77967b1ff11339b5a40259cbf24e69d Mon Sep 17 00:00:00 2001 From: Sola Date: Sun, 3 Sep 2017 13:32:15 +0800 Subject: [PATCH 16/17] change domain --- .gitignore | 22 +- LICENSE | 330 ++++++++--------- README.md | 56 +-- pom.xml | 334 +++++++++--------- .../sola/netsupport/api/user/Register.java | 8 - src/main/resources/lang.yml | 14 +- src/main/resources/menu.json | 6 +- 7 files changed, 381 insertions(+), 389 deletions(-) diff --git a/.gitignore b/.gitignore index 67f58ca..0730807 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,12 @@ -/buildNumber.properties -/docs -.idea/ -out/ -/.metadata/ -/web/META-INF/context.xml -*.iml -~* -.DS_Store -.classpath -/target +/buildNumber.properties +/docs +.idea/ +out/ +/.metadata/ +/web/META-INF/context.xml +*.iml +~* +.DS_Store +.classpath +/target .project \ No newline at end of file diff --git a/LICENSE b/LICENSE index 65c5ca8..b14ca0a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,165 +1,165 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/README.md b/README.md index 3d5ed1d..1aed991 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,29 @@ -#WechatTicketSystem -WechatTicketSystem is a basic ticket system for network maintaining, based on Wechat. - -##Build -### Requirements -- [Apache Maven](https://maven.apache.org/) (latest version recommended) - -### Steps -1. Clone the git repository `git clone https://github.com/ZSCNetSupportDept/WechatTicketSystem.git` -2. Change dir to project root (where the `pom.xml` is) -3. Build with Maven `mvn clean package` -4. The out file will be in `target/` folder - -##Contributing -###Code Style -The code style configuration is [here](http://stash.sola.love/projects/PSS/repos/ide_configuration/browse/intellij%20idea/Code_Style_Use_Tab.xml). - -In Intellij IDEA, you can import the configuration by Settings-\>Editor-\>Code Style-\>Manage(at right side)-\>Import.. -###Pull Request -Please notice that the pull requests should compare with `develop` branch instead of `master`, -submit pull requests to `master` branch will be ignored. -##TroubleShooting -- Before you report a bug, please [search the issue tracker](https://github.com/ZSCNetSupportDept/WechatTicketSystem/issues) to see if someone has already reported the problem. -- If the issue doesn’t already exist, [create a new issue](https://github.com/ZSCNetSupportDept/WechatTicketSystem/issues/new). -- Please provide as much information as possible with the issue report, we like to know the version of FYoung4j that you are using, as well as your Operating System and JVM version. -- If you need to paste code, or include a stack trace use Markdown ```` ``` ```` escapes before and after your text. - -##License +#WechatTicketSystem +WechatTicketSystem is a basic ticket system for network maintaining, based on Wechat. + +##Build +### Requirements +- [Apache Maven](https://maven.apache.org/) (latest version recommended) + +### Steps +1. Clone the git repository `git clone https://github.com/ZSCNetSupportDept/WechatTicketSystem.git` +2. Change dir to project root (where the `pom.xml` is) +3. Build with Maven `mvn clean package` +4. The out file will be in `target/` folder + +##Contributing +###Code Style +The code style configuration is [here](http://stash.sola.love/projects/PSS/repos/ide_configuration/browse/intellij%20idea/Code_Style_Use_Tab.xml). + +In Intellij IDEA, you can import the configuration by Settings-\>Editor-\>Code Style-\>Manage(at right side)-\>Import.. +###Pull Request +Please notice that the pull requests should compare with `develop` branch instead of `master`, +submit pull requests to `master` branch will be ignored. +##TroubleShooting +- Before you report a bug, please [search the issue tracker](https://github.com/ZSCNetSupportDept/WechatTicketSystem/issues) to see if someone has already reported the problem. +- If the issue doesn’t already exist, [create a new issue](https://github.com/ZSCNetSupportDept/WechatTicketSystem/issues/new). +- Please provide as much information as possible with the issue report, we like to know the version of FYoung4j that you are using, as well as your Operating System and JVM version. +- If you need to paste code, or include a stack trace use Markdown ```` ``` ```` escapes before and after your text. + +##License WechatTicketSystem is distributed under the GNU Lesser General Public License v3.0 (LGPLv3). \ No newline at end of file diff --git a/pom.xml b/pom.xml index b9ed1f7..25bea55 100644 --- a/pom.xml +++ b/pom.xml @@ -1,168 +1,168 @@ - - - 4.0.0 - WechatTicketSystem - love.sola.netsupport - WechatTicketSystem - 2.1-SNAPSHOT - war - - - UTF-8 - 1.8 - 1.8 - 1.8 - - - - scm:svn:http://127.0.0.1/dummy - scm:svn:https://127.0.0.1/dummy - HEAD - http://127.0.0.1/dummy - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.3 - - 1.8 - 1.8 - - - - org.codehaus.mojo - buildnumber-maven-plugin - 1.4 - - {0,number,0000} - - buildNumber0 - - false - false - unknown - - - - validate - - create - - - - - - ${project.artifactId}##${buildNumber} - - - - - javax.servlet - javax.servlet-api - 3.1.0 - provided - - - org.projectlombok - lombok - 1.16.6 - provided - - - junit - junit - 4.12 - test - - - org.slf4j - slf4j-simple - 1.7.12 - - - com.google.guava - guava - 19.0-rc2 - - - com.google.code.gson - gson - 2.4 - - - org.apache.commons - commons-io - 1.3.2 - - - org.apache.commons - commons-lang3 - 3.4 - - - commons-net - commons-net - 3.3 - - - me.chanjar - weixin-java-mp - 1.3.3 - - - com.mchange - c3p0 - 0.9.5.1 - - - mysql - mysql-connector-java - 5.1.37 - - - org.hibernate - hibernate-core - 5.0.3.Final - - - org.hibernate - hibernate-entitymanager - 5.0.3.Final - - - org.hibernate - hibernate-c3p0 - 5.0.3.Final - - - org.hibernate.javax.persistence - hibernate-jpa-2.1-api - 1.0.0.Final - - - org.hibernate - hibernate-envers - 5.0.3.Final - - - de.svenkubiak - jBCrypt - 0.4 - - - org.yaml - snakeyaml - 1.16 - - - org.reflections - reflections - 0.9.10 - - - + + + 4.0.0 + WechatTicketSystem + love.sola.netsupport + WechatTicketSystem + 2.1-SNAPSHOT + war + + + UTF-8 + 1.8 + 1.8 + 1.8 + + + + scm:svn:http://127.0.0.1/dummy + scm:svn:https://127.0.0.1/dummy + HEAD + http://127.0.0.1/dummy + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.3 + + 1.8 + 1.8 + + + + org.codehaus.mojo + buildnumber-maven-plugin + 1.4 + + {0,number,0000} + + buildNumber0 + + false + false + unknown + + + + validate + + create + + + + + + ${project.artifactId}##${buildNumber} + + + + + javax.servlet + javax.servlet-api + 3.1.0 + provided + + + org.projectlombok + lombok + 1.16.6 + provided + + + junit + junit + 4.12 + test + + + org.slf4j + slf4j-simple + 1.7.12 + + + com.google.guava + guava + 19.0-rc2 + + + com.google.code.gson + gson + 2.4 + + + org.apache.commons + commons-io + 1.3.2 + + + org.apache.commons + commons-lang3 + 3.4 + + + commons-net + commons-net + 3.3 + + + me.chanjar + weixin-java-mp + 1.3.3 + + + com.mchange + c3p0 + 0.9.5.1 + + + mysql + mysql-connector-java + 5.1.37 + + + org.hibernate + hibernate-core + 5.0.3.Final + + + org.hibernate + hibernate-entitymanager + 5.0.3.Final + + + org.hibernate + hibernate-c3p0 + 5.0.3.Final + + + org.hibernate.javax.persistence + hibernate-jpa-2.1-api + 1.0.0.Final + + + org.hibernate + hibernate-envers + 5.0.3.Final + + + de.svenkubiak + jBCrypt + 0.4 + + + org.yaml + snakeyaml + 1.16 + + + org.reflections + reflections + 0.9.10 + + + \ No newline at end of file diff --git a/src/main/java/love/sola/netsupport/api/user/Register.java b/src/main/java/love/sola/netsupport/api/user/Register.java index 3cc338c..b78db3c 100644 --- a/src/main/java/love/sola/netsupport/api/user/Register.java +++ b/src/main/java/love/sola/netsupport/api/user/Register.java @@ -24,19 +24,11 @@ import love.sola.netsupport.enums.Attribute; import love.sola.netsupport.enums.ISP; import love.sola.netsupport.pojo.User; import love.sola.netsupport.session.WxSession; -import love.sola.netsupport.sql.SQLCore; import love.sola.netsupport.sql.TableUser; import love.sola.netsupport.wechat.Command; -import love.sola.netsupport.wechat.WxMpServlet; -import me.chanjar.weixin.common.exception.WxErrorException; -import me.chanjar.weixin.mp.bean.WxMpCustomMessage; import org.hibernate.exception.ConstraintViolationException; import javax.servlet.http.HttpServletRequest; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; import static love.sola.netsupport.util.Checker.*; diff --git a/src/main/resources/lang.yml b/src/main/resources/lang.yml index c94af66..90a258f 100644 --- a/src/main/resources/lang.yml +++ b/src/main/resources/lang.yml @@ -64,13 +64,13 @@ Operator_Info: | 若以上信息有误,请及时联系@15-沙子森。 #URL -User_Register_Link: 'http://zscnm.applinzi.com/nm/v2/user/reg.html?token={0}' -User_Query_Link: 'http://zscnm.applinzi.com/nm/v2/user/list.html?token={0}' -User_Submit_Link: 'http://zscnm.applinzi.com/nm/v2/user/rrepair.html?token={0}&name={1}&isp={2}&room={3}&block={4}&phone={5,number,#}' -User_Profile_Link: 'http://zscnm.applinzi.com/nm/v2/user/modi.html?token={0}&name={1}&isp={2}&username={3}&block={4}&room={5}&phone={6,number,#}' -Result_Page: 'http://zscnm.applinzi.com/nm/v2/result.html' -Operator_Home_Page: 'http://zscnm.applinzi.com/nm/v2/man/home.html?token={0}' -Operator_Login_Page: 'http://zscnm.applinzi.com/nm/v2/man/login.html?pkey={0}' +User_Register_Link: 'http://wwbx.zsc.edu.cn/nm/v2/user/reg.html?token={0}' +User_Query_Link: 'http://wwbx.zsc.edu.cn/nm/v2/user/list.html?token={0}' +User_Submit_Link: 'http://wwbx.zsc.edu.cn/nm/v2/user/rrepair.html?token={0}&name={1}&isp={2}&room={3}&block={4}&phone={5,number,#}' +User_Profile_Link: 'http://wwbx.zsc.edu.cn/nm/v2/user/modi.html?token={0}&name={1}&isp={2}&username={3}&block={4}&room={5}&phone={6,number,#}' +Result_Page: 'http://wwbx.zsc.edu.cn/nm/v2/result.html' +Operator_Home_Page: 'http://wwbx.zsc.edu.cn/nm/v2/man/home.html?token={0}' +Operator_Login_Page: 'http://wwbx.zsc.edu.cn/nm/v2/man/login.html?pkey={0}' #Localized #Status diff --git a/src/main/resources/menu.json b/src/main/resources/menu.json index 8cd55f1..0e17a95 100644 --- a/src/main/resources/menu.json +++ b/src/main/resources/menu.json @@ -51,17 +51,17 @@ { "type": "view", "name": "关于报修系统", - "url": "http://s.wts.sola.love/nm/v2/" + "url": "http://wwbx.zsc.edu.cn/nm/v2/" }, { "type": "view", "name": "联系我们", - "url": "http://s.wts.sola.love/nm/v2/404.html" + "url": "http://wwbx.zsc.edu.cn/nm/v2/404.html" }, { "type": "view", "name": "关于网维", - "url": "http://s.wts.sola.love/nm/v2/404.html" + "url": "http://wwbx.zsc.edu.cn/nm/v2/404.html" } ] } From abe2e1a12558282ddb0ad8b793fadc06f5cd00dd Mon Sep 17 00:00:00 2001 From: Sola Date: Mon, 11 Dec 2017 16:03:59 +0800 Subject: [PATCH 17/17] remove OAuth2, add new block Signed-off-by: Sola --- .../love/sola/netsupport/enums/Block.java | 4 ++- .../love/sola/netsupport/util/Checker.java | 2 +- src/main/resources/lang.yml | 5 +++- src/main/resources/menu-op.json | 28 +++---------------- src/main/resources/menu.json | 24 ++-------------- 5 files changed, 14 insertions(+), 49 deletions(-) diff --git a/src/main/java/love/sola/netsupport/enums/Block.java b/src/main/java/love/sola/netsupport/enums/Block.java index eb15eb7..dd7cee9 100644 --- a/src/main/java/love/sola/netsupport/enums/Block.java +++ b/src/main/java/love/sola/netsupport/enums/Block.java @@ -60,6 +60,7 @@ public class Block { public static final int BS_7 = 66; public static final int BS_8 = 67; public static final int BS_9 = 68; + public static final int ZH = 80; public static final Map inverseMap = new HashMap<>(); @@ -76,7 +77,7 @@ public class Block { } } - private static final int[][] AVAILABLE = new int[70][0]; + private static final int[][] AVAILABLE = new int[100][0]; static { // @formatter:off @@ -117,6 +118,7 @@ public class Block { AVAILABLE[BS_7] = new int[]{102, 203, 301}; AVAILABLE[BS_8] = new int[]{102, 203, 301}; AVAILABLE[BS_9] = new int[]{103, 203, 302}; + AVAILABLE[ZH] = new int[]{199, 299, 399, 499, 599, 699, 799, 899, 999, 1099, 1199, 1299, 1399}; // @formatter:on } diff --git a/src/main/java/love/sola/netsupport/util/Checker.java b/src/main/java/love/sola/netsupport/util/Checker.java index 0e2b041..0fb5e2f 100644 --- a/src/main/java/love/sola/netsupport/util/Checker.java +++ b/src/main/java/love/sola/netsupport/util/Checker.java @@ -25,7 +25,7 @@ import love.sola.netsupport.enums.ISP; */ public class Checker { - public static final String STUDENT_ID_REGEX = "^(2010|2012|2013|2014|2015|2016)[0-9]{9}$"; + public static final String STUDENT_ID_REGEX = "^(2014|2015|2016|2017)[0-9]{9}$"; public static final String PHONE_NUMBER_REGEX = "^1[34578][0-9]{9}$"; public static boolean hasNull(Object... v) { diff --git a/src/main/resources/lang.yml b/src/main/resources/lang.yml index 90a258f..ccbc33d 100644 --- a/src/main/resources/lang.yml +++ b/src/main/resources/lang.yml @@ -1,6 +1,9 @@ #System Exception Access_Denied: 'Access denied.' -Illegal_Request: "Access denied.\nYou are doing a illegal request, and our system has logged your behaviors.\nYou need to take this seriously, if you do this frequently, you may be banned from our system." +Illegal_Request: | + Access denied. + You are doing an illegal request, and our system has logged your behaviors. + You have to take this seriously, you may be banned from our system if you do this frequently. Unknown_Encrypt_Type: 'Unknown encrypt-type.' #Command Regex diff --git a/src/main/resources/menu-op.json b/src/main/resources/menu-op.json index 87b5859..839a3a1 100644 --- a/src/main/resources/menu-op.json +++ b/src/main/resources/menu-op.json @@ -19,24 +19,9 @@ "key": "CANCEL" }, { - "type": "view", + "type": "click", "name": "修改资料", - "url": "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb7a8b799e494b053&redirect_uri=http%3a%2f%2fwcs.sola.love%2foauth2%2fcallback&response_type=code&scope=snsapi_base&state=PROFILE#wechat_redirect" - } - ] - }, - { - "name": "工具箱", - "sub_button": [ - { - "type": "view", - "name": "电信宽带查余额", - "url": "http://util.sola.love/yue.html" - }, - { - "type": "view", - "name": "四六级成绩查询", - "url": "http://util.sola.love/cet.html" + "key": "PROFILE" } ] }, @@ -49,14 +34,9 @@ "key": "OPERATOR_INFO" }, { - "type": "view", + "type": "click", "name": "后台登录", - "url": "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb7a8b799e494b053&redirect_uri=http%3a%2f%2fwcs.sola.love%2foauth2%2fcallback&response_type=code&scope=snsapi_base&state=LOGIN#wechat_redirect" - }, - { - "type": "view", - "name": "网维留言板", - "url": "http://wcs.sola.love/oauth2/go" + "key": "LOGIN" } ] } diff --git a/src/main/resources/menu.json b/src/main/resources/menu.json index 0e17a95..5202999 100644 --- a/src/main/resources/menu.json +++ b/src/main/resources/menu.json @@ -19,35 +19,15 @@ "key": "CANCEL" }, { - "type": "view", + "type": "click", "name": "修改资料", - "url": "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb7a8b799e494b053&redirect_uri=http%3a%2f%2fwcs.sola.love%2foauth2%2fcallback&response_type=code&scope=snsapi_base&state=PROFILE#wechat_redirect" - } - ] - }, - { - "name": "工具箱", - "sub_button": [ - { - "type": "view", - "name": "电信宽带查余额", - "url": "http://util.sola.love/yue.html" - }, - { - "type": "view", - "name": "四六级成绩查询", - "url": "http://util.sola.love/cet.html" + "key": "PROFILE" } ] }, { "name": "关于网维", "sub_button": [ - { - "type": "view", - "name": "网维留言板", - "url": "http://wcs.sola.love/oauth2/go" - }, { "type": "view", "name": "关于报修系统",