基于javaweb+mysql的ssm+maven微信小程序社区物业管理系统(java+ssm+maven+wechat)

基于javaweb+mysql的ssm+maven微信小程序社区物业管理系统(java+ssm+maven+wechat)

私信源码获取及调试交流

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

基于javaweb的SSM+Maven微信小程序社区物业管理系统(java+ssm+maven+wechat)

/SheQu

管理端:

admin 123456

小程序端:

18973675640 123456

13986544321 123456

18982673654 123456

小程序对后端的请求根路径为:http://localhost:8080/SheQu

    }

    @RequestMapping(value = "/uploadImg", method = RequestMethod.POST)
    public @ResponseBody Object uploadImg(@RequestParam("photo") MultipartFile file, HttpServletRequest request)
            throws IllegalStateException, IOException {
        Map<String, Object> map = new HashMap<String, Object>();
        String name = file.getOriginalFilename();

        String imgAbsolutePath = MyTool.SaveImg(file, MyTool.getImg(), name);
        map.put("code", 0);
        map.put("message", "上传成功");
        map.put("data", name);
        return map;
    }

    @RequestMapping(value = "/uploadContent", method = RequestMethod.POST)
    public @ResponseBody Object uploadContent(@RequestParam("file") MultipartFile file, HttpServletRequest request)
            throws IllegalStateException, IOException {
        Map<String, Object> map = new HashMap<String, Object>();
        String name = file.getOriginalFilename();

        String imgAbsolutePath = MyTool.SaveImg(file, MyTool.getXmlFile(), name);
        map.put("code", 0);
        map.put("message", "上传成功");
        map.put("data", name);
        return map;
    }
}

        if(n>0){
            return "success";
        }
        return "failure";
    }

}

@Controller
public class SurveyController {
   @Autowired
   SurveyService surveyService;

    @ResponseBody
    @RequestMapping(value = "/findAllSurveyByPage",produces="application/json;charset=UTF-8")
    public String findAllSurveyByPage(@RequestParam("limit") String limit, @RequestParam("page") String page) {
        int start = (Integer.parseInt(page) - 1)*Integer.parseInt(limit);
        int pageSize = Integer.parseInt(limit);
        List<Survey> surveys = surveyService.findAllSurveyByPage(start,pageSize);
        List<Survey> surveyAll = surveyService.findAllSurvey();
        Layui l = Layui.data(surveyAll.size(), surveys);
        String result = JSON.toJSONString(l);
        return result;
    }

    @ResponseBody
    @RequestMapping(value = "/findAllSurvey",produces="application/json;charset=UTF-8")
    public String findAllSurvey() {
        List<Survey> surveys = surveyService.findAllSurvey();
        String result = JSON.toJSONString(surveys);
            return "success";
        }
        return "failure";
    }

    @ResponseBody
    @RequestMapping(value = "/deleteSurveyById")
    public String deleteSurveyById(@RequestParam("id")String id) {
        int n = surveyService.deleteSurveyById(Integer.parseInt(id));
        if(n>0){
            return "success";
        }
        return "failure";
    }

    @ResponseBody
    @RequestMapping(value = "/updateSurveyById")
    public String updateSurveyById(@RequestBody Map map) {
        int n = surveyService.updateSurveyById(map);
        if(n>0){
            return "success";
        }
        return "failure";
    }

}

@Controller
public class MessageController {
    @Autowired
    MessageService messageService;

    @ResponseBody

@Controller
public class CommonController {
    private final Logger log =  LoggerFactory.getLogger(CommonController.class);
    @RequestMapping("/{pageName}")
    public String pathAll(@PathVariable(value="pageName") String pageName){
        return pageName;
    }

    @RequestMapping("/loginOut")
    public String loginOut(HttpSession httpSession) {
        httpSession.removeAttribute("user");
        return "redirect:/";
    }

    @RequestMapping(value = "/uploadAvatar", method = RequestMethod.POST)
    public @ResponseBody Object uploadAvatar(@RequestParam("photo") MultipartFile file, HttpServletRequest request)
            throws IllegalStateException, IOException {
        Map<String, Object> map = new HashMap<String, Object>();
        String name = file.getOriginalFilename();

        String imgAbsolutePath = MyTool.SaveImg(file, MyTool.getImg(), name);
        map.put("code", 0);
        map.put("message", "上传成功");
        map.put("data", name);
        return map;
    }

