119d9f5a6afa0d25c65778e8978fb349d97c2307.svn-base 3.09 KB
/**
 * Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.wechat.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.google.common.collect.Maps;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.modules.wechat.entity.WxOrder;
import com.thinkgem.jeesite.modules.wechat.dao.WxOrderDao;

/**
 * 微信预约Service
 * @author lzj
 * @version 2020-03-06
 */
@Service
@Transactional(readOnly = true)
public class WxOrderService extends CrudService<WxOrderDao, WxOrder> {

	public WxOrder get(String id) {
		return super.get(id);
	}
	
	public List<WxOrder> findList(WxOrder wxOrder) {
		return super.findList(wxOrder);
	}
	
	public Page<WxOrder> findPage(Page<WxOrder> page, WxOrder wxOrder) {
		return super.findPage(page, wxOrder);
	}
	
	@Transactional(readOnly = false)
	public void save(WxOrder wxOrder) {
		super.save(wxOrder);
	}
	
	@Transactional(readOnly = false)
	public void delete(WxOrder wxOrder) {
		super.delete(wxOrder);
	}
	
	

	@Transactional(readOnly = false)
	public Map rece_order(HttpServletRequest request) {
		Map map = new HashMap();
		String yyid = request.getParameter("yyid");
		String userid = request.getParameter("userid");
		String yydate = request.getParameter("yydate");
		String ywdl = request.getParameter("yylx");
		String ywxl = request.getParameter("yyxl");
		String yysjd = request.getParameter("yysjd");
		String yyrmc = request.getParameter("yyrmc");
		String yyrcode = request.getParameter("yyrcode");
		String yydh = request.getParameter("yydh");

		WxOrder eorder = getYyid(yyid);//预约id查询是否存在,存在的话不再保存
		if(eorder == null) {
		WxOrder order = new WxOrder();
		order.setUserid(userid);
		order.setYyid(yyid);
		order.setYydate(yydate);
		order.setYwdl(ywdl);
		order.setYwxl(ywxl);
		order.setYysjd(yysjd);
		order.setYyrmc(yyrmc);
		order.setYyrcode(yyrcode);
		order.setSign("0");
		order.setYydh(yydh);
		super.save(order);
		map.put("resultMsg", "预约信息成功保存");
		}else {
			map.put("resultMsg", "已存在预约信息");
		}
		return map;
		}

	private WxOrder getYyid(String yyid) {
		// TODO Auto-generated method stub
		return dao.getYyid(yyid);
	}

	@Transactional(readOnly=false)
	public Map unbindUser(HttpServletRequest request) {
		Map map = Maps.newHashMap();
		String userid = request.getParameter("userid");
		WxOrder order = new WxOrder();
		order.setUserid(userid);
		dao.deleteWx(order);
 		return map;
	}

	@Transactional(readOnly=false)
	public Map can_order(HttpServletRequest request) {
		Map map = Maps.newHashMap();
		String yyid = request.getParameter("yyid");
		WxOrder order = dao.getYyid(yyid);
		order.setSign("4");//取消
		save(order);
 		return map;
	}

	public Map update_order() {
		Map map = Maps.newHashMap();
		dao.updateYyinfo();
		return map;
	}
		
	
	
}