基于javaweb的SSM+Maven高校后勤报修系统(java+ssm+jsp+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

291923552708

301923552708

311923552708

321923552708

331923552708

341923552708

基于javaweb的SSM+Maven高校后勤报修系统(java+ssm+jsp+mysql)

管理员
admin 12346

学生
a1 123456
a2 123456
a3 123456

后勤人员
a1 123456
a2 123456
a3 123456

登录:
http://localhost:8080/houqinbaoxiu/jsp/login.jsp

图片存放路径: src\main\webapp\upload,项目全路径不能有中文

流程:
1 学生报修
2 管理员指派后勤人员
3 后勤确认结果

1
2
3
4
5
6
7
8
9
10
11
12
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
 -- 饼状图  查询级联表
-- 查询字典表
-- 统计 -- 查询某个月的每个类型的订单销售数量
-- 求和 -- 查询某个月的每个类型的订单销售额
-- 查询某个字符串
-- 统计 -- 查询某个月的每个员工的订单销售数量
-- 求和 -- 查询某个月的每个员工的订单销售额
-- 查询时间
-- 统计 -- 统计每个月的订单销售数量
-- 求和 -- 查询每个月的订单销售额
*/


/**
* 柱状图
-- 柱状图 查询当前表
-- 某个【年,月】
-- 当前表 2 级联表 1
-- 统计
-- 【日期,字符串,下拉框】
-- 求和
-- 【日期,字符串,下拉框】
-- 柱状图 查询级联表
-- 某个【年,月】
-- 统计
-- 【日期,字符串,下拉框】
-- 求和
-- 【日期,字符串,下拉框】
*/

/**
* 柱状图求和
*/
@RequestMapping("/barSum")
public R barSum(@RequestParam Map<String,Object> params) {
logger.debug("barSum方法:,,Controller:{},,params:{}",this.getClass().getName(), com.alibaba.fastjson.JSONObject.toJSONString(params));
Boolean isJoinTableFlag = false;//是否有级联表相关
String one = "";//第一优先
String two = "";//第二优先

//处理thisTable和joinTable 处理内容是把json字符串转为Map并把带有,的切割为数组
//当前表
Map<String,Object> thisTable = JSON.parseObject(String.valueOf(params.get("thisTable")),Map.class);
params.put("thisTable",thisTable);

//级联表
String joinTableString = String.valueOf(params.get("joinTable"));
if(StringUtil.isNotEmpty(joinTableString)) {
Map<String, Object> joinTable = JSON.parseObject(joinTableString, Map.class);
params.put("joinTable", joinTable);
isJoinTableFlag = true;
}

1
2
3
4
5
6
7
8
9
10
11
12
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
 * 上传文件映射表
*/
@RestController
@RequestMapping("file")
@SuppressWarnings({"unchecked","rawtypes"})
public class FileController{
@Autowired
private ConfigService configService;
/**
* 上传文件
*/
@RequestMapping("/upload")
public R upload(@RequestParam("file") MultipartFile file, String type,HttpServletRequest request) throws Exception {
if (file.isEmpty()) {
throw new EIException("上传文件不能为空");
}
String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
String fileName = new Date().getTime()+"."+fileExt;
File dest = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+fileName);
file.transferTo(dest);
if(StringUtils.isNotBlank(type) && type.equals("1")) {
ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
if(configEntity==null) {
configEntity = new ConfigEntity();
configEntity.setName("faceFile");
configEntity.setValue(fileName);
} else {
configEntity.setValue(fileName);
}
configService.insertOrUpdate(configEntity);
}
return R.ok().put("file", fileName);
}

/**
* 下载文件
*/
@IgnoreAuth
@RequestMapping("/download")
public void download(@RequestParam String fileName, HttpServletRequest request, HttpServletResponse response) {
try {
File file = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+fileName);
if (file.exists()) {
response.reset();
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName+"\"");
response.setHeader("Cache-Control", "no-cache");
1
2
3
4
5
6
7
8
9
10
11
12
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
     /**
* 赋值给字典表
* @param obj view对象
*/
public void dictionaryConvert(Object obj, HttpServletRequest request) {
try {
if (obj == null) return;
//当前view和entity中的所有types的字段
List<String> fieldNameList = new ArrayList<>();
Class tempClass = obj.getClass();
while (tempClass !=null) {
Field[] declaredFields = tempClass.getDeclaredFields();
for (Field f : declaredFields) {
f.setAccessible(true);
if (f.getType().getName().equals("java.lang.Integer") && f.getName().contains("Types")) {
fieldNameList.add(f.getName());
}
}
tempClass = tempClass.getSuperclass(); //得到父类,然后赋给自己
}

// 获取监听器中的字典表
// ServletContext servletContext = ContextLoader.getCurrentWebApplicationContext().getServletContext();
ServletContext servletContext = request.getServletContext();
Map<String, Map<Integer, String>> dictionaryMap= (Map<String, Map<Integer, String>>) servletContext.getAttribute("dictionaryMap");

//通过Types的值给Value字段赋值
for (String s : fieldNameList) {
Field types = null;
if(hasField(obj.getClass(),s)){
//判断view中有没有这个字段,有就通过反射取出字段
types= obj.getClass().getDeclaredField(s);//获取Types私有字段
}else{
//本表中没有这个字段,说明它是父表中的字段,也就是entity中的字段,从entity中取值
types=obj.getClass().getSuperclass().getDeclaredField(s);
}
Field value = obj.getClass().getDeclaredField(s.replace("Types", "Value"));//获取value私有字段
//设置权限
types.setAccessible(true);
value.setAccessible(true);

//赋值
1
2
3
4
5
6
7
8
9
10
11
12
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
        logger.debug("save方法:,,Controller:{},,haocai:{}",this.getClass().getName(),haocai.toString());

String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永远不会进入");

Wrapper<HaocaiEntity> queryWrapper = new EntityWrapper<HaocaiEntity>()
.eq("haocai_uuid_number", haocai.getHaocaiUuidNumber())
.eq("haocai_name", haocai.getHaocaiName())
.eq("haocai_types", haocai.getHaocaiTypes())
.eq("haocai_kucun_number", haocai.getHaocaiKucunNumber())
;

logger.info("sql语句:"+queryWrapper.getSqlSegment());
HaocaiEntity haocaiEntity = haocaiService.selectOne(queryWrapper);
if(haocaiEntity==null){
haocai.setInsertTime(new Date());
haocai.setCreateTime(new Date());
haocaiService.insert(haocai);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}

/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody HaocaiEntity haocai, HttpServletRequest request){
logger.debug("update方法:,,Controller:{},,haocai:{}",this.getClass().getName(),haocai.toString());

String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false)
// return R.error(511,"永远不会进入");
//根据字段查询是否有相同数据
Wrapper<HaocaiEntity> queryWrapper = new EntityWrapper<HaocaiEntity>()
.notIn("id",haocai.getId())
.andNew()
.eq("haocai_uuid_number", haocai.getHaocaiUuidNumber())
.eq("haocai_name", haocai.getHaocaiName())
.eq("haocai_types", haocai.getHaocaiTypes())
.eq("haocai_kucun_number", haocai.getHaocaiKucunNumber())
;

logger.info("sql语句:"+queryWrapper.getSqlSegment());
HaocaiEntity haocaiEntity = haocaiService.selectOne(queryWrapper);
if("".equals(haocai.getHaocaiPhoto()) || "null".equals(haocai.getHaocaiPhoto())){
haocai.setHaocaiPhoto(null);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
            e.printStackTrace();
return R.error(511,"批量插入数据异常,请联系管理员");
}
}






}




/**
* 字典
* 后端接口
1
2
3
4
5
6
7
8
9
10
11
12
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

/**
* 字典 服务实现类
*/
@Service("dictionaryService")
@Transactional
public class DictionaryServiceImpl extends ServiceImpl<DictionaryDao, DictionaryEntity> implements DictionaryService {

@Override
public PageUtils queryPage(Map<String,Object> params) {
if(params != null && (params.get("limit") == null || params.get("page") == null)){
params.put("page","1");
params.put("limit","10");
}
Page<DictionaryView> page =new Query<DictionaryView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,params));
return new PageUtils(page);
}

/**
* 赋值给字典表
* @param obj view对象
*/
public void dictionaryConvert(Object obj, HttpServletRequest request) {
try {
if (obj == null) return;
//当前view和entity中的所有types的字段
List<String> fieldNameList = new ArrayList<>();
Class tempClass = obj.getClass();
while (tempClass !=null) {
Field[] declaredFields = tempClass.getDeclaredFields();
for (Field f : declaredFields) {
f.setAccessible(true);
if (f.getType().getName().equals("java.lang.Integer") && f.getName().contains("Types")) {
fieldNameList.add(f.getName());
}
}
tempClass = tempClass.getSuperclass(); //得到父类,然后赋给自己
}

// 获取监听器中的字典表
// ServletContext servletContext = ContextLoader.getCurrentWebApplicationContext().getServletContext();
ServletContext servletContext = request.getServletContext();
Map<String, Map<Integer, String>> dictionaryMap= (Map<String, Map<Integer, String>>) servletContext.getAttribute("dictionaryMap");

//通过Types的值给Value字段赋值


项目链接:
https://javayms.github.io?id=281923552708201cn
https://javayms.pages.dev?id=281923552708201cn