Ver Fonte

`添加对快递柜的对接`

wenhongquan há 2 anos atrás
pai
commit
94866ea7a8

+ 139 - 0
ruoyi-modules/ruoyi-khy/src/main/java/org/dromara/system/controller/CommonController.java

@@ -15,6 +15,7 @@ import org.dromara.common.web.core.BaseController;
 import org.dromara.system.domain.bo.TblCarInfoBo;
 import org.dromara.system.domain.vo.TblCarInfoVo;
 import org.dromara.system.service.ITblCarDriveWarningService;
+import org.dromara.util.CabinetUtil;
 import org.dromara.util.MessageUtils;
 import org.dromara.util.YingshiHttp;
 import org.springframework.beans.factory.annotation.Value;
@@ -79,6 +80,11 @@ public class CommonController extends BaseController {
 
     }
 
+    /**
+     * 语音及LED播放
+     * @param data
+     * @return
+     */
     @PostMapping("/play")
     public Object playtts(@RequestBody Map<String,Object> data) {
 
@@ -110,4 +116,137 @@ public class CommonController extends BaseController {
 
 
     }
+
+
+    /**
+     * 通过POST请求获取指定柜子的信息。
+     *
+     * 此方法处理来自客户端的POST请求,旨在根据柜子代码获取特定柜子的详细信息。
+     * 使用路径参数{@code code}来指定具体的柜子。
+     *
+     * @param code 柜子的唯一标识代码,作为路径参数传递。
+     * @return 返回包含柜子信息的对象。具体结构取决于实现。
+     * @throws Exception 如果获取柜子信息过程中发生错误。
+     */
+    @PostMapping("/cabinet/{code}/info")
+    public Object cabinetInfo(@PathVariable String code) throws Exception {
+        return  CabinetUtil.getCabinetInfo(code);
+    }
+
+    /**
+     * 通过POST请求获取指定柜子的所有箱子的信息。
+     *
+     * 此方法处理来自客户端的POST请求,旨在根据柜子代码获取特定柜子的所有箱子的信息。
+     * 使用路径参数{@code code}来指定具体的柜子。
+     *
+     * @param code 柜子的唯一标识代码,作为路径参数传递。
+     * @return 返回包含柜子箱子信息的对象。具体结构取决于实现。
+     * @throws Exception 如果获取柜子箱子信息过程中发生错误。
+     */
+    @PostMapping("/cabinet/{code}/allbox/info")
+    public Object cabinetBoxInfo(@PathVariable String code) throws Exception {
+        return  CabinetUtil.getCabinetBoxs(code);
+    }
+
+    /**
+     * 根据时间范围获取柜子统计(body需传{"startTime":"xxx","endTime":"xxx"} xxx为日期)。
+     *
+     * 此方法处理来自客户端的POST请求,旨在根据柜子代码获取特定柜子的统计信息。
+     * 使用路径参数{@code code}来指定具体的柜子。
+     *
+     * @param code 柜子的唯一标识代码,作为路径参数传递。
+     * @return 返回包含柜子统计信息的对象。具体结构取决于实现。
+     * @throws Exception 如果获取柜子统计信息过程中发生错误。
+     */
+    @PostMapping("/cabinet/{code}/statistic")
+    public Object cabinetBoxInfo(@PathVariable String code,@RequestBody Map<String,String> data) throws Exception {
+        data = data == null?new HashMap<>():data;
+        String startTime = data.get("startTime");
+        String endTime = data.get("endTime");
+        if(startTime == null || endTime == null){
+            return R.fail("参数不完整");
+        }
+        return  CabinetUtil.getCabinetStatistics(code,startTime,endTime);
+    }
+
+    /**
+     * 打开柜子指定格子。
+     *
+     * 此方法处理来自客户端的POST请求,旨在根据柜子代码获取特定柜子的统计信息。
+     * 使用路径参数{@code code}来指定具体的柜子。
+     *
+     * @param code 柜子的唯一标识代码,作为路径参数传递。
+     * @return 返回包含柜子统计信息的对象。具体结构取决于实现。
+     * @throws Exception 如果获取柜子统计信息过程中发生错误。
+     */
+    @PostMapping("/cabinet/{code}/openlock/{lockAddress}")
+    public Object openCabinetBox(@PathVariable String code,@PathVariable String lockAddress) throws Exception {
+        return  CabinetUtil.openCabinetBoxs(code,lockAddress);
+    }
+
+    /**
+     * 打开柜子所有格子。
+     *
+     * 此方法处理来自客户端的POST请求,旨在根据柜子代码获取特定柜子的统计信息。
+     * 使用路径参数{@code code}来指定具体的柜子。
+     *
+     * @param code 柜子的唯一标识代码,作为路径参数传递。
+     * @return 返回包含柜子统计信息的对象。具体结构取决于实现。
+     * @throws Exception 如果获取柜子统计信息过程中发生错误。
+     */
+    @PostMapping("/cabinet/{code}/lock/openall")
+    public Object openCabinetAllBox(@PathVariable String code) throws Exception {
+        return  CabinetUtil.openCabinetBoxAll(code);
+    }
+
+    /**
+     * 清理柜子的格子(不打开)。
+     *
+     * 此方法处理来自客户端的POST请求,旨在根据柜子代码获取特定柜子的统计信息。
+     * 使用路径参数{@code code}来指定具体的柜子。
+     *
+     * @param code 柜子的唯一标识代码,作为路径参数传递。
+     * @return 返回包含柜子统计信息的对象。具体结构取决于实现。
+     * @throws Exception 如果获取柜子统计信息过程中发生错误。
+     */
+    @PostMapping("/cabinet/{code}/box/{boxuuid}/clear")
+    public Object clearCabinetAllBox(@PathVariable String code,@PathVariable String boxuuid) throws Exception {
+        return  CabinetUtil.clearCabinetBox(code,boxuuid);
+    }
+
+    /**
+     * 清理柜子的格子(打开)。
+     *
+     * 此方法处理来自客户端的POST请求,旨在根据柜子代码获取特定柜子的统计信息。
+     * 使用路径参数{@code code}来指定具体的柜子。
+     *
+     * @param code 柜子的唯一标识代码,作为路径参数传递。
+     * @return 返回包含柜子统计信息的对象。具体结构取决于实现。
+     * @throws Exception 如果获取柜子统计信息过程中发生错误。
+     */
+    @PostMapping("/cabinet/{code}/box/{boxuuid}/openclear")
+    public Object clearOpenCabinetAllBox(@PathVariable String code,@PathVariable String boxuuid) throws Exception {
+        return  CabinetUtil.clearCabinetBoxOpen(code,boxuuid);
+    }
+
+    /**
+     * 获取取件码。
+     *
+     * 此方法处理来自客户端的POST请求,旨在根据柜子代码获取特定柜子的统计信息。
+     * 使用路径参数{@code code}来指定具体的柜子。
+     *
+     * @param phone 手机号,作为路径参数传递。
+     * @return 返回包含柜子统计信息的对象。具体结构取决于实现。
+     * @throws Exception 如果获取柜子统计信息过程中发生错误。
+     */
+    @PostMapping("/cabinet/mobile/{phone}")
+    public Object cabinetQJM(@PathVariable String phone) throws Exception {
+        return  CabinetUtil.getQJM(phone);
+    }
+
+
+
+
+
+
 }

