Browse Source

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	mhotel/src/com/happy/common/http/Message2.java
Administrator 2 years ago
parent
commit
96a63f10dc

+ 85 - 0
Message2.java

@@ -0,0 +1,85 @@
+package com.happy.common.http;
+
+import com.alibaba.fastjson.JSONObject;
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+import com.happy.Model.Message.Mp_template_msg;
+import java.util.HashMap;
+
+/**
+ * 公众号,推送信息,推给商家信息
+ */
+public class Message2 {
+
+    /** 小程序推送消息到公众号
+     * openid:用户小程序openid, order_num订单号,
+     *  h_type房型, live_end入住和离店日期:2023-08-02~2023-08-06
+     *  user_name:用户名, hotel_name:酒店名
+     * **/
+    public static String send(String openid,String order_num,
+                              String h_type,String live_end,
+                              String user_name,String hotel_name,String id)
+            throws Exception {
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("grant_type", "client_credential");
+        jsonObject.put("appid", "wx2fc3f45732fae5d3"); // 小程序
+        jsonObject.put("secret","7eee4a49a4470a77f9222995e8511547");
+        String msg3 = HttpsClient.sendJson2("https://api.weixin.qq.com/cgi-bin/stable_token",jsonObject);
+        Gson gson = new Gson();
+        HashMap<String, String> userMap = gson.fromJson(msg3.toString(), new TypeToken<HashMap<String, String>>() {}.getType());
+        JSONObject message = new JSONObject();
+        String token = userMap.get("access_token");
+        message.put("touser", openid);
+
+        Mp_template_msg mp_template_msg = new Mp_template_msg();
+        mp_template_msg.setAppid("wxa46ef222053a1047");  // 公众号
+        mp_template_msg.setTemplate_id("2qQLkDrxBpMcao35jONQSo8GIY6wwzFna-LLU7Q7qRM");
+        mp_template_msg.setUrl("index");
+        JSONObject jsonObject1 = new JSONObject();
+        jsonObject1.put("appid","wx2fc3f45732fae5d3");
+        jsonObject1.put("pagepath","/pages/push/push?id="+id);
+        mp_template_msg.setMiniprogram(jsonObject1);
+        // 订单号
+        JSONObject character_string1_ = new JSONObject();
+        character_string1_.put("value", order_num);
+        character_string1_.put("color", "#173177");
+        // 房型名称
+        JSONObject thing6 = new JSONObject();
+        thing6.put("value", h_type);
+        thing6.put("color", "#0000FF");
+        // 入离时间
+        JSONObject time11 = new JSONObject();
+        time11.put("value", live_end);
+        time11.put("color", "#173177");
+        // 客户名称
+        JSONObject thing10 = new JSONObject();
+        thing10.put("value", user_name);
+        thing10.put("color", "#173177");
+        // 酒店名称
+        JSONObject thing9_ = new JSONObject();
+        thing9_.put("value", hotel_name);
+        thing9_.put("color", "#173177");
+        // 封装data
+        JSONObject data = new JSONObject();
+        // 订单号
+        data.put("character_string1",character_string1_);
+        // 房型名称
+        data.put("thing6",thing6);
+        // 入离时间
+        data.put("time11",time11);
+        // 客户名称
+        data.put("thing10",thing10);
+        // 酒店名称
+        data.put("thing9",thing9_);
+        mp_template_msg.setData(data);
+        message.put("mp_template_msg",mp_template_msg);
+        return HttpsClient.sendJson("https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token="+token, message);
+    }
+
+    public static void main(String[] args) throws Exception {
+        String msg = send("oz3gK5m2JQORvn9ruKoT33TSA7Wk","2308082018488183",
+                "小三房","2023-08-08~2023-08-08",
+                "xieli测试数据","aaaa","1111");
+        System.out.println(msg);
+    }
+}

+ 3 - 3
mhotel/src/com/happy/Model/Booking.java