    @RequestMapping(value = "/uploadImg", method = RequestMethod.POST)
    public @ResponseBody Object uploadImg(@RequestParam("photo") MultipartFile file, HttpServletRequest request)
            throws IllegalStateException, IOException {
        Map<String, Object> map = new HashMap<String, Object>();
        String name = file.getOriginalFilename();

        String imgAbsolutePath = MyTool.SaveImg(file, MyTool.getImg(), name);
@Controller
public class MessageController {
    @Autowired
    MessageService messageService;

    @ResponseBody
    @RequestMapping(value = "/findAllMessageByPage",produces="application/json;charset=UTF-8")
    public String findAllMessageByPage(@RequestParam("limit") String limit, @RequestParam("page") String page){
        int start = (Integer.parseInt(page) - 1)*Integer.parseInt(limit);
        int pageSize = Integer.parseInt(limit);
        List<Message> message = messageService.findAllMessageByPage(start,pageSize);
        List<Message> messageAll = messageService.findAllMessage();
        Layui l = Layui.data(messageAll.size(), message);
        String result = JSON.toJSONString(l);
        return result;
    }

    @ResponseBody
    @RequestMapping(value = "/insertMessage")
    public String insertMessage(@RequestBody Map map){
        Date date = new Date();
        map.put("time",date);
        System.out.println("map:"+map.toString());
        int n = messageService.insertMessage(map);
        if(n>0){
            return "success";
        }
        return "failure";
    }

    @ResponseBody
    @RequestMapping(value = "/deleteNotices")
    public String deleteNotices(@RequestParam("id") int id){
        int n = messageService.deleteNotices(id);
        if(n>0){
            return "success";
        }
        return "failure";
    }

    @ResponseBody
    @RequestMapping(value = "/updateMessage")
    public String updateMessage(@RequestBody Map map){
        Date date = new Date();
        map.put("time",date);
        System.out.println("map:"+map.toString());
        int n = messageService.updateMessage(map);

@Controller
public class SurveyController {
   @Autowired
   SurveyService surveyService;

    @ResponseBody
    @RequestMapping(value = "/findAllSurveyByPage",produces="application/json;charset=UTF-8")
    public String findAllSurveyByPage(@RequestParam("limit") String limit, @RequestParam("page") String page) {
        int start = (Integer.parseInt(page) - 1)*Integer.parseInt(limit);
        int pageSize = Integer.parseInt(limit);
        List<Survey> surveys = surveyService.findAllSurveyByPage(start,pageSize);
        List<Survey> surveyAll = surveyService.findAllSurvey();
        Layui l = Layui.data(surveyAll.size(), surveys);
        String result = JSON.toJSONString(l);
        return result;
    }

    @ResponseBody
    @RequestMapping(value = "/findAllSurvey",produces="application/json;charset=UTF-8")
    public String findAllSurvey() {
        List<Survey> surveys = surveyService.findAllSurvey();
        String result = JSON.toJSONString(surveys);
        return result;
    }

    public String findAllChoiceByPage(@RequestParam("limit") String limit, @RequestParam("page") String page) {
        int start = (Integer.parseInt(page) - 1)*Integer.parseInt(limit);
        int pageSize = Integer.parseInt(limit);
        List<Choice> choices = choiceService.findAllChoiceByPage(start,pageSize);
        List<Choice> choicesAll = choiceService.findAllChoice();
        Layui l = Layui.data(choicesAll.size(), choices);
        String result = JSON.toJSONString(l);
        return result;
    }

    @ResponseBody
    @RequestMapping(value = "/deleteChoiceById")
    public String deleteChoiceById(@RequestParam("id")String id) {
        int n = choiceService.deleteChoiceById(Integer.parseInt(id));
        if(n>0){
            return "success";
        }
        return "failure";
    }

    @ResponseBody
    @RequestMapping(value = "/insertChoice")
    public String insertChoice(@RequestBody Map map) {
        int n = choiceService.insertChoice(map);
        if(n>0){
            return "success";
        }
        return "failure";
    }

    @ResponseBody
    @RequestMapping(value = "/updateChoiceById")
    public String updateChoiceById(@RequestBody Map map) {
        int n = choiceService.updateChoiceById(map);
        if(n>0){
            return "success";
        }
        return "failure";
    }

    @ResponseBody
    @RequestMapping(value = "/findAllUserSurQueAndOptByPage",produces="application/json;charset=UTF-8")
    public String findAllUserSurQueAndOptByPage(@RequestParam("limit") String limit, @RequestParam("page") String page) {
        int start = (Integer.parseInt(page) - 1)*Integer.parseInt(limit);
        int pageSize = Integer.parseInt(limit);
        List<Choice> choices = choiceService.findAllUserSurQueAndOptByPage(start,pageSize);
        List<Choice> choiceAll = choiceService.findAllChoice();
        Layui l = Layui.data(choiceAll.size(), choices);
        String result = JSON.toJSONString(l);
        return result;
    }


/**
 * @Description: 表格工具类
 */
public class POIUtil {
    public static void exportExcel(List<?> list, String title, String sheetName, Class<?> pojoClass, String fileName, boolean isCreateHeader, HttpServletResponse response) {
        ExportParams exportParams = new ExportParams(title, sheetName);
        exportParams.setCreateHeadRows(isCreateHeader);
        defaultExport(list, pojoClass, fileName, response, exportParams);

    }

    public static void exportExcel(List<?> list, String title, String sheetName, Class<?> pojoClass, String fileName, HttpServletResponse response) {
        defaultExport(list, pojoClass, fileName, response, new ExportParams(title, sheetName));
    }

    public static void exportExcel(List<Map<String, Object>> list, String fileName, HttpServletResponse response) {
        defaultExport(list, fileName, response);
    }

    private static void defaultExport(List<?> list, Class<?> pojoClass, String fileName, HttpServletResponse response, ExportParams exportParams) {
        Workbook workbook = ExcelExportUtil.exportExcel(exportParams, pojoClass, list);
        if (workbook != null) ;
        downLoadExcel(fileName, response, workbook);
    }

    private static void downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook) {
        try {
            response.setCharacterEncoding("UTF-8");
            response.setHeader("content-Type", "application/vnd.ms-excel");
            response.setHeader("Content-Disposition",
                    "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
            workbook.write(response.getOutputStream());
        } catch (IOException e) {
            throw new RuntimeException(e.getMessage());
        }
    }
    }
}

@Controller
public class ChoiceController {
   @Autowired
   ChoiceService choiceService;

    @ResponseBody
    @RequestMapping(value = "/findAllChoiceByPage",produces="application/json;charset=UTF-8")
    public String findAllChoiceByPage(@RequestParam("limit") String limit, @RequestParam("page") String page) {
        int start = (Integer.parseInt(page) - 1)*Integer.parseInt(limit);
        int pageSize = Integer.parseInt(limit);
        List<Choice> choices = choiceService.findAllChoiceByPage(start,pageSize);
        List<Choice> choicesAll = choiceService.findAllChoice();
        Layui l = Layui.data(choicesAll.size(), choices);
        String result = JSON.toJSONString(l);
        return result;
    }

    @ResponseBody

    @ResponseBody
    @RequestMapping(value = "/findAllSurvey",produces="application/json;charset=UTF-8")
    public String findAllSurvey() {
        List<Survey> surveys = surveyService.findAllSurvey();
        String result = JSON.toJSONString(surveys);
        return result;
    }

    @ResponseBody
    @RequestMapping(value = "/insertSurvey")
    public String insertSurvey(@RequestBody Map map) {
        int n = surveyService.insertSurvey(map);
        if(n>0){
            return "success";
        }
        return "failure";
    }

    @ResponseBody
    @RequestMapping(value = "/deleteSurveyById")
    public String deleteSurveyById(@RequestParam("id")String id) {
        int n = surveyService.deleteSurveyById(Integer.parseInt(id));
        if(n>0){
            return "success";
        }
        return "failure";
    }

    @ResponseBody
    @RequestMapping(value = "/updateSurveyById")
    public String updateSurveyById(@RequestBody Map map) {
        int n = surveyService.updateSurveyById(map);
        if(n>0){
            return "success";
        }
        return "failure";
    }

}

    @RequestMapping(value = "/updateGoodsById")
    public String updateGoodsById(@RequestBody Map map){
        Date date = new Date();
        map.put("publish_time",date);
        System.out.println("map:"+map.toString());
        int n = goodsService.updateGoodsById(map);
        if(n>0){
            return "success";
        }
        return "failure";
    }

    @ResponseBody
    @RequestMapping(value = "/insertGoods")
    public String insertGoods(@RequestBody Map map){
        Date date = new Date();
        map.put("publish_time",date);
        String goods_id = RandNum.getGUID();
        map.put("goods_id",goods_id);
        System.out.println("map:"+map.toString());
        int n = goodsService.insertGoods(map);
        if(n>0){
            return "success";
        }
        return "failure";
    }
}

        int pageSize = Integer.parseInt(limit);
        List<Choice> choices = choiceService.findAllChoiceByPage(start,pageSize);
        List<Choice> choicesAll = choiceService.findAllChoice();
        Layui l = Layui.data(choicesAll.size(), choices);
        String result = JSON.toJSONString(l);
        return result;
    }

    @ResponseBody
    @RequestMapping(value = "/deleteChoiceById")
    public String deleteChoiceById(@RequestParam("id")String id) {
        int n = choiceService.deleteChoiceById(Integer.parseInt(id));
        if(n>0){
            return "success";
        }
        return "failure";
    }

    @ResponseBody
    @RequestMapping(value = "/insertChoice")
    public String insertChoice(@RequestBody Map map) {
        int n = choiceService.insertChoice(map);
        if(n>0){
            return "success";
        }
        return "failure";
    }

    @ResponseBody
    @RequestMapping(value = "/updateChoiceById")
    public String updateChoiceById(@RequestBody Map map) {
        int n = choiceService.updateChoiceById(map);
        if(n>0){
            return "success";
        }
        return "failure";
    }

    @ResponseBody
    @RequestMapping(value = "/findAllUserSurQueAndOptByPage",produces="application/json;charset=UTF-8")
    public String findAllUserSurQueAndOptByPage(@RequestParam("limit") String limit, @RequestParam("page") String page) {
        int start = (Integer.parseInt(page) - 1)*Integer.parseInt(limit);
        int pageSize = Integer.parseInt(limit);
        List<Choice> choices = choiceService.findAllUserSurQueAndOptByPage(start,pageSize);
        List<Choice> choiceAll = choiceService.findAllChoice();
        Layui l = Layui.data(choiceAll.size(), choices);

@Controller
public class AdminController {
    @Autowired
    AdminService adminService;

    @ResponseBody
    @RequestMapping("/login")
    public String findOneAdmin(String account, String pwd, HttpServletRequest request ){
        HttpSession session = request.getSession(true);//新建session对象
        Admin admin = adminService.findOneAdmin(account,pwd);
        session.setAttribute("admin",admin);
        if(admin!=null){
            return "success";
        }
        return "failure";
    }

    @ResponseBody
    @RequestMapping(value = "/findAllAccount",produces="application/json;charset=UTF-8")
    public String findAllAccount(){
        List<Admin> accounts = adminService.findAllAccount();
        String result = JSON.toJSONString(accounts);
        System.out.println(result);
        return result;
    }
    @ResponseBody
    @RequestMapping(value = "/findAllAdminByPages",produces="application/json;charset=UTF-8")
    public String findAllGoodsByPages(@RequestParam("limit") String limit, @RequestParam("page") String page){
        int start = (Integer.parseInt(page) - 1)*Integer.parseInt(limit);
        int pageSize = Integer.parseInt(limit);
        List<Goods> goods = adminService.findAllAdminsByPages(start,pageSize);
        List<Goods> goodsAll = adminService.findAllAdmins();
        Layui l = Layui.data(goodsAll.size(), goods);
        String result = JSON.toJSONString(l);
        System.out.println(result);
        return result;
    }

    @ResponseBody
    public String deleteSur_QueById(@RequestParam("id")String id) {
        int n = sur_queService.deleteSur_QueById(Integer.parseInt(id));
        if(n>0){
            return "success";
        }
        return "failure";
    }

    @ResponseBody
    @RequestMapping(value = "/insertSur_Que")
    public String insertSur_Que(@RequestBody Map map) {
        int n = sur_queService.insertSur_Que(map);
        if(n>0){
            return "success";
        }
        return "failure";
    }

    @ResponseBody
    @RequestMapping(value = "/updateSur_QueById")
    public String updateSur_QueById(@RequestBody Map map) {
        Map dataMap = new HashMap();
        /*dataMap.put("id",Integer.parseInt(map.get("id").toString()));
        dataMap.put("su_id",Integer.parseInt(map.get("su_id").toString()));
        dataMap.put("qid",Integer.parseInt(map.get("qid").toString()));*/
        int n = sur_queService.updateSur_QueById(map);
        if(n>0){
            return "success";
        }
        return "failure";
    }

}

                map2.put("opt_id",cid);
            }

            choiceService.insertUserSurveyOpt(map2);
        }
        System.out.println("cgoices:"+choices);
        return "success";
    }

