——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明






基于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 后勤确认结果
——————————CodeStart——————————
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
| -- 饼状图 查询级联表 -- 查询字典表 -- 统计 -- 查询某个月的每个类型的订单销售数量 -- 求和 -- 查询某个月的每个类型的订单销售额 -- 查询某个字符串 -- 统计 -- 查询某个月的每个员工的订单销售数量 -- 求和 -- 查询某个月的每个员工的订单销售额 -- 查询时间 -- 统计 -- 统计每个月的订单销售数量 -- 求和 -- 查询每个月的订单销售额 */
@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 = "";
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
|
public void dictionaryConvert(Object obj, HttpServletRequest request) { try { if (obj == null) return; 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 = request.getServletContext(); Map<String, Map<Integer, String>> dictionaryMap= (Map<String, Map<Integer, String>>) servletContext.getAttribute("dictionaryMap");
for (String s : fieldNameList) { Field types = null; if(hasField(obj.getClass(),s)){ types= obj.getClass().getDeclaredField(s); }else{ types=obj.getClass().getSuperclass().getDeclaredField(s); } Field value = obj.getClass().getDeclaredField(s.replace("Types", "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"));
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); }
public void dictionaryConvert(Object obj, HttpServletRequest request) { try { if (obj == null) return; 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 = request.getServletContext(); Map<String, Map<Integer, String>> dictionaryMap= (Map<String, Map<Integer, String>>) servletContext.getAttribute("dictionaryMap");
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=281923552708201cn
https://javayms.pages.dev?id=281923552708201cn