From 6dfd2599d2e52507e018fd4c6b35d38873e48cfb Mon Sep 17 00:00:00 2001
From: wang-hao-jie <1550036656@qq.com>
Date: 星期四, 17 三月 2022 15:52:51 +0800
Subject: [PATCH] 最新版本

---
 xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/wx/IndexController.java |  112 ++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 96 insertions(+), 16 deletions(-)

diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/wx/IndexController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/wx/IndexController.java
index 284354a..2fb7607 100644
--- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/wx/IndexController.java
+++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/wx/IndexController.java
@@ -67,7 +67,7 @@
         String openid = SessionKeyOpenId.getStr("openid");
 
         if(StrUtil.isEmpty(openid)){
-            return ResultUtil.error(SessionKeyOpenId.toString());
+            return ResultUtil.error("error寰俊:"+SessionKeyOpenId.toString());
         }
 
         QueryWrapper<Customer> wrapper = new QueryWrapper<>();
@@ -95,9 +95,26 @@
     //openId锛氬井淇d
     @RequestMapping(value = "/bindWx", method = RequestMethod.POST)
     @ApiOperation(value = "寰俊缁戝畾闆跺敭璁稿彲璇�")
-    public Object bindWx(String licence,String openId){
+    public Object bindWx(String licence,String openId,String linker,String phone){
+        QueryWrapper<Customer> wrapper2 = new QueryWrapper<>();
+        wrapper2.eq("open_id",openId);
+        Customer c = iCustomerService.getOne(wrapper2);
+        if(c==null){
+
+        }else {
+            System.out.println(c.getOpenId());
+            c.setOpenId("");
+            iCustomerService.saveOrUpdate(c);
+        }
+
         QueryWrapper<Customer> wrapper = new QueryWrapper<>();
         wrapper.eq("licence",licence);
+        if(StrUtil.isNotEmpty(linker)){
+            wrapper.eq("linker",linker);
+        }
+        if(StrUtil.isNotEmpty(phone)){
+            wrapper.eq("phone",phone);
+        }
         Customer one = iCustomerService.getOne(wrapper);
         if(one==null){
             return ResultUtil.error("闆跺敭璁稿彲璇佹棤鏁�");//棣栨鐧婚檰闇�缁戝畾闆跺敭璁稿彲璇�
@@ -141,23 +158,52 @@
         wrapper2.eq("customer_id",customerId);
         wrapper2.eq("send_date",format);
         OrderTask orderTask = iOrderTaskService.getOne(wrapper2);
+        if(orderTask==null){
+            return ResultUtil.error("浠婃棩鏃犺鍗�");
+        }
         String carId = orderTask.getCarId();
         Car car = iCarService.getById(carId);
-        String[] carids = new String[1];
-        carids[0]= car.getCode();
-        String latestGps = haiKangPost.findLatestGps(carids);
-        JSONObject jsonObject = JSONUtil.parseObj(latestGps);
-        String data = jsonObject.getStr("data");
-        JSONArray objects = JSONUtil.parseArray(data);
-        JSONObject jsonObject2 = objects.getJSONObject(0);
-        Integer lng = jsonObject2.getInt("longitude");
-        Integer lat = jsonObject2.getInt("latitude");
-
-        DecimalFormat df = new DecimalFormat("#.000000");
         Map<String,Object> map = new HashMap<>();
-        map.put("lng",df.format(lng/360000.0));
-        map.put("lat",df.format(lat/360000.0));
-        map.put("content","杩樻湁3鍗曪紝棰勮10锛�22閫佽揪");
+        map.put("lng",118.167491);
+        map.put("lat",39.651253);
+        map.put("content","鏆傛棤杞﹁締鏁版嵁");
+        if(StrUtil.isEmpty(car.getCode())){
+            return ResultUtil.data(map);
+        }
+        try {
+            String[] carids = new String[1];
+            carids[0]= car.getCode();
+            String latestGps = haiKangPost.findLatestGps(carids);
+            JSONObject jsonObject = JSONUtil.parseObj(latestGps);
+            String data = jsonObject.getStr("data");
+            JSONArray objects = JSONUtil.parseArray(data);
+            JSONObject jsonObject2 = objects.getJSONObject(0);
+            Integer lng = jsonObject2.getInt("longitude");
+            Integer lat = jsonObject2.getInt("latitude");
+
+            DecimalFormat df = new DecimalFormat("#.000000");
+            map.put("lng",df.format(lng/360000.0));
+            map.put("lat",df.format(lat/360000.0));
+        }catch (Exception e){
+
+        }
+        QueryWrapper<OrderTask> wrapper = new QueryWrapper<OrderTask>();
+        wrapper.eq("area_id",orderTask.getAreaId());
+        wrapper.eq("send_date",format);
+        wrapper.eq("status",0);
+        wrapper.orderByAsc("seq");
+        List<OrderTask> list = iOrderTaskService.list(wrapper);
+
+        if(list.size()>0){
+            if(list.get(0).getSeq()<orderTask.getSeq()){
+                int i = orderTask.getSeq() - list.get(0).getSeq();
+                map.put("content","杩樻湁"+i+"鍗曪紝棰勮"+(i*5)+"鍒嗛挓鍚庨�佽揪");
+            }
+            if(list.get(0).getSeq()==orderTask.getSeq()){
+                int i = orderTask.getSeq() - list.get(0).getSeq();
+                map.put("content","棰勮5鍒嗛挓鍐呴�佽揪");
+            }
+        }
         return ResultUtil.data(map);
     }
 
@@ -166,6 +212,9 @@
     @ApiOperation(value = "鍔犳补鍔╁姏")
     public Object likes(String customerId){
         OrderTask order = getOrder(customerId);
+        if(order==null){
+            return ResultUtil.error("浠婃棩鏃犺鍗�");
+        }
         order.setLikes(1);
         iOrderTaskService.saveOrUpdate(order);
         return ResultUtil.success("鍔╁姏鎴愬姛");
@@ -247,4 +296,35 @@
         }
         return new ResultUtil<CustomerReceive>().setErrorMsg("鎿嶄綔澶辫触");
     }
+
+    //14.鑾峰彇绛炬敹浜哄垪琛�
+    @RequestMapping(value = "/getCustomerReceive", method = RequestMethod.GET)
+    @ApiOperation(value = "鑾峰彇绛炬敹浜�")
+    public Result<List<CustomerReceive>> getCustomerReceive(String customerId) {
+        PageVo page = new PageVo();
+        page.setPageSize(30);
+        page.setPageNumber(1);
+        page.setOrder("desc");
+        page.setSort("createTime");
+        QueryWrapper<CustomerReceive> wrapper = new QueryWrapper<>();
+        wrapper.eq("customer_id",customerId);
+        IPage<CustomerReceive> data = iCustomerReceiveService.page2(PageUtil.initMpPage(page),wrapper);
+        return new ResultUtil<List<CustomerReceive>>().setData(data.getRecords());
+    }
+
+    //15.鑾峰彇绛炬敹浜�
+    @RequestMapping(value = "/getCustomerReceiveById", method = RequestMethod.GET)
+    @ApiOperation(value = "鑾峰彇绛炬敹浜�")
+    public Result<CustomerReceive> getCustomerReceiveById(String customerReceiveId) {
+        CustomerReceive byId = iCustomerReceiveService.getById(customerReceiveId);
+        return new ResultUtil<CustomerReceive>().setData(byId);
+    }
+
+    //16.鍒犻櫎鎺ヨ揣浜�
+    @RequestMapping(value = "/deleteReceive", method = RequestMethod.POST)
+    @ApiOperation(value = "鍒犻櫎鎺ヨ揣浜�")
+    public Object deleteReceive(String id) {
+        iCustomerReceiveService.removeById(id);
+        return ResultUtil.success("鍒犻櫎鎴愬姛");
+    }
 }

--
Gitblit v1.9.1