@@ -14,7 +14,7 @@ public class Booking {
   private String userName;//住客姓名
   private String userPhone;// 住客手机号
   private String hotelId;// 民宿id
-  private String hotelManagerId;//所属商户Id
+  private Integer hotelManagerId;//所属商户Id
   private String hotelName;// 民宿名称
   private String hotelHposition; // 民宿位置
   private String hotelHpositionWens; // 民宿经纬度
@@ -408,11 +408,11 @@ public class Booking {
     this.remake = remake;
   }
 
-  public String getHotelManagerId() {
+  public Integer getHotelManagerId() {
     return hotelManagerId;
   }
 
-  public void setHotelManagerId(String hotelManagerId) {
+  public void setHotelManagerId(Integer hotelManagerId) {
     this.hotelManagerId = hotelManagerId;
   }
 

+ 3 - 3
mhotel/src/com/happy/Model/Hotel.java

@@ -19,7 +19,7 @@ public class Hotel {
 	/**
 	 * 所属商家Id
 	 */
-	private String managerId;
+	private Integer managerId;
 
 	/**
 	 * 封面图
@@ -150,11 +150,11 @@ public class Hotel {
 		this.id = id;
 	}
 
-	public String getManagerId() {
+	public Integer getManagerId() {
 		return managerId;
 	}
 
-	public void setManagerId(String managerId) {
+	public void setManagerId(Integer managerId) {
 		this.managerId = managerId;
 	}
 

+ 3 - 3
mhotel/src/com/happy/Model/House.java

@@ -19,7 +19,7 @@ public class House {
 	/**
 	 * 所属商家Id
 	 */
-	private String managerId;
+	private Integer managerId;
 
 	/**
 	 * 房型名称
@@ -87,11 +87,11 @@ public class House {
 		this.id = id;
 	}
 
-	public String getManagerId() {
+	public Integer getManagerId() {
 		return managerId;
 	}
 
-	public void setManagerId(String managerId) {
+	public void setManagerId(Integer managerId) {
 		this.managerId = managerId;
 	}
 

+ 1 - 1
mhotel/src/com/happy/action/bookAction.java

@@ -155,7 +155,7 @@ public class bookAction extends ActionSupport implements ServletRequestAware {
             if (m > 0) {
                 //推送信息
                 if(!"".equals(sendMsg)){
-                    Message.send(user.getOpenid(),book.getOrderNum(),book.getUserName(),sendMsg,book.getCreateTime());
+                    Message.send(user.getOpenid(),book.getOrderNum(),book.getUserName(),sendMsg,book.getCreateTime().substring(0,10));
                 }
                 resultJson.put("message", msg+"成功");
                 resultJson.put("code", 200);

+ 9 - 2
mhotel/src/com/happy/action/hotelAction.java

@@ -95,7 +95,8 @@ public class hotelAction extends ActionSupport implements ServletRequestAware {
                 return null;
             }
             //保存基本信息
-            if(hotel.getId()!= null){
+            Hotel hotel1 = hotelService.getById(hotel.getId());
+            if(hotel1!= null){
                 m = hotelService.updateHotel(hotel);
             }else{
                 hotel.setId(hotelId);
@@ -158,7 +159,13 @@ public class hotelAction extends ActionSupport implements ServletRequestAware {
 
         HotelEto hotelEto = new HotelEto();
         if(adminManager!=null){
-            BeanUtils.copyProperties(adminManager,hotelEto);
+            hotelEto.setHotelName(adminManager.getHotelName());
+            hotelEto.setHotelTownship(adminManager.getHotelTownship());
+            hotelEto.setHotelTownshipName(adminManager.getHotelTownshipName());
+            hotelEto.setCorpnName(adminManager.getCorpnName());
+            hotelEto.setCorpnPhone(adminManager.getCorpnPhone());
+            hotelEto.setManagerId(adminManager.getId());
+            //hotelEto.setBankCard(adminManager.getBankCard());
         }
         if(hotel!=null){
             //获取有效民宿配置

+ 1 - 1
mhotel/src/com/happy/action/uploadAction.java

@@ -100,7 +100,7 @@ public class uploadAction extends ActionSupport implements ServletRequestAware {
             return null;
         }
         try{
-            if (!filepath.endsWith("jpg") && !myFileFileName.endsWith("png")){
+            if (!myFileFileName.endsWith("jpg") && !myFileFileName.endsWith("png")){
                 resultJson.put("code", 500);
                 resultJson.put("message", "请上传jpg或png格式文件!");
                 ResponseUtil.writeJson(ServletActionContext.getResponse(),

File diff suppressed because it is too large
+ 3 - 2
mhotel/src/com/happy/dao/impl/HotelImplDao.java


+ 1 - 1
mhotel/src/com/happy/dao/impl/HouseImplDao.java

@@ -163,7 +163,7 @@ public class HouseImplDao implements HouseDao {
 
 
     private void appendValue(House house, StringBuffer stringBuffer, MapSqlParameterSource sps){
-        if (!Func.checkNull(house.getManagerId())){
+        if (!Func.checkNull(String.valueOf(house.getManagerId()))){
             stringBuffer.append(" manager_id=:manager_id ,");
             sps.addValue("manager_id",house.getManagerId());
         }

+ 1 - 1
mhotel/src/com/happy/dao/impl/UserDaoImpl.java

@@ -14,7 +14,7 @@ import org.springframework.stereotype.Repository;
 import java.util.ArrayList;
 import java.util.List;
 
-@Repository("UsersDao")
+@Repository("UserDao")
 public class UserDaoImpl implements UserDao {
 
     @Autowired

+ 0 - 1
mhotel/src/com/happy/service/impl/AppBookImplService.java

@@ -66,7 +66,6 @@ public class AppBookImplService implements AppBookService {
         booking.setHotelConfig(hotel.getHconfig());
         booking.setHotelType(hotel.getHtype());
         booking.setHotelIsCanorder(Func.parseStr(hotel.getIsCanorder()));
-        booking.setHotelManagerId(house.getManagerId());
         booking.setHotelPhone(adminManager.getCorpnPhone());
         booking.setHotelPerson(adminManager.getCorpnName());
         booking.setLockTime(hotel.getLockTime());

+ 1 - 1
mhotel/src/com/happy/service/impl/AppHomePageImplService.java

@@ -64,7 +64,7 @@ public class AppHomePageImplService implements AppHomePageService {
         if (Func.checkNull(hotelId))
             return new Hotel();
         Hotel hotel = hotelService.getById(Func.parseInt(hotelId));
-        if (hotel == null || Func.checkNull(hotel.getManagerId()))
+        if (hotel == null || Func.checkNull(String.valueOf(hotel.getManagerId())))
             return hotel;
 
         // 数据字典写入hotel