SSM-based home appliance repair system WeChat applet source code and paper

1. The research purpose and significance of this topic :

With the popularity of the Internet in our country, WeChat has become an indispensable communication tool in people's daily lives. According to relevant data, the average daily active users of WeChat in the first half of 2018 exceeded 1 billion. Such a huge number of users has given rise to the rapid development of WeChat mini programs. In daily life, many industries provide WeChat mini programs to make users more convenient to use.

The same home appliance repair system applet can also bring convenience to users. Traditional home appliance repair requires users to go out temporarily to find a repairman, which is very inconvenient for users who are in a hurry. And he didn't know whether the maintenance master was currently available and could come to the house for repairs. But the home appliance repair system applet is different. First of all, it does not require users to download an app and does not occupy the space and memory of the mobile phone. Secondly, you can place an order directly on the mini program and find a nearby repairman who is available to come to your home for repairs. It allows users to find maintenance technicians without leaving home. At the same time, it can make appointments for maintenance technicians to come to their homes in advance, allowing maintenance technicians to come to their homes for repairs when users are free. This small program allows users to save time and provide convenience in daily life. Users who do not usually leave home can also quickly find a repairman to come to their home, which can help many people in need.

【588】SSM-based home appliance repair system WeChat applet source code and thesis proposal report task book

  1. Literature review of this topic (no less than 1500 words)

In recent years, WeChat mini programs have developed rapidly due to the large number of WeChat users. Since the WeChat mini program was launched, many companies have been ready to take action. Because the rise of WeChat mini programs has given hope to many companies that cannot afford traditional APP development costs. For college students to start their own businesses, the cost of mini programs is also very cheap compared to APP development. As the main product promoted by WeChat, mini programs have never faded away from the public eye. Every move they make affects the hearts of Internet practitioners.

  The rise of the mobile Internet brought a wave of entrepreneurial enthusiasm. Compared with APPs, the development cost of small programs is very low, which brings opportunities to independent developers. Relying on WeChat's national-level chat tool, the flexibility of WeChat applet allows it to aggregate various services based on scenarios. The usage rate of apps on mobile phones does not exceed 40%. The characteristics of mini programs that "no need to download, can be used immediately, and run away after use" allow it to become a supplementary application to the head app and replace some low-frequency service apps. In fact, the most commonly used types of mini programs are life services and tools. Most of them are applications based on life scenarios. For general life needs, they can already meet the needs of most users.

   WeChat attaches as much importance to mini programs as it did to official accounts back then. Although it does not actively promote it, the speed of opening functions is like squeezing out toothpaste. However, according to network statistics, WeChat has officially released 41 mini program scene entrances. Souyisou, QR code, official account, LBS, mini program system entrance, etc. are the main entrance scenes for mini program traffic guidance. Functions such as linking public accounts to mini programs and inserting mini programs into articles are open, making the entrance scenarios of mini programs very rich. However, after some screening, only about 32 of them can actually be applied in life.

  The application of WeChat mini programs in various industries has greatly saved the use space of mobile phones, making customers more sticky and more dependent on WeChat. Nowadays, people's usage habits tend to be mobile, and they are heavily dependent on WeChat mini programs that have rigid needs. For some low-frequency applications, users are also looking forward to a more convenient way to replace APP. Nowadays, mini programs have achieved rapid development in various industries and have had a profound impact. As tools, mini programs developed for the purpose of low-frequency practicality are becoming more and more popular among consumers today. Taking the low-frequency tourism industry as an example, developing WeChat mini programs can not only expand the customer acquisition radius, but also extend tourism-related knowledge, improve user travel experience, and even directly use WeChat mini programs to monetize user traffic. Every node of the mobile Internet will give birth to a new business model. For small programs, the time for its growth is too short, and most people cannot see the future of small program entrepreneurship. Only pioneers can reap huge development dividends. The current layout of small programs is to seize the market.

 Next, what are the advantages of developing our home appliance repair app? Home appliances are used frequently, and problems will inevitably occur sometimes. When a malfunction occurs, a repairman needs to be found quickly to ensure the normal operation of daily life. In the past, when consumers had repair needs, they usually looked for some offline "psoriasis" advertisements or went to physical stores to find repairmen. However, these methods were extremely inefficient in terms of communication and time. And this method is not suitable for those who don’t like to go out. In daily life, it is inevitable that they don’t want to move around after returning home from work. There are also some people who have just moved and do not know the geography of the area. In this case, it is very inconvenient for them to find a repairman to come to repair their home appliances.

   To sum up, it is necessary to develop a home appliance repair app. Users can place an order and make an appointment for repair on their mobile phone without going out. The repairman can receive the order notification in real time and leave immediately after use. It does not occupy memory and is in line with the requirements of home appliance repair. Low frequency usage scenarios. What are the advantages of developing home appliance repair app?

