|
@@ -10,15 +10,18 @@ package com.zskk.shop.controller.h5;
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
+import org.apache.ibatis.annotations.Param;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.ui.Model;
|
|
import org.springframework.ui.Model;
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.zskk.shop.controller.AbstractController;
|
|
import com.zskk.shop.controller.AbstractController;
|
|
import com.zskk.shop.controller.bean.UserBean;
|
|
import com.zskk.shop.controller.bean.UserBean;
|
|
|
|
+import com.zskk.shop.dao.entry.BuyOrder;
|
|
import com.zskk.shop.dao.entry.BuyOrderItem;
|
|
import com.zskk.shop.dao.entry.BuyOrderItem;
|
|
import com.zskk.shop.dao.entry.FamilyPeople;
|
|
import com.zskk.shop.dao.entry.FamilyPeople;
|
|
import com.zskk.shop.exception.ErrorConstant;
|
|
import com.zskk.shop.exception.ErrorConstant;
|
|
@@ -26,6 +29,7 @@ import com.zskk.shop.exception.ZSKKException;
|
|
import com.zskk.shop.service.BuyOrderService;
|
|
import com.zskk.shop.service.BuyOrderService;
|
|
import com.zskk.shop.service.FamilyPeopleService;
|
|
import com.zskk.shop.service.FamilyPeopleService;
|
|
import com.zskk.shop.service.GoodService;
|
|
import com.zskk.shop.service.GoodService;
|
|
|
|
+import com.zskk.shop.utils.ToolsUtil;
|
|
|
|
|
|
@RequestMapping("/h5/appointment")
|
|
@RequestMapping("/h5/appointment")
|
|
@Controller
|
|
@Controller
|
|
@@ -59,4 +63,41 @@ public class H5AppointmentController extends AbstractController {
|
|
this.initUser(model);
|
|
this.initUser(model);
|
|
return "/h5/appointment";
|
|
return "/h5/appointment";
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @RequestMapping("save")
|
|
|
|
+ public String save(Model model, @RequestParam("bid") Long bid, @RequestParam("itemid") Long itemid,
|
|
|
|
+ @RequestParam("fid") Integer fid, @RequestParam("idcard") String idcard, @RequestParam("name") String name, @RequestParam("sex") Integer sex,
|
|
|
|
+ @RequestParam("phone") String phone, @RequestParam("birth") String birth,
|
|
|
|
+ @RequestParam("atime") String atime, @Param("extend") String extend){
|
|
|
|
+ UserBean userBean = this.getUser();
|
|
|
|
+ BuyOrder buyOrder = buyOrderService.queryBuyOrder(bid);
|
|
|
|
+ if (buyOrder == null){
|
|
|
|
+ throw new ZSKKException(ErrorConstant.PARAM_ERROR);
|
|
|
|
+ }
|
|
|
|
+ if (!buyOrder.getPayStatus().equals(BuyOrderService.PAY_STATUS_PAYED)){
|
|
|
|
+ throw new ZSKKException(ErrorConstant.PARAM_ERROR);
|
|
|
|
+ }
|
|
|
|
+ FamilyPeople people = null;
|
|
|
|
+ if (fid.equals(0)){ //新建
|
|
|
|
+ people = new FamilyPeople();
|
|
|
|
+ people.setId(0);
|
|
|
|
+ people.setAddress("");
|
|
|
|
+ people.setCtime(ToolsUtil.getNow());
|
|
|
|
+ people.setIsDel(0);
|
|
|
|
+ people.setUid(userBean.getUserid());
|
|
|
|
+ }else{
|
|
|
|
+ people = familyPeopleService.queryMyPeople(fid);
|
|
|
|
+ if (people == null){
|
|
|
|
+ throw new ZSKKException(ErrorConstant.PARAM_ERROR);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ people.setName(name);
|
|
|
|
+ people.setSex(sex);
|
|
|
|
+ people.setIdcard(idcard);
|
|
|
|
+ people.setPhone(phone);
|
|
|
|
+ people.setBirth(birth);
|
|
|
|
+ BuyOrderItem item = buyOrderService.queryItem(itemid);
|
|
|
|
+ familyPeopleService.addAppointment(userBean, people, buyOrder, item, atime, extend);
|
|
|
|
+ return "/h5/appointment_success";
|
|
|
|
+ }
|
|
}
|
|
}
|