Explore Enterprise Education Gitee Premium Gitee AI AI teammates
Fetch the repository succeeded.
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
Already have an account? Sign in
文件
master
Branches (1)
master
master
Branches (1)
master
Clone or Download
Clone/Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1 Generate RSA keys.
2 Obtain the content of the RSA public key and configure it in SSH Public Keys
To use SVN on Gitee, please visit the usage guide
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # Private Token
master
Branches (1)
master
bullshit-codes
/
java
/
DemoController.java
bullshit-codes
/
java
/
DemoController.java
DemoController.java 3.10 KB
Copy Edit Raw Blame History
非常君 authored 2019年06月05日 23:25 +08:00 . 挖坑不填坑,菊花塞电灯
package com.demo.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* 三年前接手的一个政府网站项目,真假不知,据说是一个两年web开发经验的程序员写的, 用的spring系列还是3.x版本,前端还是jsp,可能是老项目。
* 主要特点是:实体类中不写注释,数据库表中也没有注释,命名经常使用英文拼音混合,而且还可能是简写(grzlChangeStatus:个人资料变更状态)
*
* 挖坑不填坑,菊花塞电灯
*/
@Controller
public class DemoController {
/**
* 这个方法一共有800多行,有30多个if或else if的条件判断,只写代表性的几个
*
* 具体方法名称记不得,逻辑是这样,前端jsp提交一个请求过来,界面中除了一些必填信息外,还有有5个下拉框,后台判断各种组合,
* 分别往request里面塞入不同的对象,返回的页面视图也可能不同。
*/
@RequestMapping("/submit")
public String template(HttpServletRequest request, HttpServletResponse response, HttpSession session) {
String param1 = request.getParameter("param1");
String param2 = request.getParameter("param2");
String param3 = request.getParameter("param3");
String param4 = request.getParameter("param4");
String param5 = request.getParameter("param5");
// 你没看错,各种状态全部存字串,而且判断的时候不考虑空指针问题
if (param1.equals("已消毒")) {
// 逻辑
request.setAttribute("attr", "value");
return "jsp1";
} else if (param1.equals("已消毒") && param2.equals("1.8米以上")) {
// 逻辑
request.setAttribute("attr", "value");
// 你没看错,可能又是另一个视图
return "jsp2";
// 你没看错,还可能出现多个条件,|| 和 &&
} else if (param1.equals("已消毒") && param2.equals("2米以上") || param3.equals("缅甸")) {
// 逻辑
request.setAttribute("attr", "value");
return "jsp3";
// 你没看错,因为他的状态或选项没有用数字类型,所以不能用 > < 之类的来判断,要列举所有状态
} else if (param1.equals("未进站") || param1.equals("已进站") || param1.equals("已消毒") && param2.equals("2米以上")) {
request.setAttribute("attr", "value");
return "jsp3";
//你没看错,还会出现 true==true 或false==false这样的代码
}else if(param4.equals("禁止入境")==true && param5.equals("农用车")) {
request.setAttribute("attr", "value");
return "jsp4";
//你没看错,还会出现逻辑非,而且,要先判断什么条件,从来不用括号包起来,要理他的逻辑,还要先理条件判断优先级
}else if(param1.equals("未进站") || param1.equals("已进站") || param1.equals("已消毒") && param2.equals("2米以上") && !param3.equals("缅甸")) {
request.setAttribute("attr", "value");
return "jsp5";
}
//省略剩下的30多个类似的判断
else {
return "default";
}
}
}
Loading...
Report
Report success
We will send you the feedback within 2 working days through the letter!
Please fill in the reason for the report carefully. Provide as detailed a description as possible.
Please select a report type
Cancel
Send
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

About

本仓库收集史上最坑爹的代码片段,欢迎大家通过 Fork+Pull Request 参与
Cancel

Releases

No release

Contributors

All

Activities

can not load any more
Edit
About
Homepage
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/secondriver/bullshit-codes.git
git@gitee.com:secondriver/bullshit-codes.git
secondriver
bullshit-codes
bullshit-codes
master
Going to Help Center

Search

Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register

AltStyle によって変換されたページ (->オリジナル) /