1. Safe service, cost-effective

  Compared with small advertisements on the roadside, the maintenance platform guarantees the credibility of both supply and demand parties, with transparent prices and traceable services. The maintenance services provided by small program providers not only have strict regulations on maintenance efficiency, but also undergo strict screening in the selection of maintenance talents. There is also a word-of-mouth evaluation mechanism to protect the rights and interests of both parties.

2. Data integration to improve service levels

  In the home appliance repair app, when users place an order, they can evaluate the order and rate the repairman after completing the order. You can know which maintenance technicians have higher service levels.

3. Make a reservation in advance, no need to wait

   In the Home Appliance Repair app, users can place an order in advance and make an appointment for a technician to come and perform repairs when they are free. This can help users repair more quickly, conveniently and effectively.

4. Convenient and fast, no need to occupy memory space

   Compared with traditional apps, mini programs "do not need to be downloaded, can be used immediately, and can be used immediately after use" for users, achieving true convenience and efficiency.

【588】SSM-based home appliance repair system WeChat applet source code and thesis proposal report task book

package com.controller;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.model.Gginfo;
import com.model.Pinglun;
import com.model.Userinfo;
import com.model.Wxuser;
import com.model.Zhaopin;
import com.response.GonggaoListResponse;
import com.response.GonggaoResponse;
import com.response.LoginResponse;
import com.response.Response;
import com.response.UinfoResponse;
import com.response.WxuserListResponse;
import com.response.WxuserResponse;
import com.response.ZhaopinListResponse;
import com.response.ZhaopinResponse;
import com.service.GginfoService;
import com.service.PinglunService;
import com.service.UserinfoService;
import com.service.WxuserService;
import com.service.ZhaopinService;

@Controller
@RequestMapping(value = "/rest")
public class RestApiController {

