|  | @@ -3,11 +3,16 @@ package com.jeeplus.modules.wexintheorder.web;
 | 
												
													
														
															|  |  import com.jeeplus.common.json.AjaxJson;
 |  |  import com.jeeplus.common.json.AjaxJson;
 | 
												
													
														
															|  |  import com.jeeplus.common.web.BaseController;
 |  |  import com.jeeplus.common.web.BaseController;
 | 
												
													
														
															|  |  import com.jeeplus.modules.sys.entity.User;
 |  |  import com.jeeplus.modules.sys.entity.User;
 | 
												
													
														
															|  | 
 |  | +import com.jeeplus.modules.wexinpackage.access.entity.WeChatUser;
 | 
												
													
														
															|  | 
 |  | +import com.jeeplus.modules.wexinpackage.access.util.access.AccessTokenUtil;
 | 
												
													
														
															|  | 
 |  | +import com.jeeplus.modules.wexinpackage.access.util.access.AddressBookUtil;
 | 
												
													
														
															|  | 
 |  | +import com.jeeplus.modules.wexinpackage.access.util.access.WeChatParamsUtil;
 | 
												
													
														
															|  |  import com.jeeplus.modules.wexintheorder.Utils.OrderUtils;
 |  |  import com.jeeplus.modules.wexintheorder.Utils.OrderUtils;
 | 
												
													
														
															|  |  import com.jeeplus.modules.wexintheorder.entity.TheLeadership;
 |  |  import com.jeeplus.modules.wexintheorder.entity.TheLeadership;
 | 
												
													
														
															|  |  import com.jeeplus.modules.wexintheorder.entity.TheOrder;
 |  |  import com.jeeplus.modules.wexintheorder.entity.TheOrder;
 | 
												
													
														
															|  |  import com.jeeplus.modules.wexintheorder.service.TheLeadershipService;
 |  |  import com.jeeplus.modules.wexintheorder.service.TheLeadershipService;
 | 
												
													
														
															|  |  import com.jeeplus.modules.wexintheorder.service.TheOrderService;
 |  |  import com.jeeplus.modules.wexintheorder.service.TheOrderService;
 | 
												
													
														
															|  | 
 |  | +import net.sf.json.JSONObject;
 | 
												
													
														
															|  |  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;
 | 
												
											
												
													
														
															|  | @@ -33,8 +38,10 @@ public class TheOrderController extends BaseController {
 | 
												
													
														
															|  |      public String getOrderForm(Model model){
 |  |      public String getOrderForm(Model model){
 | 
												
													
														
															|  |          DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
 |  |          DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
 | 
												
													
														
															|  |          String userId = "XuShuai";
 |  |          String userId = "XuShuai";
 | 
												
													
														
															|  | 
 |  | +        WeChatUser weChatUser = new WeChatUser();
 | 
												
													
														
															|  | 
 |  | +        weChatUser.setName("张三");
 | 
												
													
														
															|  |          //回显
 |  |          //回显
 | 
												
													
														
															|  | -        TheOrder userOrderEcho = getUserOrderEcho(userId);
 |  | 
 | 
												
													
														
															|  | 
 |  | +        TheOrder userOrderEcho = getUserOrderEcho("张三");
 | 
												
													
														
															|  |          //验证今天是否预定过餐
 |  |          //验证今天是否预定过餐
 | 
												
													
														
															|  |          //获取工作日 -- 第二天
 |  |          //获取工作日 -- 第二天
 | 
												
													
														
															|  |          String addOrMinusDayString = OrderUtils.getAddOrMinusDayString(1, dateFormat);
 |  |          String addOrMinusDayString = OrderUtils.getAddOrMinusDayString(1, dateFormat);
 | 
												
											
												
													
														
															|  | @@ -56,7 +63,11 @@ public class TheOrderController extends BaseController {
 | 
												
													
														
															|  |                  DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
 |  |                  DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
 | 
												
													
														
															|  |                  String userId = OrderUtils.findUserId(code);//获取useerid
 |  |                  String userId = OrderUtils.findUserId(code);//获取useerid
 | 
												
													
														
															|  |                  //回显
 |  |                  //回显
 | 
												
													
														
															|  | -                TheOrder userOrderEcho = getUserOrderEcho(userId);
 |  | 
 | 
												
													
														
															|  | 
 |  | +                //获取acton
 | 
												
													
														
															|  | 
 |  | +                String accessToken = AccessTokenUtil.getAccessToken(WeChatParamsUtil.corpId, WeChatParamsUtil.contactsSecret);
 | 
												
													
														
															|  | 
 |  | +                String user = AddressBookUtil.getUser(accessToken, userId);
 | 
												
													
														
															|  | 
 |  | +                String name = getMaps(user);
 | 
												
													
														
															|  | 
 |  | +                TheOrder userOrderEcho = getUserOrderEcho(name);
 | 
												
													
														
															|  |                  //验证今天是否预定过餐
 |  |                  //验证今天是否预定过餐
 | 
												
													
														
															|  |                  //获取工作日 -- 第二天
 |  |                  //获取工作日 -- 第二天
 | 
												
													
														
															|  |                  String addOrMinusDayString = OrderUtils.getAddOrMinusDayString(1, dateFormat);
 |  |                  String addOrMinusDayString = OrderUtils.getAddOrMinusDayString(1, dateFormat);
 | 
												
											
												
													
														
															|  | @@ -77,10 +88,10 @@ public class TheOrderController extends BaseController {
 | 
												
													
														
															|  |      }
 |  |      }
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |      //获取部门以及分管领导信息--回显FROM
 |  |      //获取部门以及分管领导信息--回显FROM
 | 
												
													
														
															|  | -    public TheOrder getUserOrderEcho(String weChatUserId){
 |  | 
 | 
												
													
														
															|  | 
 |  | +    public TheOrder getUserOrderEcho(String name){
 | 
												
													
														
															|  |          TheOrder theOrder = new TheOrder();
 |  |          TheOrder theOrder = new TheOrder();
 | 
												
													
														
															|  |          //查询用户
 |  |          //查询用户
 | 
												
													
														
															|  | -        User user = theLeadershipService.findUser(weChatUserId);
 |  | 
 | 
												
													
														
															|  | 
 |  | +        User user = theLeadershipService.findUser(name);
 | 
												
													
														
															|  |          String userId = user.getId();//获取用户id
 |  |          String userId = user.getId();//获取用户id
 | 
												
													
														
															|  |          //获取用户user
 |  |          //获取用户user
 | 
												
													
														
															|  |          //添加回显对象
 |  |          //添加回显对象
 | 
												
											
												
													
														
															|  | @@ -220,4 +231,15 @@ public class TheOrderController extends BaseController {
 | 
												
													
														
															|  |              theOrder.setSpecific("");
 |  |              theOrder.setSpecific("");
 | 
												
													
														
															|  |          }
 |  |          }
 | 
												
													
														
															|  |      }
 |  |      }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    public String getMaps(String sMsg){
 | 
												
													
														
															|  | 
 |  | +        String name = "";
 | 
												
													
														
															|  | 
 |  | +        JSONObject jsonObject = JSONObject.fromObject(sMsg);
 | 
												
													
														
															|  | 
 |  | +        try {
 | 
												
													
														
															|  | 
 |  | +            name = jsonObject.getString("name");
 | 
												
													
														
															|  | 
 |  | +        }catch (Exception e){
 | 
												
													
														
															|  | 
 |  | +            e.printStackTrace();
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        return name;
 | 
												
													
														
															|  | 
 |  | +    }
 | 
												
													
														
															|  |  }
 |  |  }
 |