    @RequestMapping(value = "/findUserQueAndOpt",produces="application/json;charset=UTF-8")
    @ResponseBody
    public String findUserQueAndOpt(@RequestParam("uid") String uid){
        List list = choiceService.findUserQueAndOpt(uid);
        String result = JSON.toJSONString(list);
        System.out.println("result:"+result);
        return result;
    }
}

@Controller
public class ChoiceController {
   @Autowired
   ChoiceService choiceService;

    @ResponseBody
    @RequestMapping(value = "/findAllChoiceByPage",produces="application/json;charset=UTF-8")
    public String findAllChoiceByPage(@RequestParam("limit") String limit, @RequestParam("page") String page) {
        int start = (Integer.parseInt(page) - 1)*Integer.parseInt(limit);
        int pageSize = Integer.parseInt(limit);
        List<Choice> choices = choiceService.findAllChoiceByPage(start,pageSize);
        List<Choice> choicesAll = choiceService.findAllChoice();

@Controller
public class QueAndOpt {

    @Autowired
    ChoiceService choiceService;
    @Autowired
    QuestionService questionService;
    @Autowired
    SurveyService surveyService;

    @RequestMapping(value = "/getQueAndOpt",produces="application/json;charset=UTF-8")
    @ResponseBody
    public String getQueAndOpt(@RequestBody Map m){
        List list = new ArrayList();
        List<Question> questions = questionService.findAllQuestion(Integer.parseInt(m.get("su_id").toString()));
        for (int i=0;i<questions.size();i++){
            int qid = questions.get(i).getId();
            List<Choice> choices = choiceService.findOptOfQue(qid);
            Map map = new HashMap();
            map.put("queandopt",choices);
            list.add(map);
        }
        String result = JSON.toJSONString(list);
        return result;
    }

    @RequestMapping(value = "/getCheckedQueAndOpt",produces="application/json;charset=UTF-8")
    @ResponseBody
    public String getCheckedQueAndOpt(@RequestBody List<Choice> choices){
        for (int i=0;i<choices.size();i++){
            Map map = new HashMap();
            Map map2 = new HashMap();
            String uid = choices.get(i).getUid();
            int qid = choices.get(i).getQid();

@Controller
public class VoteApi {
    @Autowired
    VoteService voteService;

    @ResponseBody
    @RequestMapping(value = "/insertVote", method = RequestMethod.POST)
    public String insertVote(@RequestBody Map map){
        System.out.println("insertVote:"+map.toString());
        Map dataMap = new HashMap();
        dataMap.put("uid",map.get("uid"));
        dataMap.put("title",map.get("title"));
        dataMap.put("text",map.get("text"));
        dataMap.put("optionCount",map.get("optionCount"));
        List list = (List) map.get("options");
        for (int i=0;i<list.size();i++){
            HashMap m = (HashMap) list.get(i);
            dataMap.put("opt"+i,m.get("value"));
        }
        int n = voteService.insertVote(dataMap);
        if(n>0){
            return "success";
        }
        return "failure";
    }
}

        if(n>0){
            return "success";
        }
        return "failure";
    }

    @ResponseBody
    @RequestMapping(value = "/updateChoiceById")
    public String updateChoiceById(@RequestBody Map map) {
        int n = choiceService.updateChoiceById(map);
        if(n>0){
            return "success";
        }
        return "failure";
    }

    @ResponseBody
    @RequestMapping(value = "/findAllUserSurQueAndOptByPage",produces="application/json;charset=UTF-8")
    public String findAllUserSurQueAndOptByPage(@RequestParam("limit") String limit, @RequestParam("page") String page) {
        int start = (Integer.parseInt(page) - 1)*Integer.parseInt(limit);
        int pageSize = Integer.parseInt(limit);
        List<Choice> choices = choiceService.findAllUserSurQueAndOptByPage(start,pageSize);
        List<Choice> choiceAll = choiceService.findAllChoice();
        Layui l = Layui.data(choiceAll.size(), choices);
        String result = JSON.toJSONString(l);
        return result;
    }

}

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

  • 11
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

java毕业

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值