	@Autowired
	private UserinfoService userinfoService;
	@Autowired
	private WxuserService wxuserService;
	@Autowired
	private ZhaopinService zhaopinService;
    @Autowired
    private PinglunService pinglunService;
	@Autowired
	private GginfoService gginfoService;
	/**
	 * 用户注册
	 * 
	 * @param user
	 * @return
	 */
	@RequestMapping(value = "/register", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
	@ResponseBody
	public Response register(HttpServletRequest req, Userinfo user) {
		Response sres = new Response();
		try {
			Userinfo uinfo = new Userinfo();
			
			uinfo.setTel(user.getTel());
			List<Userinfo> ulist = userinfoService.queryUserinfoList(uinfo,
					null);
			if (ulist == null || ulist.size() == 0) {
				uinfo.setScores(5d);
				userinfoService.insertUserinfo(user);
				sres.setCode(200);
			} else {
				sres.setCode(201); // 手机号已存在
			}
		} catch (Exception e) {
			sres.setCode(500);
			e.printStackTrace();
		}
		return sres;
	}

	/**
	 * 用户登录
	 * 
	 * @param user
	 * @return
	 */
	@RequestMapping(value = "/ulogin")
	@ResponseBody
	public LoginResponse ulogin(HttpServletRequest req, Userinfo user) {
		LoginResponse sres = new LoginResponse();
		try {
			int uid = 0;
			List<Userinfo> ulist = userinfoService
					.queryUserinfoList(user, null);
			if (ulist != null && ulist.size() > 0) {
				uid = ulist.get(0).getId();
				sres.setCode(200);
				sres.setOpenid(uid + "");
				sres.setName(ulist.get(0).getName());
				sres.setTel(ulist.get(0).getTel());
				sres.setUtype(ulist.get(0).getUtype());
			} else {
				sres.setCode(201);
			}
		} catch (Exception e) {
			sres.setCode(500);
			e.printStackTrace();
		}
		return sres;
	}
	
	

	/**
	 * 用户资料
	 * 
	 * @param user
	 * @return
	 */
	@RequestMapping(value = "/uinfo")
	@ResponseBody
	public UinfoResponse uinfo(HttpServletRequest req) {
		UinfoResponse sres = new UinfoResponse();
		int uid = Integer.parseInt(req.getParameter("uid"));
		try {
			Userinfo uinfo = userinfoService.queryUserinfoById(uid);
			sres.setUinfo(uinfo);
			sres.setCode(200);
		} catch (Exception e) {
			sres.setCode(500);
			e.printStackTrace();
		}
		return sres;
	}

	/**
	 * 修改个人资料
	 * 
	 * @param user
	 * @return
	 */
	@RequestMapping(value = "/updateuser")
	@ResponseBody
	public Response updateuser(HttpServletRequest req, Userinfo userinfo) {
		Response sres = new Response();
		try {
			userinfoService.updateUserinfo(userinfo);
			sres.setCode(200);
		} catch (Exception e) {
			sres.setCode(500);
			e.printStackTrace();
		}
		return sres;
	}
	
	
	/**
	 * 维修工信息列表
	 * @param req
	 * @return
	 */
	@RequestMapping(value = "/tlist")
	@ResponseBody
	public WxuserListResponse tlist(HttpServletRequest req) {
		WxuserListResponse sres = new WxuserListResponse();
		try {
			String keywords = req.getParameter("keywords");
			String orderType = req.getParameter("orderType");
			Wxuser teainfo = new Wxuser();
			teainfo.setState("通过");
			teainfo.setKeywords(keywords);
			List<Wxuser> dlist = wxuserService.queryWxuserList(teainfo, null,orderType);
			sres.setCode(200);
			sres.setDlist(dlist);
		} catch (Exception e) {
			sres.setCode(500);
			e.printStackTrace();
		}
		return sres;
	}
	/**
	 * 维修工信息详情
	 * @param req
	 * @return
	 */
	@RequestMapping(value = "/tinfo")
	@ResponseBody
	public WxuserResponse tinfo(HttpServletRequest req) {
		WxuserResponse sres = new WxuserResponse();
		try {
			 int id = Integer.parseInt(req.getParameter("id"));
			 Wxuser wxginfo = wxuserService.queryWxuserById(id);
			 Pinglun pinfo = new Pinglun();
			 pinfo.setUid(wxginfo.getUid()+"");
			 pinfo.setOtype(2);
			 List<Pinglun> plist = pinglunService.queryPinglunList(pinfo);
			 sres.setPlist(plist);
			 sres.setCode(200);
			 sres.setDinfo(wxginfo);
			 
		} catch (Exception e) {
			sres.setCode(500);
			e.printStackTrace();
		}
		return sres;
	}
	
	
	/**
	 * 自己查看维修工信息详情
	 * @param req
	 * @return
	 */
	@RequestMapping(value = "/tinfoView")
	@ResponseBody
	public WxuserResponse tinfoView(HttpServletRequest req) {
		WxuserResponse sres = new WxuserResponse();
		try {
			Wxuser teainfo = null;
			int uid = Integer.parseInt(req.getParameter("uid")==null?"0":req.getParameter("uid"));
			Wxuser tinfo = new Wxuser();
			tinfo.setUid(uid);
			List<Wxuser> tlist = wxuserService.queryWxuserList(tinfo, null);
			if(tlist!=null && tlist.size()>0){
				teainfo = tlist.get(0);
			}
			
		
			sres.setCode(200);
			sres.setDinfo(teainfo);
		} catch (Exception e) {
			sres.setCode(500);
			e.printStackTrace();
		}
		return sres;
	}
	
	
	
	
	
	/**
	 * 修改维修工信息
	 * @param req
	 * @return
	 */
	@RequestMapping(value = "/updateTinfo")
	@ResponseBody
	public Response updateTinfo(HttpServletRequest req,Wxuser wxuser) {
		Response sres = new Response();
		try {
			if(wxuser.getId()!=null){
				wxuserService.updateWxuser(wxuser);
			}else{
				wxuser.setState("待审核");
				wxuserService.insertWxuser(wxuser);
			}
			sres.setCode(200);
		} catch (Exception e) {
			sres.setCode(500);
			e.printStackTrace();
		}
		return sres;
	}
	
	
	
	
	/**
	 * 报修单列表  任务大厅
	 * @param req
	 * @return
	 */
	@RequestMapping(value = "/zplist")
	@ResponseBody
	public ZhaopinListResponse zplist(HttpServletRequest req) {
		ZhaopinListResponse sres = new ZhaopinListResponse();
		try {
			Zhaopin zinfo = new Zhaopin();
			zinfo.setState("待接单");
			String keywords = req.getParameter("keywords");
			zinfo.setKeywords(keywords);
			List<Zhaopin> dlist = zhaopinService.queryZhaopinList(zinfo, null);
			sres.setCode(200);
			sres.setDlist(dlist);
		} catch (Exception e) {
			sres.setCode(500);
			e.printStackTrace();
		}
		return sres;
	}
	
	/**
	 * 报修单详情
	 * @param req
	 * @return
	 */
	@RequestMapping(value = "/zpinfo")
	@ResponseBody
	public ZhaopinResponse zpinfo(HttpServletRequest req) {
		ZhaopinResponse sres = new ZhaopinResponse();
		try {
			int id = Integer.parseInt(req.getParameter("id"));
			Zhaopin zinfo = zhaopinService.queryZhaopinById(id);
			if(zinfo.getWuid()!=null && zinfo.getWuid()!=0){
				Wxuser wxuser = new Wxuser();
				wxuser.setUid(zinfo.getWuid());
				List<Wxuser> wxlist = wxuserService.queryWxuserList(wxuser, null);
				if(wxlist!=null && wxlist.size()>0){
					zinfo.setWxuserVO(wxlist.get(0));
				}
			}
			sres.setCode(200);
			sres.setDinfo(zinfo);
		
		} catch (Exception e) {
			sres.setCode(500);
			e.printStackTrace();
		}
		return sres;
	}
	
	
	/**
	 * 发布报修单
	 * @param req
	 * @return
	 */
	@RequestMapping(value = "/addZhaopin")
	@ResponseBody
	public Response addZhaopin(HttpServletRequest req,Zhaopin zhaopin) {
		Response sres = new Response();
		try {
			zhaopin.setState("待接单");
			zhaopin.setFbsj(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
		    zhaopinService.insertZhaopin(zhaopin);
			sres.setCode(200);
		} catch (Exception e) {
			sres.setCode(500);
			e.printStackTrace();
		}
		return sres;
	}
	
	
	/**
	 * 修改报修单
	 * @param req
	 * @return
	 */
	@RequestMapping(value = "/updateZhaopin")
	@ResponseBody
	public Response updateZhaopin(HttpServletRequest req,Zhaopin zhaopin) {
		Response sres = new Response();
		try {
			zhaopin.setFbsj(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
		    zhaopinService.updateZhaopin(zhaopin);
			sres.setCode(200);
		} catch (Exception e) {
			sres.setCode(500);
			e.printStackTrace();
		}
		return sres;
	}
	/**
	 * 删除报修单
	 * @param req
	 * @return
	 */
	@RequestMapping(value = "/delZhaopin")
	@ResponseBody
	public Response delZhaopin(HttpServletRequest req) {
		Response sres = new Response();
		try {
			int id = Integer.parseInt(req.getParameter("id"));
		    zhaopinService.deleteZhaopin(id);
			sres.setCode(200);
		} catch (Exception e) {
			sres.setCode(500);
			e.printStackTrace();
		}
		return sres;
	}
	/**
	 * 我发布的报修单
	 * @param req
	 * @return
	 */
	@RequestMapping(value = "/myzplist")
	@ResponseBody
	public ZhaopinListResponse myzplist(HttpServletRequest req) {
		ZhaopinListResponse sres = new ZhaopinListResponse();
		try {
			int uid = Integer.parseInt(req.getParameter("uid"));
		    Zhaopin zinfo = new Zhaopin();
		    zinfo.setUid(uid);
		    List<Zhaopin> dlist = zhaopinService.queryZhaopinList(zinfo, null);
			sres.setCode(200);
			sres.setDlist(dlist);
		} catch (Exception e) {
			sres.setCode(500);
			e.printStackTrace();
		}
		return sres;
	}
	
	
	/**
	 * 维修工接单
	 * @param req
	 * @return
	 */
	@RequestMapping(value = "/jiedan")
	@ResponseBody
	public Response jiedan(HttpServletRequest req) {
		Response sres = new Response();
		try {
			int id = Integer.parseInt(req.getParameter("id"));
			int uid = Integer.parseInt(req.getParameter("uid"));
			
			Wxuser wxuser = new Wxuser();
			wxuser.setUid(uid);
			List<Wxuser> wlist = wxuserService.queryWxuserList(wxuser, null);
			if(wlist!=null && wlist.size()>0){
				wxuser = wlist.get(0);
				if(wxuser.getState().equals("通过")){
					Zhaopin zinfo = zhaopinService.queryZhaopinById(id);
					zinfo.setWuid(uid);
					zinfo.setState("已接单");
					zhaopinService.updateZhaopin(zinfo);
					sres.setCode(200);
				}else{
					sres.setCode(202);
				}
			}else{
				sres.setCode(201);
			}
			
			
			
		} catch (Exception e) {
			sres.setCode(500);
			e.printStackTrace();
		}
		return sres;
	}
	
	/**
	 * 我接的维修单  维修工
	 * @param req
	 * @return
	 */
	@RequestMapping(value = "/mjdlist")
	@ResponseBody
	public ZhaopinListResponse mjdlist(HttpServletRequest req) {
		ZhaopinListResponse sres = new ZhaopinListResponse();
		try {
			int uid = Integer.parseInt(req.getParameter("uid"));
		    Zhaopin zinfo = new Zhaopin();
		    zinfo.setWuid(uid);
		    List<Zhaopin> dlist = zhaopinService.queryZhaopinList(zinfo, null);
			sres.setCode(200);
			sres.setDlist(dlist);
		} catch (Exception e) {
			sres.setCode(500);
			e.printStackTrace();
		}
		return sres;
	}
	
	
	/**
	 * 用户确认完成
	 * @param req
	 * @return
	 */
	@RequestMapping(value = "/wancheng")
	@ResponseBody
	public Response wancheng(HttpServletRequest req) {
		Response sres = new Response();
		try {
			int id = Integer.parseInt(req.getParameter("id"));
			Zhaopin zinfo = zhaopinService.queryZhaopinById(id);
			zinfo.setState("已完成");
			zhaopinService.updateZhaopin(zinfo);
			sres.setCode(200);
		} catch (Exception e) {
			sres.setCode(500);
			e.printStackTrace();
		}
		return sres;
	}
	
	
	
	
//	/**
//	 * 预约详情 用户端
//	 * @param req
//	 * @return
//	 */
//	@RequestMapping(value = "/yinfoWxuser")
//	@ResponseBody
//	public YuyueResponse yinfoWxuser(HttpServletRequest req) {
//		YuyueResponse sres = new YuyueResponse();
//		try {
//			int id = Integer.parseInt(req.getParameter("id"));
//			int uid = Integer.parseInt(req.getParameter("uid"));
//		    Yuyue yinfo = new Yuyue();
//		    yinfo.setId(id);
//		    List<Yuyue> dlist = yuyueService.queryYuyueList(yinfo, null);
//		    
//		    Pinglun pinglun = new Pinglun();
//		    pinglun.setOid(id);
//		    pinglun.setPlrid(uid+"");
//		    List<Pinglun> plist = pinglunService.queryPinglunList(pinglun);
//		    if(plist!=null && plist.size()>0 ){
//		    	pinglun = plist.get(0); 
//		    	sres.setPinfo(pinglun);
//		    	sres.setSfpj("Y");
//		    }
//		    yinfo = dlist.get(0);
//			sres.setDinfo(yinfo);
//			sres.setCode(200);
//		
//		} catch (Exception e) {
//			sres.setCode(500);
//			e.printStackTrace();
//		}
//		return sres;
//	}
//	
//	/**
//	 * 预约详情 维修工端
//	 * @param req
//	 * @return
//	 */
//	@RequestMapping(value = "/yinfoJiajiao")
//	@ResponseBody
//	public YuyueResponse yinfoJiajiao(HttpServletRequest req) {
//		YuyueResponse sres = new YuyueResponse();
//		try {
//			int id = Integer.parseInt(req.getParameter("id"));
//			int uid = Integer.parseInt(req.getParameter("uid"));
//		    Yuyue yinfo = new Yuyue();
//		    yinfo.setId(id);
//		    List<Yuyue> dlist = yuyueService.queryYuyueList(yinfo, null);
//		    
//		    Pinglun pinglun = new Pinglun();
//		    pinglun.setOid(id);
//		    pinglun.setPlrid(uid+"");
//		    List<Pinglun> plist = pinglunService.queryPinglunList(pinglun);
//		    if(plist!=null && plist.size()>0 ){
//		    	pinglun = plist.get(0); 
//		    	sres.setPinfo(pinglun);
//		    	sres.setSfpj("Y");
//		    }
//		    yinfo = dlist.get(0);
//			sres.setDinfo(yinfo);
//			sres.setCode(200);
//		
//		} catch (Exception e) {
//			sres.setCode(500);
//			e.printStackTrace();
//		}
//		return sres;
//	}
	
	 
	
	 
	
	 /**
	 * 上传文件
	 * @param user
	 * @return
	 */
    @RequestMapping(value = "/uploadFile")
    @ResponseBody
	public String uploadFile(HttpServletRequest req,HttpServletResponse res,Userinfo user){	
        String url = "";
		try
		{
		 
			FileItemFactory factory = new DiskFileItemFactory();
			// 创建文件上传处理器
			ServletFileUpload upload = new ServletFileUpload(factory);
			// 开始解析请求信息
			List items = null;
			try {
				items = upload.parseRequest(req);
			} catch (FileUploadException e) {
				e.printStackTrace();
			}
			// 对所有请求信息进行判断
			Iterator iter = items.iterator();
			while (iter.hasNext()) {
				FileItem item = (FileItem) iter.next();
				// 信息为普通的格式
				if (item.isFormField()) {
					String fieldName = item.getFieldName();
					String value = item.getString();
				 
				}
				// 信息为文件格式
				else {
					String fileName = item.getName();
				 
					int index = fileName.lastIndexOf(".");
					fileName = fileName.substring(index);
				
					String fname = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date())+fileName;
					String basePath =  req.getServletContext().getRealPath("/upload");
					String furl = "/upload/" + fname;
					File file = new File(basePath, fname);
					try {
						item.write(file);
						url = furl;
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			}
		}
		catch(Exception e)
		{
			 
			e.printStackTrace();
		}
		return url;
	}
	
    /**
	 * 评论
	 * @param user
	 * @return
	 */
    @RequestMapping(value="/pinglun")
    @ResponseBody
	public Response pinglun(HttpServletRequest req,Pinglun pinglun){	
    	Response sres = new Response();
		try
		{
			 String uid = pinglun.getPlrid();
			 Userinfo uinfo = userinfoService.queryUserinfoById(Integer.parseInt(uid));
			 pinglun.setPlr(uinfo.getName());
			 pinglun.setPlsj(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
			 pinglunService.insertPinglun(pinglun);
			 Pinglun pinfo = new Pinglun();
			 pinfo.setUid(pinglun.getUid());
			 List<Pinglun> plist = pinglunService.queryPinglunList(pinfo);
			double totalfen = 0;
			if(plist!=null && plist.size()>0){
				for (Pinglun pinglun1 : plist) {
					totalfen = totalfen+ pinglun1.getFs();
				}
				totalfen = totalfen/plist.size();
			}
			
			 int id = Integer.parseInt(pinglun.getUid());
			 Zhaopin zpinfo = zhaopinService.queryZhaopinById(pinglun.getOid());
			 zpinfo.setState("已评价");
			 zhaopinService.updateZhaopin(zpinfo);
		
			 uinfo = new Userinfo();
		     uinfo = userinfoService.queryUserinfoById(id);
			 uinfo.setScores(totalfen);
			 userinfoService.updateUserinfo(uinfo);
			 sres.setCode(200);
		}
		catch(Exception e)
		{
			sres.setCode(500);
			e.printStackTrace();
		}
		return sres;
	}
    /**
     * 公告 
     * @param response
     * @param request
     * @return
     * @throws Exception
     */
    @RequestMapping(value="/glist")
    @ResponseBody
    public GonggaoListResponse glist(HttpServletResponse response, HttpServletRequest request) throws Exception{
    	GonggaoListResponse res = new GonggaoListResponse();
    	Gginfo gonggao = new Gginfo();
    	List<Gginfo> dlist = gginfoService.queryGginfoList(gonggao, null);
    	res.setDlist(dlist);
	    return res;
	}
    
    /**
     * 公告 
     * @param response
     * @param request
     * @return
     * @throws Exception
     */
    @RequestMapping(value="/ginfo")
    @ResponseBody
    public GonggaoResponse ginfo(HttpServletResponse response, HttpServletRequest request) throws Exception{
    	GonggaoResponse res = new GonggaoResponse();
    	int id = Integer.parseInt(request.getParameter("id"));
    	Gginfo gonggao = gginfoService.queryGginfoById(id);
    	res.setDinfo(gonggao);
	    return res;
	}  

}

Guess you like

Origin blog.csdn.net/weixin_46437112/article/details/135236873