Explorar o código

微信消息分城市

huan.wang %!s(int64=6) %!d(string=hai) anos
pai
achega
0afac1d0c2

+ 6 - 6
src/main/java/com/ygj/yuemum/controller/global/WeChatInfoController.java

@@ -32,20 +32,20 @@ public class WeChatInfoController {
     public String getWxDecrypt(@RequestParam("encrypData") String encrypData, @RequestParam("ivData") String ivData, @RequestParam("openid") String openid) {
         return saveWeChatInfo.getWxDecrypt(encrypData,ivData,openid);
     }
-    @GetMapping("/WXSendOrderMessage")
+    @GetMapping("/WXSendOrderMessage") //设备租赁
     public int WXSendOrderMessage(@RequestParam("orderno") String orderno,@RequestParam("total") String total,@RequestParam("date") String date) throws IOException {
         return saveWeChatInfo.WXSendOrderMessage(orderno,total,date);
     }
 
-    @GetMapping("/WXSendYSOrderMessage")
-    public int WXSendYSOrderMessage(@RequestParam("orderno") String orderno,@RequestParam("total") String total,@RequestParam("date") String date,@RequestParam("type") String type) throws IOException {
-        return saveWeChatInfo.WXSendYSOrderMessage(orderno,total,date,type);
+    @GetMapping("/WXSendYSOrderMessage")//订单
+    public int WXSendYSOrderMessage(@RequestParam("orderno") String orderno,@RequestParam("od_cityid") Integer od_cityid,@RequestParam("total") String total,@RequestParam("date") String date,@RequestParam("type") String type) throws IOException {
+        return saveWeChatInfo.WXSendYSOrderMessage(orderno,od_cityid,total,date,type);
     }
-    @PostMapping("/WXSendBookingMessage")
+    @PostMapping("/WXSendBookingMessage") //预约
     public int WXSendBookingMessage(@ModelAttribute CustomerBooking customerBooking) throws IOException {
         return saveWeChatInfo.WXSendBookingMessage(customerBooking);
     }
-    @GetMapping("/WXSendExtractMessage")
+    @GetMapping("/WXSendExtractMessage") //提现
     public int WXSendExtractMessage(@RequestParam("wue_applysum") String wue_applysum,@RequestParam("wue_phone") String wue_phone,@RequestParam("wue_bank_card") String wue_bank_card,@RequestParam("wue_account_name") String wue_account_name) throws IOException {
         return saveWeChatInfo.WXSendExtractMessage(wue_applysum,wue_phone,wue_bank_card,wue_account_name);
     }

+ 24 - 0
src/main/java/com/ygj/yuemum/controller/wxmini/WXDianpingController.java

@@ -58,6 +58,25 @@ public class WXDianpingController {
         return 1;
     }
 
+
+
+    @RequestMapping(value = "/updateWXDianPing", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
+    @ResponseBody
+    public int updateWXDianPing(@RequestParam Map<String, Object> jsonParam) {
+        WXDianPing wxDianPing = JSON.parseObject(JSON.toJSONString(jsonParam), WXDianPing.class);
+        JSONArray imageLists = JSONArray.parseArray(wxDianPing.getImage_list());
+        wxDianPingImagesService.deleteWXDianPingImage(wxDianPing.getId());
+        for (int i = 0; i < imageLists.size(); i++) {
+            WXDianPingImages wxDianPingImages = new WXDianPingImages();
+            wxDianPingImages.setWd_id(wxDianPing.getId());
+            wxDianPingImages.setWdi_image_path(imageLists.getString(i));
+            wxDianPingImagesService.insertWXDianPingImages(wxDianPingImages);
+        }
+        wxDianPingService.updateWXDianPing(wxDianPing);
+        return 1;
+    }
+
+
     @PostMapping("/queryWXDianPings")
     public String queryWXDianPings(@ModelAttribute WXDianPing wxDianPing) {
         Map<String, Object> orderTemps = wxDianPingService.queryWXDianPings(wxDianPing);
@@ -126,4 +145,9 @@ public class WXDianpingController {
         return 1;
     }
 
+    @PostMapping("/getWXDianPingsByID")
+    public WXDianPing getWXDianPingsByID(@RequestParam("id") Integer id) {
+        return  wxDianPingService.getWXDianPingsByID(id);
+    }
+
 }

+ 2 - 2
src/main/java/com/ygj/yuemum/controller/wxmini/WXDianpingImagesController.java

@@ -4,7 +4,7 @@ package com.ygj.yuemum.controller.wxmini;
 import com.ygj.yuemum.domain.wxmini.WXDianPingImages;
 import com.ygj.yuemum.service.wxmini.WXDianPingImagesService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -16,7 +16,7 @@ public class WXDianpingImagesController {
     @Autowired
     private WXDianPingImagesService wxDianPingImagesService;
 
-    @GetMapping("/getWXDianPingImages")
+    @PostMapping("/getWXDianPingImages")
     public List<WXDianPingImages> getWXDianPingImages(@RequestParam("wd_id") Integer wd_id) {
         List<WXDianPingImages> wxDianPingImages = wxDianPingImagesService.getWXDianPingImages(wd_id);
         return wxDianPingImages;

+ 33 - 0
src/main/java/com/ygj/yuemum/controller/wxmini/WXPublicController.java

@@ -0,0 +1,33 @@
+package com.ygj.yuemum.controller.wxmini;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.ygj.yuemum.domain.wxmini.WXPublic;
+import com.ygj.yuemum.service.wxmini.WXPublicService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Map;
+
+@RestController
+public class WXPublicController {
+
+    @Autowired
+    private WXPublicService wxPublicService;
+
+    @PostMapping("/getWXPublics")
+    public String getWXPublics(@RequestParam("limit") Integer limit,@RequestParam("page") Integer page) {
+        Map<String, Object> orderTemps = wxPublicService.getWXPublics(limit,page);
+        String jso = JSONObject.toJSONString(orderTemps);
+        return jso;
+    }
+
+    @PostMapping("/updateWXPublic")
+    public int updateWXPublic(@ModelAttribute WXPublic wxPublic) {
+        return wxPublicService.updateWXPublic(wxPublic);
+    }
+}

+ 2 - 0
src/main/java/com/ygj/yuemum/dao/wxmini/WXDianPingDao.java

@@ -16,6 +16,8 @@ public interface WXDianPingDao {
 
     List<WXDianPing> queryWXDianPings(WXDianPing wxDianPing);
 
+    WXDianPing getWXDianPingsByID(Integer id);
+
     int deleteWXDianPing(Integer id);
 
     int getDianPingID();

+ 18 - 0
src/main/java/com/ygj/yuemum/dao/wxmini/WXPublicDao.java

@@ -0,0 +1,18 @@
+package com.ygj.yuemum.dao.wxmini;
+
+import com.ygj.yuemum.domain.wxmini.WXPublic;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface WXPublicDao {
+
+    List<WXPublic> getWXPublics();
+
+    int updateWXPublic(WXPublic wxPublic);
+
+    List<WXPublic> getOpenidsByCityCode(Integer wp_issend);
+
+
+}

+ 121 - 112
src/main/java/com/ygj/yuemum/domain/customer/CustomerBooking.java

@@ -1,113 +1,122 @@
-package com.ygj.yuemum.domain.customer;
-
-public class CustomerBooking {
-
-    private Integer id;
-    private String bk_phone;
-    private String bk_duedate;
-    private String bk_date;
-    private Integer bk_type;
-    private String bk_desc;
-    private String eh_code;
-    private String bk_introducer_phone;
-    private String bk_introducer_consultant;
-    private Integer limit;
-    private Integer page;
-    private String bk_typedesc;
-
-    public String getBk_introducer_phone() {
-        return bk_introducer_phone;
-    }
-
-    public void setBk_introducer_phone(String bk_introducer_phone) {
-        this.bk_introducer_phone = bk_introducer_phone;
-    }
-
-    public String getBk_introducer_consultant() {
-        return bk_introducer_consultant;
-    }
-
-    public void setBk_introducer_consultant(String bk_introducer_consultant) {
-        this.bk_introducer_consultant = bk_introducer_consultant;
-    }
-
-    public String getBk_typedesc() {
-        return bk_typedesc;
-    }
-
-    public void setBk_typedesc(String bk_typedesc) {
-        this.bk_typedesc = bk_typedesc;
-    }
-
-    public Integer getLimit() {
-        return limit;
-    }
-
-    public void setLimit(Integer limit) {
-        this.limit = limit;
-    }
-
-    public Integer getPage() {
-        return page;
-    }
-
-    public void setPage(Integer page) {
-        this.page = page;
-    }
-
-    public String getEh_code() {
-        return eh_code;
-    }
-
-    public void setEh_code(String eh_code) {
-        this.eh_code = eh_code;
-    }
-
-    public Integer getId() {
-        return id;
-    }
-
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    public String getBk_phone() {
-        return bk_phone;
-    }
-
-    public void setBk_phone(String bk_phone) {
-        this.bk_phone = bk_phone;
-    }
-
-    public String getBk_duedate() {
-        return bk_duedate;
-    }
-
-    public void setBk_duedate(String bk_duedate) {
-        this.bk_duedate = bk_duedate;
-    }
-
-    public String getBk_date() {
-        return bk_date;
-    }
-
-    public void setBk_date(String bk_date) {
-        this.bk_date = bk_date;
-    }
-
-    public Integer getBk_type() {
-        return bk_type;
-    }
-
-    public void setBk_type(Integer bk_type) {
-        this.bk_type = bk_type;
-    }
-
-    public String getBk_desc() {
-        return bk_desc;
-    }
-
-    public void setBk_desc(String bk_desc) {
-        this.bk_desc = bk_desc;
-    }
+package com.ygj.yuemum.domain.customer;
+
+public class CustomerBooking {
+
+    private Integer id;
+    private String bk_phone;
+    private String bk_duedate;
+    private String bk_date;
+    private Integer bk_type;
+    private String bk_desc;
+    private String eh_code;
+    private String bk_introducer_phone;
+    private String bk_introducer_consultant;
+    private String bk_typedesc;
+    private Integer bk_branches_id;
+    private Integer limit;
+    private Integer page;
+
+    public Integer getBk_branches_id() {
+        return bk_branches_id;
+    }
+
+    public void setBk_branches_id(Integer bk_branches_id) {
+        this.bk_branches_id = bk_branches_id;
+    }
+
+    public String getBk_introducer_phone() {
+        return bk_introducer_phone;
+    }
+
+    public void setBk_introducer_phone(String bk_introducer_phone) {
+        this.bk_introducer_phone = bk_introducer_phone;
+    }
+
+    public String getBk_introducer_consultant() {
+        return bk_introducer_consultant;
+    }
+
+    public void setBk_introducer_consultant(String bk_introducer_consultant) {
+        this.bk_introducer_consultant = bk_introducer_consultant;
+    }
+
+    public String getBk_typedesc() {
+        return bk_typedesc;
+    }
+
+    public void setBk_typedesc(String bk_typedesc) {
+        this.bk_typedesc = bk_typedesc;
+    }
+
+    public Integer getLimit() {
+        return limit;
+    }
+
+    public void setLimit(Integer limit) {
+        this.limit = limit;
+    }
+
+    public Integer getPage() {
+        return page;
+    }
+
+    public void setPage(Integer page) {
+        this.page = page;
+    }
+
+    public String getEh_code() {
+        return eh_code;
+    }
+
+    public void setEh_code(String eh_code) {
+        this.eh_code = eh_code;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getBk_phone() {
+        return bk_phone;
+    }
+
+    public void setBk_phone(String bk_phone) {
+        this.bk_phone = bk_phone;
+    }
+
+    public String getBk_duedate() {
+        return bk_duedate;
+    }
+
+    public void setBk_duedate(String bk_duedate) {
+        this.bk_duedate = bk_duedate;
+    }
+
+    public String getBk_date() {
+        return bk_date;
+    }
+
+    public void setBk_date(String bk_date) {
+        this.bk_date = bk_date;
+    }
+
+    public Integer getBk_type() {
+        return bk_type;
+    }
+
+    public void setBk_type(Integer bk_type) {
+        this.bk_type = bk_type;
+    }
+
+    public String getBk_desc() {
+        return bk_desc;
+    }
+
+    public void setBk_desc(String bk_desc) {
+        this.bk_desc = bk_desc;
+    }
 }

+ 0 - 13
src/main/java/com/ygj/yuemum/domain/wxmini/WXDianPing.java

@@ -1,9 +1,5 @@
 package com.ygj.yuemum.domain.wxmini;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
 public class WXDianPing {
     private Integer id;
     private String wd_username;
@@ -15,7 +11,6 @@ public class WXDianPing {
     private Integer wd_create_user;
     private String wd_create_user_name;
     private String image_list;
-    private String wd_commentShort;
     private Integer imgs;
     private Integer page;
     private Integer limit;
@@ -28,14 +23,6 @@ public class WXDianPing {
         this.imgs = imgs;
     }
 
-    public String getWd_commentShort() {
-        return wd_commentShort;
-    }
-
-    public void setWd_commentShort(String wd_commentShort) {
-        this.wd_commentShort = wd_commentShort;
-    }
-
     public String getImage_list() {
         return image_list;
     }

+ 67 - 0
src/main/java/com/ygj/yuemum/domain/wxmini/WXPublic.java

@@ -0,0 +1,67 @@
+package com.ygj.yuemum.domain.wxmini;
+
+public class WXPublic {
+    private Integer id;
+    private String wp_openid;
+    private String wp_code;
+    private String wp_date;
+    private String wp_nickname;
+    private Integer wp_issend;
+    private String wp_cityname;
+
+    public String getWp_cityname() {
+        return wp_cityname;
+    }
+
+    public void setWp_cityname(String wp_cityname) {
+        this.wp_cityname = wp_cityname;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getWp_openid() {
+        return wp_openid;
+    }
+
+    public void setWp_openid(String wp_openid) {
+        this.wp_openid = wp_openid;
+    }
+
+    public String getWp_code() {
+        return wp_code;
+    }
+
+    public void setWp_code(String wp_code) {
+        this.wp_code = wp_code;
+    }
+
+    public String getWp_date() {
+        return wp_date;
+    }
+
+    public void setWp_date(String wp_date) {
+        this.wp_date = wp_date;
+    }
+
+    public String getWp_nickname() {
+        return wp_nickname;
+    }
+
+    public void setWp_nickname(String wp_nickname) {
+        this.wp_nickname = wp_nickname;
+    }
+
+    public Integer getWp_issend() {
+        return wp_issend;
+    }
+
+    public void setWp_issend(Integer wp_issend) {
+        this.wp_issend = wp_issend;
+    }
+}

+ 90 - 104
src/main/java/com/ygj/yuemum/service/global/WeChatInfoService.java

@@ -12,9 +12,11 @@ import com.ygj.yuemum.domain.global.MiniAppInfo;
 import com.ygj.yuemum.domain.global.TemplateData;
 import com.ygj.yuemum.domain.global.WeChatInfo;
 import com.ygj.yuemum.domain.global.WechatTemplate;
+import com.ygj.yuemum.domain.wxmini.WXPublic;
 import com.ygj.yuemum.domain.wxmini.WXUser;
 import com.ygj.yuemum.service.distributionchannel.DcIntroduceLogService;
 import com.ygj.yuemum.service.distributionchannel.DcIntroducerService;
+import com.ygj.yuemum.service.wxmini.WXPublicService;
 import com.ygj.yuemum.service.wxmini.WXUserService;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.http.HttpStatus;
@@ -25,6 +27,7 @@ import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.util.EntityUtils;
+import org.omg.PortableInterceptor.INACTIVE;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -57,6 +60,8 @@ public class WeChatInfoService {
     private DcIntroduceLogService dcIntroduceLogService;
     @Autowired
     private DcIntroducerService dcIntroducerService;
+    @Autowired
+    private WXPublicService wxPublicService;
     public String APPID = Constant.APPID;
     public String APPSECRET = Constant.APPSECRET;
     public String MINIAPPID = Constant.MINIAPPID;
@@ -76,19 +81,13 @@ public class WeChatInfoService {
     String access_Token;
     String expires_in;
     String jsapi_Ticket;
-    String noncestr;
-    String timeStamp;
-    String signaTure;
     String session_key;
     String openid;
 
-    public int WXSendExtractMessage(String wue_applysum, String wue_phone, String wue_bank_card,String wue_account_name) throws IOException {
+    public int WXSendExtractMessage(String wue_applysum, String wue_phone, String wue_bank_card, String wue_account_name) throws IOException {
         ObjectMapper mapper = new ObjectMapper();
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-//        String resultToken = sendGet("http://yuesuo.yueguanjia.com/modoo-1/getWxPublicSender");
-//        Map mapToken = JSON.parseObject(resultToken);
-//        String openid = String.valueOf(mapToken.get("wp_openid"));
-        Map<String,TemplateData> mapdata = new HashMap<>();
+        Map<String, TemplateData> mapdata = new HashMap<>();
 
         WechatTemplate wechatTemplate = new WechatTemplate();
         wechatTemplate.setTemplate_id(ExtractTemplateid);
@@ -110,7 +109,7 @@ public class WeChatInfoService {
         mapdata.put("keyword2", keyword2);
 
         TemplateData keyword5 = new TemplateData();
-        keyword5.setValue("手机号:" +wue_phone+ ",收款人:"+wue_account_name+",银行卡号:" +wue_bank_card+"。请尽快处理!");
+        keyword5.setValue("手机号:" + wue_phone + ",收款人:" + wue_account_name + ",银行卡号:" + wue_bank_card + "。请尽快处理!");
         keyword5.setColor("#173177");
         mapdata.put("remark", keyword5);
 
@@ -120,7 +119,7 @@ public class WeChatInfoService {
         String result = "";
         CloseableHttpClient httpClient = HttpClients.createDefault();
         WeChatInfo weChatInfo = weChatInfoDao.getWeChatInfo();
-        HttpPost httpPost = new HttpPost(SENDMESSAGEURL+weChatInfo.getAccess_token());
+        HttpPost httpPost = new HttpPost(SENDMESSAGEURL + weChatInfo.getAccess_token());
         StringEntity stringEntity = new StringEntity(toString, ContentType.APPLICATION_JSON);
         stringEntity.setContentEncoding("utf-8");
         httpPost.setEntity(stringEntity);
@@ -135,11 +134,7 @@ public class WeChatInfoService {
 
     public int WXSendOrderMessage(String orderno, String total, String date) throws IOException {
         ObjectMapper mapper = new ObjectMapper();
-
-//        String resultToken = sendGet("http://yuesuo.yueguanjia.com/modoo-1/getWxPublicSender");
-//        Map mapToken = JSON.parseObject(resultToken);
-//        String openid = String.valueOf(mapToken.get("wp_openid"));
-        Map<String,TemplateData> mapdata = new HashMap<>();
+        Map<String, TemplateData> mapdata = new HashMap<>();
 
         WechatTemplate wechatTemplate = new WechatTemplate();
         wechatTemplate.setTemplate_id(OrderTemplateid);
@@ -175,7 +170,7 @@ public class WeChatInfoService {
         String result = "";
         CloseableHttpClient httpClient = HttpClients.createDefault();
         WeChatInfo weChatInfo = weChatInfoDao.getWeChatInfo();
-        HttpPost httpPost = new HttpPost(SENDMESSAGEURL+weChatInfo.getAccess_token());
+        HttpPost httpPost = new HttpPost(SENDMESSAGEURL + weChatInfo.getAccess_token());
         StringEntity stringEntity = new StringEntity(toString, ContentType.APPLICATION_JSON);
         stringEntity.setContentEncoding("utf-8");
         httpPost.setEntity(stringEntity);
@@ -188,17 +183,9 @@ public class WeChatInfoService {
         return 1;
     }
 
-    public int WXSendYSOrderMessage(String orderno, String total, String date,String type) throws IOException {
-        ObjectMapper mapper = new ObjectMapper();
-
-//        String resultToken = sendGet("http://yuesuo.yueguanjia.com/modoo-1/getWxPublicSender");
-//        Map mapToken = JSON.parseObject(resultToken);
-//        String openid = String.valueOf(mapToken.get("wp_openid"));
-        Map<String,TemplateData> mapdata = new HashMap<>();
-
+    public int WXSendYSOrderMessage(String orderNo, Integer od_cityID,String total, String date, String type)  {
+        Map<String, TemplateData> mapdata = new HashMap<>();
         WechatTemplate wechatTemplate = new WechatTemplate();
-        wechatTemplate.setTemplate_id(OrderTemplateid);
-        wechatTemplate.setTouser(WPOPENID);
         // 封装模板数据
         TemplateData first = new TemplateData();
         if (type.equals("2")) {
@@ -209,124 +196,121 @@ public class WeChatInfoService {
             first.setColor("#173177");
         }
         mapdata.put("first", first);
-
         TemplateData keyword1 = new TemplateData();
-        keyword1.setValue(orderno);
+        keyword1.setValue(orderNo);
         keyword1.setColor("#fc6961");
         mapdata.put("keyword1", keyword1);
-
         TemplateData keyword2 = new TemplateData();
         keyword2.setValue(total);
         keyword2.setColor("#173177");
         mapdata.put("keyword2", keyword2);
-
         TemplateData keyword3 = new TemplateData();
         keyword3.setValue(date);
         keyword3.setColor("#173177");
         mapdata.put("keyword3", keyword3);
-
         TemplateData keyword5 = new TemplateData();
         keyword5.setValue("请尽快安排顾问跟进!");
         keyword5.setColor("#173177");
         mapdata.put("remark", keyword5);
-
         wechatTemplate.setData(mapdata);
-        String toString = mapper.writeValueAsString(wechatTemplate);
-        String result = "";
-        CloseableHttpClient httpClient = HttpClients.createDefault();
-        WeChatInfo weChatInfo = weChatInfoDao.getWeChatInfo();
-        HttpPost httpPost = new HttpPost(SENDMESSAGEURL+weChatInfo.getAccess_token());
-        StringEntity stringEntity = new StringEntity(toString, ContentType.APPLICATION_JSON);
-        stringEntity.setContentEncoding("utf-8");
-        httpPost.setEntity(stringEntity);
-        CloseableHttpResponse response = httpClient.execute(httpPost);
-        if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
-            result = EntityUtils.toString(response.getEntity(), "utf-8");
-        } else {
+        wechatTemplate.setTemplate_id(OrderTemplateid);
+        try {
+            sendAction(wechatTemplate,mapdata,od_cityID);
+        }catch (Exception ex){
+            ex.printStackTrace();
             return 0;
         }
         return 1;
     }
 
 
-    public int WXSendBookingMessage(CustomerBooking customerBooking) throws IOException {
-        ObjectMapper mapper = new ObjectMapper();
-//        String resultToken = sendGet("http://yuesuo.yueguanjia.com/modoo-1/getWxPublicSender");
-//        Map mapToken = JSON.parseObject(resultToken);
-//        String openid = String.valueOf(mapToken.get("wp_openid"));
+    public int WXSendBookingMessage(CustomerBooking customerBooking) {
         WechatTemplate wechatTemplate = new WechatTemplate();
-        wechatTemplate.setTemplate_id(BookingTemplateid);
-        wechatTemplate.setTouser(WPOPENID);
-
-        Map<String,TemplateData> mapdata = new HashMap<>();
+        Map<String, TemplateData> mapData = new HashMap<>();
         // 封装模板数据
         TemplateData first = new TemplateData();
-        if(customerBooking.getBk_type().equals(4) && customerBooking.getBk_introducer_phone() != null && customerBooking.getBk_introducer_phone() != ""){
-            first.setValue("顾问预约信息!介绍人手机:"+customerBooking.getBk_introducer_phone()+",介绍人顾问:"+customerBooking.getBk_introducer_consultant()+"!");
+        if (customerBooking.getBk_type().equals(4) && customerBooking.getBk_introducer_phone() != null && customerBooking.getBk_introducer_phone() != "") {
+            first.setValue("顾问预约信息!介绍人手机:" + customerBooking.getBk_introducer_phone() + ",介绍人顾问:" + customerBooking.getBk_introducer_consultant() + "!");
             first.setColor("#173177");
-        } else if(customerBooking.getBk_type().equals(1) && customerBooking.getBk_introducer_phone() != null && customerBooking.getBk_introducer_phone() != "") {
-            first.setValue("套餐预约信息!介绍人手机:"+customerBooking.getBk_introducer_phone()+",介绍人顾问:"+customerBooking.getBk_introducer_consultant()+"!");
+        } else if (customerBooking.getBk_type().equals(1) && customerBooking.getBk_introducer_phone() != null && customerBooking.getBk_introducer_phone() != "") {
+            first.setValue("套餐预约信息!介绍人手机:" + customerBooking.getBk_introducer_phone() + ",介绍人顾问:" + customerBooking.getBk_introducer_consultant() + "!");
             first.setColor("#173177");
         } else {
             first.setValue("预约信息!");
             first.setColor("#173177");
         }
-
-        mapdata.put("first", first);
-
+        mapData.put("first", first);
         TemplateData keyword2 = new TemplateData();
         keyword2.setValue(customerBooking.getBk_phone());
         keyword2.setColor("#fc6961");
-        mapdata.put("keyword2", keyword2);
-
+        mapData.put("keyword2", keyword2);
         TemplateData keyword3 = new TemplateData();
         keyword3.setValue(customerBooking.getBk_date());
         keyword3.setColor("#173177");
-        mapdata.put("keyword3", keyword3);
-        if(customerBooking.getBk_type().equals(1)){
+        mapData.put("keyword3", keyword3);
+        if (customerBooking.getBk_type().equals(1)) {
             TemplateData keyword4 = new TemplateData();
-            keyword4.setValue("套餐预约,套餐名称:"+customerBooking.getBk_desc());
+            keyword4.setValue("套餐预约,套餐名称:" + customerBooking.getBk_desc());
             keyword4.setColor("#173177");
-            mapdata.put("keyword4", keyword4);
+            mapData.put("keyword4", keyword4);
         }
-        if(customerBooking.getBk_type().equals(4)){
+        if (customerBooking.getBk_type().equals(4)) {
             TemplateData keyword4 = new TemplateData();
-            keyword4.setValue("顾问预约,"+"预产期:"+customerBooking.getBk_duedate());
+            keyword4.setValue("顾问预约," + "预产期:" + customerBooking.getBk_duedate());
             keyword4.setColor("#173177");
-            mapdata.put("keyword4", keyword4);
+            mapData.put("keyword4", keyword4);
         }
-        if(customerBooking.getBk_type().equals(5)){
+        if (customerBooking.getBk_type().equals(5)) {
             TemplateData keyword4 = new TemplateData();
-            keyword4.setValue("设备返还预约,租赁单编号:"+customerBooking.getBk_desc());
+            keyword4.setValue("设备返还预约,租赁单编号:" + customerBooking.getBk_desc());
             keyword4.setColor("#173177");
-            mapdata.put("keyword4", keyword4);
+            mapData.put("keyword4", keyword4);
         }
-
-
         TemplateData keyword5 = new TemplateData();
         keyword5.setValue("请尽快安排跟进!");
         keyword5.setColor("#173177");
-        mapdata.put("remark", keyword5);
-
-        wechatTemplate.setData(mapdata);
-        String toString = mapper.writeValueAsString(wechatTemplate);
+        mapData.put("remark", keyword5);
+        wechatTemplate.setTemplate_id(BookingTemplateid);
 
-        String result = "";
-        CloseableHttpClient httpClient = HttpClients.createDefault();
-        WeChatInfo weChatInfo = weChatInfoDao.getWeChatInfo();
-        HttpPost httpPost = new HttpPost(SENDMESSAGEURL+weChatInfo.getAccess_token());
-        StringEntity stringEntity = new StringEntity(toString, ContentType.APPLICATION_JSON);
-        stringEntity.setContentEncoding("utf-8");
-        httpPost.setEntity(stringEntity);
-        CloseableHttpResponse response = httpClient.execute(httpPost);
-        if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
-            result = EntityUtils.toString(response.getEntity(), "utf-8");
-        } else {
+        try {
+            sendAction(wechatTemplate,mapData,customerBooking.getBk_branches_id());
+        }catch (Exception ex){
+            ex.printStackTrace();
             return 0;
         }
         return 1;
     }
 
+    public int sendAction(WechatTemplate wechatTemplate,Map<String, TemplateData> mapdata, Integer od_cityid) {
+        try {
+            ObjectMapper mapper = new ObjectMapper();
+            List<WXPublic> wxPublics = wxPublicService.getOpenidsByCityCode(od_cityid);
+            for (WXPublic wxPublic : wxPublics) {
+                wechatTemplate.setTouser(wxPublic.getWp_openid());
+                wechatTemplate.setData(mapdata);
+
+            }
+            String toString = mapper.writeValueAsString(wechatTemplate);
+            String result = "";
+            CloseableHttpClient httpClient = HttpClients.createDefault();
+            WeChatInfo weChatInfo = weChatInfoDao.getWeChatInfo();
+            HttpPost httpPost = new HttpPost(SENDMESSAGEURL + weChatInfo.getAccess_token());
+            StringEntity stringEntity = new StringEntity(toString, ContentType.APPLICATION_JSON);
+            stringEntity.setContentEncoding("utf-8");
+            httpPost.setEntity(stringEntity);
+            CloseableHttpResponse response = httpClient.execute(httpPost);
+            if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
+                result = EntityUtils.toString(response.getEntity(), "utf-8");
+            } else {
+                return 0;
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            return 0;
+        }
+        return 0;
+    }
+
     public int SaveWeChatInfo() {
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         try {
@@ -383,23 +367,23 @@ public class WeChatInfoService {
         //检查用户是否已经注册,注册返回手机号等信息,没注册返回openid作为用户名
         //新用户 insert ,没有手机返回openid 有手机返回手机号等信息
         WXUser ckeckwxUser = wxUserService.getWXUser(openid);
-        if(ckeckwxUser != null) {
+        if (ckeckwxUser != null) {
             result.put("openid", openid);
-            result.put("type","2");
-            result.put("nickName",ckeckwxUser.getXu_name());
-            result.put("phone",ckeckwxUser.getXu_phone());
+            result.put("type", "2");
+            result.put("nickName", ckeckwxUser.getXu_name());
+            result.put("phone", ckeckwxUser.getXu_phone());
         } else {
             WXUser wxUser = new WXUser();
             wxUser.setXu_openid(openid);
             wxUser.setXu_sessionkey(session_key);
-            UUID id=UUID.randomUUID();
-            String[] idd=id.toString().split("-");
-            String lsid = "YSLS"+idd[1];
+            UUID id = UUID.randomUUID();
+            String[] idd = id.toString().split("-");
+            String lsid = "YSLS" + idd[1];
             wxUser.setXu_name(lsid);
             wxUserService.insertWXUser(wxUser);
             result.put("openid", openid);
-            result.put("type","1");
-            result.put("nickName",lsid);
+            result.put("type", "1");
+            result.put("nickName", lsid);
 
         }
         //介绍人介绍用户+1 多码存多条
@@ -407,13 +391,13 @@ public class WeChatInfoService {
         dcIntroduceLog.setXul_introducer_phone(introducer);
         dcIntroduceLog.setXul_event(0);
         dcIntroduceLog.setXul_openid(openid);
-        if (introducer != null && !introducer.equals("null") && introducer != "" && introducer != " ")  {
+        if (introducer != null && !introducer.equals("null") && introducer != "" && introducer != " ") {
             int filstCheck = dcIntroduceLogService.checkFirstDILogs(dcIntroduceLog);
-            if (filstCheck ==0) {
+            if (filstCheck == 0) {
                 DcIntroducer dcIntroducer = dcIntroducerService.checkDcIntroducers(introducer);
                 if (dcIntroducer != null) {
                     // 介绍人注册用户+1
-                    dcIntroducer.setWv_people_count(dcIntroducer.getWv_people_count() + 1 );
+                    dcIntroducer.setWv_people_count(dcIntroducer.getWv_people_count() + 1);
                     dcIntroducerService.updateDcIntroducer(dcIntroducer);
                     //log 记录
                     dcIntroduceLogService.insertDcIntroduceLog(dcIntroduceLog);
@@ -522,17 +506,19 @@ public class WeChatInfoService {
         }
         return jsonStr.toString();
     }
-    public String getWxDecrypt(String encrypdata,String ivdata, String openid) {
+
+    public String getWxDecrypt(String encrypdata, String ivdata, String openid) {
         WXUser wxUser = wxUserService.getWXUser(openid);
-        String str="undefined";
+        String str = "undefined";
         try {
-            str = decrypt(encrypdata,wxUser.getXu_sessionkey(),ivdata,"UTF-8");
+            str = decrypt(encrypdata, wxUser.getXu_sessionkey(), ivdata, "UTF-8");
         } catch (Exception e) {
             System.out.println("解析手机号错误!");
             e.printStackTrace();
         }
         return str;
     }
+
     public static String decrypt(String data, String key, String iv, String encodingFormat) throws Exception {
 //        initialize();
 

+ 1 - 1
src/main/java/com/ygj/yuemum/service/order/YSOrderService.java

@@ -437,7 +437,7 @@ public class YSOrderService {
 
             }
         }catch (Exception ex) {
-            System.out.println(ex);
+            ex.printStackTrace();
             return 0;
         }
         return 1;

+ 4 - 0
src/main/java/com/ygj/yuemum/service/wxmini/WXDianPingService.java

@@ -47,4 +47,8 @@ public class WXDianPingService {
         return wxDianpingDao.getDianPingID();
     }
 
+    public WXDianPing getWXDianPingsByID(Integer id) {
+        return wxDianpingDao.getWXDianPingsByID(id);
+    }
+
 }

+ 41 - 0
src/main/java/com/ygj/yuemum/service/wxmini/WXPublicService.java

@@ -0,0 +1,41 @@
+package com.ygj.yuemum.service.wxmini;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.ygj.yuemum.dao.wxmini.WXPublicDao;
+import com.ygj.yuemum.domain.wxmini.WXDianPing;
+import com.ygj.yuemum.domain.wxmini.WXPublic;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class WXPublicService {
+
+    @Autowired
+    private WXPublicDao WXPublicDao;
+
+    public Map<String, Object> getWXPublics(Integer limit,Integer page) {
+        PageHelper.startPage(page,limit);
+        List<WXPublic> wxPublics = WXPublicDao.getWXPublics();
+        PageInfo<WXPublic> pageInfo = new PageInfo<WXPublic>(wxPublics);
+        long count = pageInfo.getTotal(); //获取总记录数
+        Map<String, Object> tableData = new HashMap<>();
+        tableData.put("items", wxPublics);
+        tableData.put("total", count);
+        return tableData;
+    }
+
+    public int updateWXPublic(WXPublic wxPublic) {
+        return WXPublicDao.updateWXPublic(wxPublic);
+    }
+
+    public List<WXPublic> getOpenidsByCityCode(Integer wp_issend) {
+        return WXPublicDao.getOpenidsByCityCode(wp_issend);
+    }
+
+
+}

+ 132 - 126
src/main/resources/mybatis/mapper/customer/CustomerBookingMapper.xml

@@ -1,127 +1,133 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="com.ygj.yuemum.dao.customer.CustomerBookingDao" >
-
-    <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.customer.CustomerBooking" >
-        <id column="id" property="id" jdbcType="INTEGER" />
-        <result column="bk_phone" property="bk_phone" jdbcType="VARCHAR" />
-        <result column="bk_duedate" property="bk_duedate" jdbcType="DATE" />
-        <result column="bk_date" property="bk_date" jdbcType="DATE" />
-        <result column="bk_type" property="bk_type" jdbcType="INTEGER" />
-        <result column="bk_desc" property="bk_desc" jdbcType="VARCHAR" />
-        <result column="bk_typedesc" property="bk_typedesc" jdbcType="VARCHAR" />
-        <result column="bk_introducer_phone" property="bk_introducer_phone" jdbcType="VARCHAR" />
-        <result column="bk_introducer_consultant" property="bk_introducer_consultant" jdbcType="VARCHAR" />
-
-    </resultMap>
-
-    <sql id="Base_Column_List" >
-        id, bk_phone,bk_duedate,bk_date,bk_type,bk_desc
-    </sql>
-    <!-- 此处添加查询信息-->
-    <select id="selectCustomerBooking" resultMap="BaseResultMap" parameterType="java.lang.String" >
-        select
-        id, bk_phone,bk_duedate,bk_date,bk_type,bk_desc,bk_introducer_phone,bk_introducer_consultant
-        from customer_booking
-        where bk_phone = #{bk_phone,jdbcType=VARCHAR}
-        order by bk_date desc
-    </select>
-
-    <select id="selectAll" resultMap="BaseResultMap" parameterType="com.ygj.yuemum.domain.customer.CustomerBooking">
-        select
-        id, bk_phone,bk_duedate,bk_date,bk_type,bk_desc,bk_introducer_phone,bk_introducer_consultant,
-        case bk_type when 1 then '套餐预约' WHEN 2 then '月嫂预约' WHEN 3 then '设备租赁' WHEN 4 then '顾问预约' WHEN 5 then '设备归还' End as bk_typedesc
-        from customer_booking
-        where 1=1
-        <if test="bk_phone != null and bk_phone != ''">
-            and bk_phone = #{bk_phone,jdbcType=INTEGER}
-        </if>
-        <if test="bk_date != null and bk_date != ''">
-            and bk_date = #{bk_date,jdbcType=INTEGER}
-        </if>
-        <if test="bk_type != null and bk_type != ''">
-            and bk_type = #{bk_type,jdbcType=INTEGER}
-        </if>
-        <if test="bk_introducer_phone != null and bk_introducer_phone != ''">
-            and bk_introducer_phone = #{bk_introducer_phone,jdbcType=INTEGER}
-        </if>
-        <if test="bk_introducer_consultant != null and bk_introducer_consultant != ''">
-            and bk_introducer_consultant like "%"#{bk_introducer_consultant,jdbcType=VARCHAR}"%"
-        </if>
-
-        <if test="bk_type != null and bk_type != ''">
-            and bk_type = #{bk_type,jdbcType=INTEGER}
-        </if>
-        <if test="bk_duedate != null and bk_duedate != ''">
-            and bk_duedate = #{bk_duedate,jdbcType=INTEGER}
-        </if>
-        order by 1 desc
-    </select>
-
-    <select id="checkBooking" resultType="java.lang.Integer" parameterType="com.ygj.yuemum.domain.customer.CustomerBooking">
-        select
-       count(1)
-        from customer_booking
-        where 1=1
-        <if test="bk_phone != null and bk_phone != ''">
-            and bk_phone = #{bk_phone,jdbcType=INTEGER}
-        </if>
-        <if test="bk_date != null and bk_date != ''">
-            and bk_date = #{bk_date,jdbcType=INTEGER}
-        </if>
-        <if test="bk_type != null and bk_type != ''">
-            and bk_type = #{bk_type,jdbcType=INTEGER}
-        </if>
-    </select>
-
-    <!-- 插入一条培训信息 -->
-    <insert id="insertCustomerBooking" parameterType="com.ygj.yuemum.domain.customer.CustomerBooking" >
-        insert into customer_booking
-        <trim prefix="(" suffix=")" suffixOverrides="," >
-            <if test="bk_phone != null" >
-                bk_phone,
-            </if>
-            <if test="bk_duedate != null" >
-                bk_duedate,
-            </if>
-            <if test="bk_date != null" >
-                bk_date,
-            </if>
-            <if test="bk_type != null" >
-                bk_type,
-            </if>
-            <if test="bk_introducer_phone != null" >
-                bk_introducer_phone,
-            </if>
-            <if test="bk_introducer_consultant != null" >
-                bk_introducer_consultant,
-            </if>
-            <if test="bk_desc != null" >
-                bk_desc
-            </if>
-        </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides="," >
-            <if test="bk_phone != null" >
-                #{bk_phone,jdbcType=VARCHAR},
-            </if>
-            <if test="bk_duedate != null" >
-                #{bk_duedate,jdbcType=DATE},
-            </if>
-            <if test="bk_date != null" >
-                #{bk_date,jdbcType=DATE},
-            </if>
-            <if test="bk_type != null" >
-                #{bk_type,jdbcType=INTEGER},
-            </if>
-            <if test="bk_introducer_phone != null" >
-                #{bk_introducer_phone,jdbcType=INTEGER},
-            </if>
-            <if test="bk_introducer_consultant != null" >
-                #{bk_introducer_consultant,jdbcType=INTEGER},
-            </if>
-            <if test="bk_desc != null" >
-                #{bk_desc,jdbcType=VARCHAR}
-            </if>
-        </trim>
-    </insert>
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.ygj.yuemum.dao.customer.CustomerBookingDao" >
+
+    <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.customer.CustomerBooking" >
+        <id column="id" property="id" jdbcType="INTEGER" />
+        <result column="bk_phone" property="bk_phone" jdbcType="VARCHAR" />
+        <result column="bk_duedate" property="bk_duedate" jdbcType="DATE" />
+        <result column="bk_date" property="bk_date" jdbcType="DATE" />
+        <result column="bk_type" property="bk_type" jdbcType="INTEGER" />
+        <result column="bk_desc" property="bk_desc" jdbcType="VARCHAR" />
+        <result column="bk_typedesc" property="bk_typedesc" jdbcType="VARCHAR" />
+        <result column="bk_introducer_phone" property="bk_introducer_phone" jdbcType="VARCHAR" />
+        <result column="bk_introducer_consultant" property="bk_introducer_consultant" jdbcType="VARCHAR" />
+        <result column="bk_branches_id" property="bk_branches_id" jdbcType="INTEGER" />
+    </resultMap>
+
+    <sql id="Base_Column_List" >
+        id, bk_phone,bk_duedate,bk_date,bk_type,bk_desc,bk_branches_id
+    </sql>
+    <!-- 此处添加查询信息-->
+    <select id="selectCustomerBooking" resultMap="BaseResultMap" parameterType="java.lang.String" >
+        select
+        id, bk_phone,bk_duedate,bk_date,bk_type,bk_desc,bk_introducer_phone,bk_introducer_consultant,bk_branches_id
+        from customer_booking
+        where bk_phone = #{bk_phone,jdbcType=VARCHAR}
+        order by bk_date desc
+    </select>
+
+    <select id="selectAll" resultMap="BaseResultMap" parameterType="com.ygj.yuemum.domain.customer.CustomerBooking">
+        select
+        id, bk_phone,bk_duedate,bk_date,bk_type,bk_desc,bk_introducer_phone,bk_introducer_consultant,bk_branches_id
+        case bk_type when 1 then '套餐预约' WHEN 2 then '月嫂预约' WHEN 3 then '设备租赁' WHEN 4 then '顾问预约' WHEN 5 then '设备归还' End as bk_typedesc
+        from customer_booking
+        where 1=1
+        <if test="bk_phone != null and bk_phone != ''">
+            and bk_phone = #{bk_phone,jdbcType=INTEGER}
+        </if>
+        <if test="bk_date != null and bk_date != ''">
+            and bk_date = #{bk_date,jdbcType=INTEGER}
+        </if>
+        <if test="bk_type != null and bk_type != ''">
+            and bk_type = #{bk_type,jdbcType=INTEGER}
+        </if>
+        <if test="bk_introducer_phone != null and bk_introducer_phone != ''">
+            and bk_introducer_phone = #{bk_introducer_phone,jdbcType=INTEGER}
+        </if>
+        <if test="bk_introducer_consultant != null and bk_introducer_consultant != ''">
+            and bk_introducer_consultant like "%"#{bk_introducer_consultant,jdbcType=VARCHAR}"%"
+        </if>
+
+        <if test="bk_type != null and bk_type != ''">
+            and bk_type = #{bk_type,jdbcType=INTEGER}
+        </if>
+        <if test="bk_duedate != null and bk_duedate != ''">
+            and bk_duedate = #{bk_duedate,jdbcType=INTEGER}
+        </if>
+        order by 1 desc
+    </select>
+
+    <select id="checkBooking" resultType="java.lang.Integer" parameterType="com.ygj.yuemum.domain.customer.CustomerBooking">
+        select
+       count(1)
+        from customer_booking
+        where 1=1
+        <if test="bk_phone != null and bk_phone != ''">
+            and bk_phone = #{bk_phone,jdbcType=INTEGER}
+        </if>
+        <if test="bk_date != null and bk_date != ''">
+            and bk_date = #{bk_date,jdbcType=INTEGER}
+        </if>
+        <if test="bk_type != null and bk_type != ''">
+            and bk_type = #{bk_type,jdbcType=INTEGER}
+        </if>
+    </select>
+
+    <!-- 插入一条培训信息 -->
+    <insert id="insertCustomerBooking" parameterType="com.ygj.yuemum.domain.customer.CustomerBooking" >
+        insert into customer_booking
+        <trim prefix="(" suffix=")" suffixOverrides="," >
+            <if test="bk_phone != null" >
+                bk_phone,
+            </if>
+            <if test="bk_duedate != null" >
+                bk_duedate,
+            </if>
+            <if test="bk_date != null" >
+                bk_date,
+            </if>
+            <if test="bk_type != null" >
+                bk_type,
+            </if>
+            <if test="bk_introducer_phone != null" >
+                bk_introducer_phone,
+            </if>
+            <if test="bk_introducer_consultant != null" >
+                bk_introducer_consultant,
+            </if>
+            <if test="bk_desc != null" >
+                bk_desc,
+            </if>
+            <if test="bk_branches_id != null" >
+                bk_branches_id
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides="," >
+            <if test="bk_phone != null" >
+                #{bk_phone,jdbcType=VARCHAR},
+            </if>
+            <if test="bk_duedate != null" >
+                #{bk_duedate,jdbcType=DATE},
+            </if>
+            <if test="bk_date != null" >
+                #{bk_date,jdbcType=DATE},
+            </if>
+            <if test="bk_type != null" >
+                #{bk_type,jdbcType=INTEGER},
+            </if>
+            <if test="bk_introducer_phone != null" >
+                #{bk_introducer_phone,jdbcType=INTEGER},
+            </if>
+            <if test="bk_introducer_consultant != null" >
+                #{bk_introducer_consultant,jdbcType=INTEGER},
+            </if>
+            <if test="bk_desc != null" >
+                #{bk_desc,jdbcType=VARCHAR},
+            </if>
+            <if test="bk_branches_id != null" >
+                #{bk_branches_id,jdbcType=INTEGER}
+            </if>
+        </trim>
+    </insert>
 </mapper>

+ 9 - 2
src/main/resources/mybatis/mapper/wxmini/WXDianPingMapper.xml

@@ -21,6 +21,14 @@
         order by id desc
     </select>
 
+    <select id="getWXDianPingsByID" resultType="com.ygj.yuemum.domain.wxmini.WXDianPing" parameterType="java.lang.Integer">
+        select
+        *
+        from wx_dianping
+        where  id = #{id,jdbcType=INTEGER}
+        order by id desc
+    </select>
+
 
     <select id="queryWXDianPings" resultType="com.ygj.yuemum.domain.wxmini.WXDianPing" parameterType="com.ygj.yuemum.domain.wxmini.WXDianPing">
         select
@@ -30,11 +38,10 @@
         wd_result,
         wd_city,
         wd_comment,
-        substring(wd_comment, 1, 10) wd_commentShort,
         DATE_FORMAT(wd_create_date,'%Y-%m-%d') wd_create_date,
         fgetuser_name(wd_create_user) wd_create_user_name,
         IFNULL(tb.tj,0) imgs
-        from wx_dianping LEFT JOIN (select wd_id,count(1) tj from wx_dianping_images GROUP BY id) tb on wx_dianping.id = tb.wd_id
+        from wx_dianping LEFT JOIN (select wd_id,count(1) tj from wx_dianping_images GROUP BY wd_id) tb on wx_dianping.id = tb.wd_id
         where 1=1
         <if test="wd_username != null and wd_username != ''">
             and wd_username like "%"#{wd_username,jdbcType=VARCHAR}"%"

+ 41 - 0
src/main/resources/mybatis/mapper/wxmini/WXPublicMapper.xml

@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.ygj.yuemum.dao.wxmini.WXPublicDao" >
+
+    <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.wxmini.WXPublic" >
+        <id column="id" property="id" jdbcType="INTEGER" />
+        <result column="wp_openid" property="wp_openid" jdbcType="VARCHAR" />
+        <result column="wp_code" property="wp_code" jdbcType="VARCHAR" />
+        <result column="wp_date" property="wp_date" jdbcType="DATE" />
+        <result column="wp_nickname" property="wp_nickname" jdbcType="VARCHAR" />
+        <result column="wp_issend" property="wp_issend" jdbcType="INTEGER" />
+    </resultMap>
+
+    <!--获取所有数据-->
+    <select id="getWXPublics" resultType="com.ygj.yuemum.domain.wxmini.WXPublic" >
+        select
+        DISTINCT wp_openid, wp_nickname,wp_issend,fgetbranches_name(wp_issend) wp_cityname
+        from wx_public
+        order by id asc
+    </select>
+
+    <update id="updateWXPublic" parameterType="com.ygj.yuemum.domain.wxmini.WXPublic" >
+        update wx_public
+        <set >
+            <if test="wp_issend != null" >
+                wp_issend = #{wp_issend,jdbcType=INTEGER}
+            </if>
+        </set>
+        where wp_openid = #{wp_openid,jdbcType=VARCHAR}
+    </update>
+
+    <select id="getOpenidsByCityCode" resultType="com.ygj.yuemum.domain.wxmini.WXPublic" parameterType="java.lang.Integer">
+        select
+        DISTINCT wp_openid, wp_nickname,wp_issend,fgetbranches_name(wp_issend) wp_cityname
+        from wx_public
+        where
+        wp_issend = #{wp_issend,jdbcType=INTEGER}
+        order by id asc
+    </select>
+
+</mapper>