发表于: 2017-12-25 23:37:25

1 640


今天完成的事情:

1.调试生成好的代码,是否能正常运行

写了一个测试类,不用用jetty运行web,直接使用这个工具类就可以测试client-server两个组件之间是否能互相通信

在web下建立一个测试类:

public class SCATest {
   private UserService userService;

   @Test
   public void UserService() throws ServiceException, ServiceDaoException {
       ApplicationContext context = new FileSystemXmlApplicationContext("src/main/webapp/WEB-INF/spring/applicationContext-client.xml");

       userService = (UserService) context.getBean("userService");

       User user  = new User();

       user.setAvatar("http://summerwaves.oss-cn-shenzhen.aliyuncs.com/wallhaven-371831.jpg");

       user.setBeans(15);

       user.setEmail("test1@jnshu.com");

       user.setOpenid("openidxxx");

       user.setTel("10086");

       user.setNickname("张三");

       user.setGrade(1);


       user.setCreateBy(11L);

       user.setUpdateBy(13L);


       Long id= this.userService.insert(user);
       System.out.println("插入成功,插入id为:" + id);

   }
}


打开相应server,测试结果为:

即可成功测试两边配置文件是否正确,而不用上jetty一个一个的测


2.接口文档编写

开始写接口文档才发现有很多东西没有考虑到,比如现在的方案是若绑定成功,则向前端发一个用户id,然后再每个/a/u/**下都要发送用户id过来,乍看下可行,但是安全性太低了,什么人发个id过来都可以获取用户数据,如果有时间的话可以搞个jwt的token验证或shiro框架,要是没时间的话也可以搞一个像以前任务做过的一个简单的生成、验证token的方法


3.现在是我在做检查每天是否评日报,是否有人不写日报的事情,但是每天都要看那一长串未评日报的名单,其中还有分布在各个位置的重复的名字,还有修真院员工不评日报,每天都要浪费好多时间在上面,还不如索性一次性多花点时间写个东西,于是做了个小程序来过滤这串名单,程序员就是要有个程序员的样子

要过滤的名单:


代码

public class Filtrate {

   private static final String fileName = "E:\\GitHub\\daily\\src\\main\\resources\\Test.txt";

   public static  List<String> getMatch() {
       List<String> matchList = new ArrayList<String>();
       List<String> removeList = new ArrayList<String>();
       try {
           Pattern regex = Pattern.compile("(?<=[\u4e00-\u9fa5]\\s)[\u4e00-\u9fa5]*(?=h)");
           Matcher regexMatcher = regex.matcher(txt2String());
           //员工
           removeList.add("毛雨星");
           removeList.add("冯馨雨");
           removeList.add("贾阳倩");
           removeList.add("张建礼");
           removeList.add("翟金超");
           removeList.add("杨泽平");
           removeList.add("张帆");
           removeList.add("施星");
           removeList.add("高高");
           removeList.add("李绍博");
           removeList.add("王相博");
           removeList.add("童志荣");
           //已工作
           removeList.add("杨纲");
           removeList.add("杨雨辰");
           while (regexMatcher.find()) {
               matchList.add(regexMatcher.group());
           }

           matchList.removeAll(removeList);

       } catch (PatternSyntaxException ex) {
           // Syntax error in the regular expression
       }
       return new ArrayList<String>(new TreeSet<String>(matchList));
   }

   public static String txt2String() {
       //读取文件
       StringBuilder fileContent = new StringBuilder();
       try {
           File f = new File(fileName);
           if (f.isFile() && f.exists()) {
               InputStreamReader read = new InputStreamReader(new FileInputStream(f), "UTF-8");
               BufferedReader reader = new BufferedReader(read);
               String line;
               while ((line = reader.readLine()) != null) {
                   fileContent.append(line);
               }
               read.close();
           }
       } catch (Exception e) {
           e.printStackTrace();
       }
       return fileContent.toString();
   }
}


测试类:

@Test
public void getMatch() {
   logger.info(Filtrate.getMatch());

}


测试结果:


原本要十几分钟的事,还要看到眼疼,还可能会出错,现在直接出结果


明天计划的事情:

继续写接口文档,然后写方案设计,写的完的进行方案评审


遇到的问题:

用户模块的绑定/登录方案有点问题,现在是打算用token来解决


收获:

如上所述


进度:

方案编写中,准备方案评审


返回列表 返回列表
评论

    分享到