+ 6 - 6
ruoyi-modules/ruoyi-khy/src/main/java/org/dromara/system/controller/TblArticleController.java

@@ -39,7 +39,7 @@ public class TblArticleController extends BaseController {
     /**
      * 查询文章列表
      */
-    @SaCheckPermission("system:Article:list")
+//    @SaCheckPermission("system:Article:list")
     @GetMapping("/list")
     public TableDataInfo<TblArticleVo> list(TblArticleBo bo, PageQuery pageQuery) {
         return tblArticleService.queryPageList(bo, pageQuery);
@@ -48,7 +48,7 @@ public class TblArticleController extends BaseController {
     /**
      * 导出文章列表
      */
-    @SaCheckPermission("system:Article:export")
+//    @SaCheckPermission("system:Article:export")
     @Log(title = "文章", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     public void export(TblArticleBo bo, HttpServletResponse response) {
@@ -61,7 +61,7 @@ public class TblArticleController extends BaseController {
      *
      * @param id 主键
      */
-    @SaCheckPermission("system:Article:query")
+//    @SaCheckPermission("system:Article:query")
     @GetMapping("/{id}")
     public R<TblArticleVo> getInfo(@NotNull(message = "主键不能为空")
                                      @PathVariable Long id) {
@@ -71,7 +71,7 @@ public class TblArticleController extends BaseController {
     /**
      * 新增文章
      */
-    @SaCheckPermission("system:Article:add")
+//    @SaCheckPermission("system:Article:add")
     @Log(title = "文章", businessType = BusinessType.INSERT)
     @RepeatSubmit()
     @PostMapping()
@@ -82,7 +82,7 @@ public class TblArticleController extends BaseController {
     /**
      * 修改文章
      */
-    @SaCheckPermission("system:Article:edit")
+//    @SaCheckPermission("system:Article:edit")
     @Log(title = "文章", businessType = BusinessType.UPDATE)
     @RepeatSubmit()
     @PutMapping()
@@ -95,7 +95,7 @@ public class TblArticleController extends BaseController {
      *
      * @param ids 主键串
      */
-    @SaCheckPermission("system:Article:remove")
+//    @SaCheckPermission("system:Article:remove")
     @Log(title = "文章", businessType = BusinessType.DELETE)
     @DeleteMapping("/{ids}")
     public R<Void> remove(@NotEmpty(message = "主键不能为空")

+ 6 - 6
ruoyi-modules/ruoyi-khy/src/main/java/org/dromara/system/controller/TblMiniprogramController.java

@@ -39,7 +39,7 @@ public class TblMiniprogramController extends BaseController {
     /**
      * 查询小程序信息列表
      */
-    @SaCheckPermission("system:miniprogram:list")
+//    @SaCheckPermission("system:miniprogram:list")
     @GetMapping("/list")
     public TableDataInfo<TblMiniprogramVo> list(TblMiniprogramBo bo, PageQuery pageQuery) {
         return tblMiniprogramService.queryPageList(bo, pageQuery);
@@ -48,7 +48,7 @@ public class TblMiniprogramController extends BaseController {
     /**
      * 导出小程序信息列表
      */
-    @SaCheckPermission("system:miniprogram:export")
+//    @SaCheckPermission("system:miniprogram:export")
     @Log(title = "小程序信息", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     public void export(TblMiniprogramBo bo, HttpServletResponse response) {
@@ -61,7 +61,7 @@ public class TblMiniprogramController extends BaseController {
      *
      * @param id 主键
      */
-    @SaCheckPermission("system:miniprogram:query")
+//    @SaCheckPermission("system:miniprogram:query")
     @GetMapping("/{id}")
     public R<TblMiniprogramVo> getInfo(@NotNull(message = "主键不能为空")
                                      @PathVariable Long id) {
@@ -71,7 +71,7 @@ public class TblMiniprogramController extends BaseController {
     /**
      * 新增小程序信息
      */
-    @SaCheckPermission("system:miniprogram:add")
+//    @SaCheckPermission("system:miniprogram:add")
     @Log(title = "小程序信息", businessType = BusinessType.INSERT)
     @RepeatSubmit()
     @PostMapping()
@@ -82,7 +82,7 @@ public class TblMiniprogramController extends BaseController {
     /**
      * 修改小程序信息
      */
-    @SaCheckPermission("system:miniprogram:edit")
+//    @SaCheckPermission("system:miniprogram:edit")
     @Log(title = "小程序信息", businessType = BusinessType.UPDATE)
     @RepeatSubmit()
     @PutMapping()
@@ -95,7 +95,7 @@ public class TblMiniprogramController extends BaseController {
      *
      * @param ids 主键串
      */
-    @SaCheckPermission("system:miniprogram:remove")
+//    @SaCheckPermission("system:miniprogram:remove")
     @Log(title = "小程序信息", businessType = BusinessType.DELETE)
     @DeleteMapping("/{ids}")
     public R<Void> remove(@NotEmpty(message = "主键不能为空")

+ 1 - 1
ruoyi-modules/ruoyi-khy/src/main/java/org/dromara/system/domain/TblArticle.java

@@ -15,7 +15,7 @@ import java.io.Serial;
  */
 @Data
 @EqualsAndHashCode(callSuper = true)
-@TableName("tbl_ article")
+@TableName("tbl_article")
 public class TblArticle extends BaseEntity {
 
     @Serial

+ 1 - 0
ruoyi-modules/ruoyi-khy/src/main/java/org/dromara/system/domain/TblGoodsOrder.java

@@ -90,4 +90,5 @@ public class TblGoodsOrder extends BaseEntity {
     private String ext2;
 
 
+
 }

+ 4 - 7
ruoyi-modules/ruoyi-khy/src/main/java/org/dromara/system/domain/bo/TblArticleBo.java

@@ -24,43 +24,40 @@ public class TblArticleBo extends BaseEntity {
     /**
      * 编号
      */
-    @NotNull(message = "编号不能为空", groups = { EditGroup.class })
     private Long id;
 
     /**
      * 标题
      */
-    @NotBlank(message = "标题不能为空", groups = { AddGroup.class, EditGroup.class })
     private String title;
 
     /**
      * 副标题
      */
-    @NotBlank(message = "副标题不能为空", groups = { AddGroup.class, EditGroup.class })
     private String subTitle;
 
     /**
      * 内容
      */
-    @NotBlank(message = "内容不能为空", groups = { AddGroup.class, EditGroup.class })
+
     private String content;
 
     /**
      * 状态
      */
-    @NotNull(message = "状态不能为空", groups = { AddGroup.class, EditGroup.class })
+
     private Long status;
 
     /**
      * 扩展1
      */
-    @NotBlank(message = "扩展1不能为空", groups = { AddGroup.class, EditGroup.class })
+
     private String ext1;
 
     /**
      * 扩展2
      */
-    @NotBlank(message = "扩展2不能为空", groups = { AddGroup.class, EditGroup.class })
+
     private String ext2;
 
 

+ 0 - 8
ruoyi-modules/ruoyi-khy/src/main/java/org/dromara/system/domain/bo/TblMiniprogramBo.java

@@ -23,49 +23,41 @@ public class TblMiniprogramBo extends BaseEntity {
     /**
      * 编号
      */
-    @NotNull(message = "编号不能为空", groups = { EditGroup.class })
     private Long id;
 
     /**
      * 名称
      */
-    @NotBlank(message = "名称不能为空", groups = { AddGroup.class, EditGroup.class })
     private String name;
 
     /**
      * 图标地址
      */
-    @NotBlank(message = "图标地址不能为空", groups = { AddGroup.class, EditGroup.class })
     private String logo;
 
     /**
      * 链接
      */
-    @NotBlank(message = "链接不能为空", groups = { AddGroup.class, EditGroup.class })
     private String url;
 
     /**
      * 状态
      */
-    @NotNull(message = "状态不能为空", groups = { AddGroup.class, EditGroup.class })
     private Long status;
 
     /**
      * 描述
      */
-    @NotBlank(message = "描述不能为空", groups = { AddGroup.class, EditGroup.class })
     private String desc;
 
     /**
      * 扩展1
      */
-    @NotBlank(message = "扩展1不能为空", groups = { AddGroup.class, EditGroup.class })
     private String ext1;
 
     /**
      * 扩展2
      */
-    @NotBlank(message = "扩展2不能为空", groups = { AddGroup.class, EditGroup.class })
     private String ext2;
 
 

+ 3 - 0
ruoyi-modules/ruoyi-khy/src/main/java/org/dromara/system/domain/vo/TblGoodsOrderVo.java

@@ -109,4 +109,7 @@ public class TblGoodsOrderVo implements Serializable {
     private String ext2;
 
 
+    private Date createTime;
+
+
 }

+ 1 - 1
ruoyi-modules/ruoyi-khy/src/main/java/org/dromara/system/service/impl/TblCarScheduleServiceImpl.java

@@ -74,7 +74,7 @@ public class TblCarScheduleServiceImpl implements ITblCarScheduleService {
         Map<String, Object> params = bo.getParams();
         LambdaQueryWrapper<TblCarSchedule> lqw = Wrappers.lambdaQuery();
         lqw.eq(StringUtils.isNotBlank(bo.getPathInfo()), TblCarSchedule::getPathInfo, bo.getPathInfo());
-        lqw.eq(StringUtils.isNotBlank(bo.getCarNum()), TblCarSchedule::getCarNum, bo.getCarNum());
+        lqw.like(StringUtils.isNotBlank(bo.getCarNum()), TblCarSchedule::getCarNum, bo.getCarNum());
         lqw.eq(bo.getScheduleDate() != null, TblCarSchedule::getScheduleDate, bo.getScheduleDate());
         if(bo.getParams()!=null && bo.getParams().keySet().size()>0){
             if(bo.getParams().get("station")!=null){

+ 17 - 0
ruoyi-modules/ruoyi-khy/src/main/java/org/dromara/system/service/impl/TblGoodsOrderServiceImpl.java

@@ -80,6 +80,8 @@ public class TblGoodsOrderServiceImpl implements ITblGoodsOrderService {
         }
 
 
+
+
         lqw.eq(StringUtils.isNotBlank(bo.getGoodsWeight()), TblGoodsOrder::getGoodsWeight, bo.getGoodsWeight());
         lqw.eq(StringUtils.isNotBlank(bo.getToAddr()), TblGoodsOrder::getToAddr, bo.getToAddr());
         lqw.eq(StringUtils.isNotBlank(bo.getPayType()), TblGoodsOrder::getPayType, bo.getPayType());
@@ -96,6 +98,21 @@ public class TblGoodsOrderServiceImpl implements ITblGoodsOrderService {
                 lqw.apply(StringUtils.format(" ext1->'$.schedule_id' in {}", datasql));
 
             }
+
+            if(bo.getParams().get("start")!=null&&bo.getParams().get("end")!=null){
+                String start= bo.getParams().get("start").toString();
+                String end= bo.getParams().get("end").toString();
+                lqw.gt( TblGoodsOrder::getCreateTime, start);
+                lqw.lt( TblGoodsOrder::getCreateTime, end);
+            }
+            if(bo.getParams().get("phone")!=null){
+                String datasql = "( select user_id from sys_user where phonenumber like '%"+bo.getParams().get("phone").toString()+"%')";
+                lqw.apply(StringUtils.format(" from_user_id in {}", datasql));
+            }
+            if(bo.getParams().get("username")!=null){
+                String datasql = "( select user_id from sys_user where nick_name like '%"+bo.getParams().get("username").toString()+"%')";
+                lqw.apply(StringUtils.format(" from_user_id in {}", datasql));
+            }
         }
         return lqw;
     }

+ 169 - 0
ruoyi-modules/ruoyi-khy/src/main/java/org/dromara/util/CabinetUtil.java

@@ -0,0 +1,169 @@
+package org.dromara.util;
+
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.http.HttpRequest;
+import com.alibaba.fastjson.JSON;
+
+import javax.crypto.Cipher;
+import java.security.Key;
+import java.util.Map;
+
+public class CabinetUtil {
+
+    private  final static String appid = "bw_open_express_A8C848769E5C04E0";
+    private  final static String appkey = "5AFC6E07CFCF4A359B775D1416A9799A";
+
+    private  final static String hosts = "https://open.bestwond.com";
+
+
+    private static String byteArr2HexStr(byte[] arrB) throws Exception {
+        int iLen = arrB.length;
+        // 每个byte用两个字符才能表示,所以字符串的长度是数组长度的两倍
+        StringBuffer sb = new StringBuffer(iLen * 2);
+        for (int i = 0; i < iLen; i++) {
+            int intTmp = arrB[i];
+            // 把负数转换为正数
+            while (intTmp < 0) {
+                intTmp = intTmp + 256;
+            }
+            // 小于0F的数需要在前面补0
+            if (intTmp < 16) {
+                sb.append("0");
+            }
+            sb.append(Integer.toString(intTmp, 16));
+        }
+        return sb.toString();
+    }
+
+    private static String encrypt(String strIn) throws Exception {
+        return byteArr2HexStr(encrypt(strIn.getBytes("UTF-8")));
+    }
+
+    private static byte[] encrypt(byte[] arrB) throws Exception {
+        Key key = getKey(appkey.getBytes("UTF-8"));
+        Cipher encryptCipher = Cipher.getInstance("DES");
+        encryptCipher.init(Cipher.ENCRYPT_MODE, key);
+        return encryptCipher.doFinal(arrB);
+    }
+
+    private static Key getKey(byte[] arrBTmp) throws Exception {
+        // 创建一个空的8位字节数组(默认值为0)
+        byte[] arrB = new byte[8];
+        // 将原始字节数组转换为8位
+        for (int i = 0; i < arrBTmp.length && i < arrB.length; i++) {
+            arrB[i] = arrBTmp[i];
+        }
+        // 生成密钥
+        Key key = new javax.crypto.spec.SecretKeySpec(arrB, "DES");
+        return key;
+    }
+
+
+    // 获取柜子信息
+    public static  String getCabinetInfo(String cabinetCode) throws Exception {
+        int times = (int) (DateUtil.date().getTime()/1000);
+        String str_sign = appid + "=" + times + "=" + appid;
+        str_sign = encrypt(str_sign);
+
+        String result3= HttpRequest.post(hosts+"/kd/api/v2/action/device_info/").body(JSON.toJSONString(Map.of("device_number",cabinetCode)))
+            .addHeaders(Map.of("timestamp",times+"","Content-Type","application/json","appid",appid,"sign",str_sign))
+            .execute().body();
+        return result3;
+    }
+
+    // 获取柜子统计
+    public static String getCabinetStatistics(String cabinetCode,String startTime,String endTime) throws Exception {
+        int times = (int) (DateUtil.date().getTime()/1000);
+        String str_sign = appid + "=" + times + "=" + appid;
+        str_sign = encrypt(str_sign);
+
+        String result3= HttpRequest.post(hosts + "/kd/api/v2/action/deliver_statistics/").body(JSON.toJSONString(Map.of("device_number",cabinetCode,"strat_time",startTime,"end_time",endTime)))
+            .addHeaders(Map.of("timestamp",times+"","Content-Type","application/json","appid",appid,"sign",str_sign))
+            .execute().body();
+        return result3;
+
+    }
+
+    // 获取柜子盒子
+    public static String getCabinetBoxs(String cabinetCode) throws Exception {
+        int times = (int) (DateUtil.date().getTime()/1000);
+        String str_sign = appid + "=" + times + "=" + appid;
+        str_sign = encrypt(str_sign);
+
+        String result3= HttpRequest.post(hosts + "/kd/api/v2/action/box_info_list/").body(JSON.toJSONString(Map.of("device_number",cabinetCode)))
+            .addHeaders(Map.of("timestamp",times+"","Content-Type","application/json","appid",appid,"sign",str_sign))
+            .execute().body();
+        return result3;
+
+    }
+
+    // 开柜
+    public static String openCabinetBoxs(String cabinetCode,String lookAddr) throws Exception {
+        int times = (int) (DateUtil.date().getTime()/1000);
+        String str_sign = appid + "=" + times + "=" + appid;
+        str_sign = encrypt(str_sign);
+
+        String result3= HttpRequest.post(hosts + "/kd/api/v2/action/open_box/").body(JSON.toJSONString(Map.of("device_number",cabinetCode,"lock_address",lookAddr)))
+            .addHeaders(Map.of("timestamp",times+"","Content-Type","application/json","appid",appid,"sign",str_sign))
+            .execute().body();
+        return result3;
+
+    }
+
+    // 开所有柜
+    public static String openCabinetBoxAll(String cabinetCode) throws Exception {
+        int times = (int) (DateUtil.date().getTime()/1000);
+        String str_sign = appid + "=" + times + "=" + appid;
+        str_sign = encrypt(str_sign);
+
+        String result3= HttpRequest.post(hosts + "/kd/api/v2/action/open_box_all/").body(JSON.toJSONString(Map.of("device_number",cabinetCode)))
+            .addHeaders(Map.of("timestamp",times+"","Content-Type","application/json","appid",appid,"sign",str_sign))
+            .execute().body();
+        return result3;
+
+    }
+
+    //清理格子(不开启)
+    public static String clearCabinetBox(String cabinetCode,String boxUUId) throws Exception {
+        int times = (int) (DateUtil.date().getTime()/1000);
+        String str_sign = appid + "=" + times + "=" + appid;
+        str_sign = encrypt(str_sign);
+
+        String result3= HttpRequest.post(hosts + "/kd/api/v2/action/clear_box/").body(JSON.toJSONString(Map.of("device_number",cabinetCode,"box_uid",boxUUId)))
+            .addHeaders(Map.of("timestamp",times+"","Content-Type","application/json","appid",appid,"sign",str_sign))
+            .execute().body();
+        return result3;
+    }
+
+    //清理格子(开启)
+    public static String clearCabinetBoxOpen(String cabinetCode,String boxUUId) throws Exception {
+        int times = (int) (DateUtil.date().getTime()/1000);
+        String str_sign = appid + "=" + times + "=" + appid;
+        str_sign = encrypt(str_sign);
+
+        String result3= HttpRequest.post(hosts + "/kd/api/v2/action/clear_box/").body(JSON.toJSONString(Map.of("device_number",cabinetCode,"box_uid",boxUUId)))
+            .addHeaders(Map.of("timestamp",times+"","Content-Type","application/json","appid",appid,"sign",str_sign))
+            .execute().body();
+        return result3;
+
+    }
+
+    // 获取取件码
+    public static String getQJM(String phone) throws Exception {
+        int times = (int) (DateUtil.date().getTime()/1000);
+        String str_sign = appid + "=" + times + "=" + appid;
+        str_sign = encrypt(str_sign);
+
+        String result3= HttpRequest.post(hosts + "/kd/api/v2/query/pick_code_by_user_mobile/").body(JSON.toJSONString(Map.of("get_user_mobile",phone)))
+            .addHeaders(Map.of("timestamp",times+"","Content-Type","application/json","appid",appid,"sign",str_sign))
+            .execute().body();
+        return result3;
+
+    }
+
+
+
+
+
+
+}