diff --git a/src/main/java/com/peanut/common/Interface/KdApiEOrder.java b/src/main/java/com/peanut/common/Interface/KdApiEOrder.java index dd581717..4f96de90 100644 --- a/src/main/java/com/peanut/common/Interface/KdApiEOrder.java +++ b/src/main/java/com/peanut/common/Interface/KdApiEOrder.java @@ -1,41 +1,33 @@ package com.peanut.common.Interface; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; import com.peanut.common.utils.HttpClientUtils; import com.peanut.common.utils.KdUtils; -import com.peanut.modules.book.entity.FMSCommodity; -import com.peanut.modules.book.entity.FMSOrderEntity; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; import java.util.HashMap; -import java.util.List; import java.util.Map; /** - * - * * @技术QQ群: 可登录官网https://www.kdniao.com/右侧查看技术群号 * @see: https://kdniao.com/api-eorder * @copyright: 深圳市快金数据技术服务有限公司 * ID和Key请到官网申请:https://kdniao.com/reg - - + *

+ *

* 电子面单接口 * 此接口用于向快递/快运公司下发订单并获取快递单号,返回电子面单html模板,通知快递员上门取件。该功能支持情况需查看技术文档。 - *正式地址:https://api.kdniao.com/api/EOrderService - * - * + * 正式地址:https://api.kdniao.com/api/EOrderService + *

+ *

* 系统级参数 * RequestData String R 请求内容为JSON格式 详情可参考接口技术文档:https://www.kdniao.com/documents * EBusinessID String R 用户ID * RequestType String R 请求接口指令 * DataSign String R 数据内容签名,加密方法为:把(请求内容(未编码)+ApiKey)进行MD5加密--32位小写,然后Base64编码,最后进行URL(utf-8)编码 * DataType String R DataType=2,请求、返回数据类型均为JSON格式 - + *

* 应用级参数 * R-必填(Required),O-可选(Optional),C-报文中该参数在一定条件下可选(Conditional) * Callback String(50) O 用户自定义回传字段 @@ -95,258 +87,127 @@ import java.util.Map; public class KdApiEOrder { - //用户ID,快递鸟提供,注意保管,不要泄漏 - private static String EBusinessID="1788532";//即用户ID -// private static String EBusinessID="test1788532";//即用户ID + //用户ID,快递鸟提供,注意保管,不要泄漏 + private static String EBusinessID = "1788532";//即用户ID + // private static String EBusinessID="test1788532";//即用户ID //API key,快递鸟提供,注意保管,不要泄漏 - private static String ApiKey="f4342e6c-5cfa-458f-997b-f973eb29eb1d";//即API key + private static String ApiKey = "f4342e6c-5cfa-458f-997b-f973eb29eb1d";//即API key // private static String ApiKey="34f033ae-9c73-4b9a-899e-943a65fd86bf";//即API key -// 电子面单 - private static String OnlineReqURL="https://api.kdniao.com/api/EOrderService"; + // 电子面单 + private static String OnlineReqURL = "https://api.kdniao.com/api/EOrderService"; // 取消电子面单 - private static String ReqURL="https://api.kdniao.com/api/EOrderService"; + private static String ReqURL = "https://api.kdniao.com/api/EOrderService"; - // 物流信息跟踪 - private String TrackReqURL="https://api.kdniao.com/api/dist"; + // 物流信息跟踪 + private String TrackReqURL = "https://api.kdniao.com/api/dist"; // private static String TrackReqURL="http://sandboxapi.kdniao.com:8080/kdniaosandbox/gateway/exterfaceInvoke.json"; - // 即时查询物流信息 - private static String QueryReqURL="https://api.kdniao.com/Ebusiness/EbusinessOrderHandle.aspx"; -// private static String QueryReqURL="http://sandboxapi.kdniao.com:8080/kdniaosandbox/gateway/exterfaceInvoke.json"; + // 即时查询物流信息 + private static String QueryReqURL = "https://api.kdniao.com/Ebusiness/EbusinessOrderHandle.aspx"; + + /** + * 电子面单取消接口 + * 此接口用于取消“电子面单接口”下单成功的订单,回收快递单号。 + *

+ * 应用级参数 + * R-必填(Required),O-可选(Optional),C-报文中该参数在一定条件下可选(Conditional) + * ShipperCode String(10) R 快递公司编码 + * OrderCode String(30) R 订单编号 + * ExpNo String(30) R 快递单号 + * CustomerName String(50) R 电子面单客户号 + * CustomerPwd String(30) R 电子面单密码(顺丰不需要) + */ + @RequestMapping("/cancel") + public static String cancelOrderByJson(@RequestParam Map param) throws Exception { + + // 组装应用级参数 + String RequestData = "{" + + "'ShipperCode':" + param.get("ShipperCode") + "," + + "'OrderCode': " + param.get("orderSn") + "," + + "'ExpNo': '" + param.get("ExpNo") + "'," + + "}"; + // 组装系统级参数 + Map params = new HashMap(); + params.put("RequestData", KdUtils.urlEncoder(RequestData, "UTF-8")); + params.put("EBusinessID", EBusinessID); + params.put("RequestType", "1147"); + String dataSign = KdUtils.encrypt(RequestData, ApiKey, "UTF-8"); + params.put("DataSign", KdUtils.urlEncoder(dataSign, "UTF-8")); + params.put("DataType", "2"); + // 以form表单形式提交post请求,post请求体中包含了应用级参数和系统级参数 + String result = HttpClientUtils.kdSendPost(ReqURL, params); + + //根据公司业务处理返回的信息...... + return result; + } -// public static void main(String[] args) { -// try { -// KdApiEOrder api = new KdApiEOrder(); -// System.out.println(api.orderOnlineByJson()); -// } catch (Exception e) { -// e.printStackTrace(); -// } -// } - - /** - * 电子面单接口 - * 此接口用于向快递/快运公司下发订单并获取快递单号,返回电子面单html模板,通知快递员上门取件。 - * @return - * @throws Exception - */ - public static JSONArray orderOnlineByJson(List fmsOrderList) throws Exception{ - String RequestData= ""; - JSONArray jsonArray = new JSONArray(); - String cust = ""; - for(FMSOrderEntity fms : fmsOrderList){ - // 组装应用级参数 - RequestData= "{"+ - "'OrderCode': '" + fms.getOrderCode() + "',"+ - "'ShipperCode': '" + fms.getShipperCode() + "',"; - if("JD".equals(fms.getShipperCode())){ - cust = "'CustomerName': '010K1598220',"+ - "'CustomerPwd': '',"; - } - if ("YD".equals(fms.getShipperCode())){ -// cust = "'CustomerName': '114198226272',"+ -// "'CustomerPwd': 'gcs5XavNGRVqbhUmHpnkDd7Fi3T9Ef',"; - cust = "'CustomerName': 'testyd',"+ - "'CustomerPwd': 'testydpwd',"; - } - - cust += "'MonthCode': '',"+ - "'SendSite': '',"+ - "'PayType': 1,"+ - "'MonthCode': '',"+ - "'ExpType': 1,"+ - "'Cost': 1.0,"+ - "'OtherCost': 1.0,"+ -// "'TemplateSize':'130'"+ - "'Sender': {"+ - "'Company': '众妙之门',"+ - "'Name': 'Taylor',"+ - "'Mobile': '12345678901',"+ - "'ProvinceName': '天津',"+ - "'CityName': '天津市',"+ - "'ExpAreaName': '南开区',"+ - "'Address': '天津市南开区融创中心中南广场东区2号楼605'"+ - "},"+ - "'Receiver': {"+ - "'Company': '',"+ - "'Name': '" + fms.getReceiverName() + "',"+ - "'Mobile': '" + fms.getReceiverMobile() + "',"+ - "'ProvinceName': '" + fms.getReceiverProvinceName() + "',"+ - "'CityName': '" + fms.getReceiverCityName() + "',"+ - "'ExpAreaName': '" + fms.getReceiverExpAreaName() + "',"+ - "'Address': '" + fms.getReceiverAddress() + "'"+ - "},"+ - "'Commodity': [" ; - String s = ""; - for(FMSCommodity fmsCommodity : fms.getCommodityList() ){ - s += "{'GoodsName': '"+fmsCommodity.getGoodsName()+ "'},"; - } - s = s.substring(0,s.lastIndexOf(',')); - String a = s + "],"+ - "'AddService': [],"+ - "'IsReturnPrintTemplate':1,"+ - "'Remark': "+ fms.getRemark()+""+ - "}"; - - // 组装系统级参数 - Map params = new HashMap(); - params.put("RequestData", KdUtils.urlEncoder(RequestData + cust + a, "UTF-8")); - params.put("EBusinessID", EBusinessID); - params.put("RequestType", "1007"); -// params.put("RequestType", "1001"); - String dataSign=KdUtils.encrypt(RequestData + cust + a, ApiKey, "UTF-8"); - System.out.println(RequestData + a); - params.put("DataSign", KdUtils.urlEncoder(dataSign, "UTF-8")); - params.put("DataType", "2"); - // 以form表单形式提交post请求,post请求体中包含了应用级参数和系统级参数 - String result= HttpClientUtils.kdSendPost(OnlineReqURL, params); - jsonArray.add(result); - } - return jsonArray; - - } - - /** - * 电子面单取消接口 - * 此接口用于取消“电子面单接口”下单成功的订单,回收快递单号。 - * - * 应用级参数 - * R-必填(Required),O-可选(Optional),C-报文中该参数在一定条件下可选(Conditional) - * ShipperCode String(10) R 快递公司编码 - * OrderCode String(30) R 订单编号 - * ExpNo String(30) R 快递单号 - * CustomerName String(50) R 电子面单客户号 - * CustomerPwd String(30) R 电子面单密码(顺丰不需要) - * - */ - @RequestMapping("/cancel") - public static String cancelOrderByJson(@RequestParam Map param) throws Exception{ - - // 组装应用级参数 - String RequestData= "{"+ - "'ShipperCode':" +param.get("ShipperCode")+","+ - "'OrderCode': "+param.get("orderSn")+","+ - "'ExpNo': '"+param.get("ExpNo")+"',"+ - "}"; - // 组装系统级参数 - Map params = new HashMap(); - params.put("RequestData", KdUtils.urlEncoder(RequestData, "UTF-8")); - params.put("EBusinessID", EBusinessID); - params.put("RequestType", "1147"); - String dataSign=KdUtils.encrypt(RequestData, ApiKey, "UTF-8"); - params.put("DataSign", KdUtils.urlEncoder(dataSign, "UTF-8")); - params.put("DataType", "2"); - // 以form表单形式提交post请求,post请求体中包含了应用级参数和系统级参数 - String result=HttpClientUtils.kdSendPost(ReqURL, params); - -// JSONObject json = JSONObject.parseObject(result); -// if(json.get("Success").equals("true")){ -// // TODO 返回值为Success时 存入到系统中的 sys_interface_log 表 -// -// }else{ -// // TODO 存入到系统中的 sys_interface_fail 表中 -// // TODO 存入interfaceType 值为 ‘2’ 用作以后人工干预重推 区分是什么接口 -// -// } - - //根据公司业务处理返回的信息...... - return result; - } - - - /** - * - * 即时查询接口(增值版) - * 此接口用于向快递公司实时查询物流轨迹信息。 - * - * 应用级参数 - * R-必填(Required),O-可选(Optional),C-报文中该参数在一定条件下可选(Conditional) - * OrderCode String(30) O 订单编号 - * CustomerName String(50) C ShipperCode为SF时必填,对应寄件人/收件人手机号后四位;ShipperCode为其他快递时,可不填或保留字段,不可传值 - * ShipperCode String(10) R 快递公司编码 详细编码参考《快递鸟接口支持快递公司编码.xlsx》 - * LogisticCode String(30) R 快递单号 - */ - @RequestMapping("/queryOrder") - public static String queryOrderOnlineByJson(@RequestParam Map param) throws Exception{ - // 组装应用级参数 - String RequestData= "{"+ - "'ShipperCode': '"+ param.get("ShipperCode") +"',"+ - "'LogisticCode': '"+ param.get("LogisticCode") +"',"+ - "}"; - // 组装系统级参数 - Map params = new HashMap(); - params.put("RequestData", KdUtils.urlEncoder(RequestData, "UTF-8")); - params.put("EBusinessID", EBusinessID); - params.put("RequestType", "8001");//在途监控即时查询接口指令8001/地图版即时查询接口指令8003 - String dataSign=KdUtils.encrypt(RequestData, ApiKey, "UTF-8"); - params.put("DataSign", KdUtils.urlEncoder(dataSign, "UTF-8")); - params.put("DataType", "2"); - // 以form表单形式提交post请求,post请求体中包含了应用级参数和系统级参数 - String result=HttpClientUtils.kdSendPost(QueryReqURL, params); - return result; - } - - /** - * 物流跟踪接口(增值版) - * 此接口用于向快递鸟订阅物流轨迹信息。 - * - * 应用级参数 - * R-必填(Required),O-可选(Optional),C-报文中该参数在一定条件下可选(Conditional) - * Callback String(50) O 用户自定义回传字段 - * ShipperCode String(10) R 快递公司编码 详细编码参考《快递鸟接口支持快递公司编码.xlsx》 - * LogisticCode String(30) R 快递单号 - * CustomerName String(50) C ShipperCode为SF时必填,对应寄件人/收件人手机号后四位;ShipperCode为其他快递时,可不填或保留字段,不可传值 - - */ - @RequestMapping("/track") - public String trackOrderByJson(@RequestParam Map param) throws Exception{ - // 组装应用级参数 - String RequestData= "{"+ - "'Callback':'OrderCode',"+ - "'ShipperCode':'" + param.get("ShipperCode") + "',"+ - "'LogisticCode':'" + param.get("LogisticCode") + "',"+ - "}"; - // 组装系统级参数 - Map params = new HashMap(); - params.put("RequestData", KdUtils.urlEncoder(RequestData, "UTF-8")); - params.put("EBusinessID", EBusinessID); - params.put("RequestType", "8008");//在途监控订阅接口指令8008/地图版订阅接口指令8005 -// params.put("RequestType", "8005");//在途监控订阅接口指令8008/地图版订阅接口指令8005 - String dataSign=KdUtils.encrypt(RequestData, ApiKey, "UTF-8"); - params.put("DataSign", KdUtils.urlEncoder(dataSign, "UTF-8")); - params.put("DataType", "2"); - // 以form表单形式提交post请求,post请求体中包含了应用级参数和系统级参数 - String result=HttpClientUtils.kdSendPost(TrackReqURL, params); - return result; - } - - /** - * - * 此接口用于快递鸟推送物流轨迹信息。 - * @return - * @throws Exception - */ - // TODO 后续编写 获取信息存库 调用消息队列 异步推送给 一路健康 or 疯子读书 - @RequestMapping("/pushOrder") - public String subscribeOrderByJSON() throws Exception{ - - -// JSONObject json = JSONObject.parseObject(result); -// if(json.get("Success").equals("true")){ -// // TODO 返回值为Success时 存入到系统中的 sys_interface_log 表 -// -// }else{ -// // TODO 存入到系统中的 sys_interface_fail 表中 -// // TODO 存入interfaceType 值为 ‘5’ 用作以后人工干预重推 区分是什么接口 -// -// } - return ""; - } + /** + * 即时查询接口(增值版) + * 此接口用于向快递公司实时查询物流轨迹信息。 + *

+ * 应用级参数 + * R-必填(Required),O-可选(Optional),C-报文中该参数在一定条件下可选(Conditional) + * OrderCode String(30) O 订单编号 + * CustomerName String(50) C ShipperCode为SF时必填,对应寄件人/收件人手机号后四位;ShipperCode为其他快递时,可不填或保留字段,不可传值 + * ShipperCode String(10) R 快递公司编码 详细编码参考《快递鸟接口支持快递公司编码.xlsx》 + * LogisticCode String(30) R 快递单号 + */ + @RequestMapping("/queryOrder") + public static String queryOrderOnlineByJson(@RequestParam Map param) throws Exception { + // 组装应用级参数 + String RequestData = "{" + + "'ShipperCode': '" + param.get("ShipperCode") + "'," + + "'LogisticCode': '" + param.get("LogisticCode") + "'," + + "}"; + // 组装系统级参数 + Map params = new HashMap(); + params.put("RequestData", KdUtils.urlEncoder(RequestData, "UTF-8")); + params.put("EBusinessID", EBusinessID); + params.put("RequestType", "8001");//在途监控即时查询接口指令8001/地图版即时查询接口指令8003 + String dataSign = KdUtils.encrypt(RequestData, ApiKey, "UTF-8"); + params.put("DataSign", KdUtils.urlEncoder(dataSign, "UTF-8")); + params.put("DataType", "2"); + // 以form表单形式提交post请求,post请求体中包含了应用级参数和系统级参数 + String result = HttpClientUtils.kdSendPost(QueryReqURL, params); + return result; + } + /** + * 物流跟踪接口(增值版) + * 此接口用于向快递鸟订阅物流轨迹信息。 + *

+ * 应用级参数 + * R-必填(Required),O-可选(Optional),C-报文中该参数在一定条件下可选(Conditional) + * Callback String(50) O 用户自定义回传字段 + * ShipperCode String(10) R 快递公司编码 详细编码参考《快递鸟接口支持快递公司编码.xlsx》 + * LogisticCode String(30) R 快递单号 + * CustomerName String(50) C ShipperCode为SF时必填,对应寄件人/收件人手机号后四位;ShipperCode为其他快递时,可不填或保留字段,不可传值 + */ + @RequestMapping("/track") + public String trackOrderByJson(@RequestParam Map param) throws Exception { + // 组装应用级参数 + String RequestData = "{" + + "'Callback':'OrderCode'," + + "'ShipperCode':'" + param.get("ShipperCode") + "'," + + "'LogisticCode':'" + param.get("LogisticCode") + "'," + + "}"; + // 组装系统级参数 + Map params = new HashMap(); + params.put("RequestData", KdUtils.urlEncoder(RequestData, "UTF-8")); + params.put("EBusinessID", EBusinessID); + params.put("RequestType", "8008");//在途监控订阅接口指令8008/地图版订阅接口指令8005 + String dataSign = KdUtils.encrypt(RequestData, ApiKey, "UTF-8"); + params.put("DataSign", KdUtils.urlEncoder(dataSign, "UTF-8")); + params.put("DataType", "2"); + // 以form表单形式提交post请求,post请求体中包含了应用级参数和系统级参数 + String result = HttpClientUtils.kdSendPost(TrackReqURL, params); + return result; + } } diff --git a/src/main/java/com/peanut/modules/book/controller/BookClockinCommentController.java b/src/main/java/com/peanut/modules/book/controller/BookClockinCommentController.java deleted file mode 100644 index ca8c33ee..00000000 --- a/src/main/java/com/peanut/modules/book/controller/BookClockinCommentController.java +++ /dev/null @@ -1,144 +0,0 @@ -package com.peanut.modules.book.controller; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.peanut.common.utils.PageUtils; -import com.peanut.common.utils.R; -import com.peanut.modules.book.entity.BookClockinCommentEntity; -import com.peanut.modules.book.entity.BookClockInEntity; -import com.peanut.modules.book.entity.BookClockinPunchEntity; -import com.peanut.modules.book.service.BookClockinCommentService; -import com.peanut.modules.book.service.BookClockinPunchService; -import com.peanut.modules.book.service.BookClockInService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import java.util.Arrays; -import java.util.Map; - -/** - * 签到信息用户评论 - * - */ - -@RestController -@RequestMapping("clockin/comment") -public class BookClockinCommentController { - - @Autowired - private BookClockinCommentService bookClockinCommentService; - @Autowired - private BookClockinPunchService bookClockinPunchService; - @Autowired - private BookClockInService bookClockinService; - - /** - * 列表 倒叙 - */ - @RequestMapping("/applist") - public R applist(@RequestParam Map params){ - PageUtils page = bookClockinCommentService.queryPage(params); - return R.ok().put("page", page); - } - - - /** - * 信息 - */ - @RequestMapping("/info/{id}") - public R info(@PathVariable("id") Integer id){ - BookClockinCommentEntity commentEntity = bookClockinCommentService.getById(id); - - return R.ok().put("commentEntity", commentEntity); - } - - /** - * 保存 - */ - @RequestMapping("/save") - public R save(@RequestBody BookClockinCommentEntity clockinComment){ - Integer bookid1 = clockinComment.getBookId(); - Integer userId = clockinComment.getUserId(); - Integer taskId = clockinComment.getTaskId(); - - - BookClockinCommentEntity bookClockinCommentEntity = bookClockinCommentService.getBaseMapper().selectOne(new QueryWrapper() - .eq("book_id", bookid1) - .eq("user_id", userId) - .eq("task_id", taskId) - - ); - BookClockinPunchEntity ClockinCommen = bookClockinPunchService.getBaseMapper().selectOne(new QueryWrapper() - .eq("book_id", bookid1) - .eq("user_id", userId) - .eq("t_id", taskId) - - ); - - - - if (bookClockinCommentEntity !=null) { - return R.error("该信息允许发布一条内容,请勿重复发布"); - } - - if (ClockinCommen!=null) { - clockinComment.setPid(1); - } - - bookClockinCommentService.save(clockinComment); - return R.ok(); - } - - - /** - * 保存 - */ - @RequestMapping("/replysave") - public R replysave(@RequestBody BookClockinCommentEntity clockinComment) { - Integer bookid = clockinComment.getBookId(); - Integer userId = clockinComment.getUserId(); - Integer pid = clockinComment.getPid(); - BookClockInEntity bookClockinEntity = bookClockinService.getBaseMapper().selectOne(new QueryWrapper() - .eq("id",pid) - ); - clockinComment.setDelFlag(0); - bookClockinCommentService.save(clockinComment); - - return R.ok(); - } - - - - - - - - - /** - * 修改 - */ - @RequestMapping("/update") - public R update(@RequestBody BookClockinCommentEntity clockinComment){ - - bookClockinCommentService.updateById(clockinComment); - return R.ok(); - } - - - /** - * 删除 - */ - @RequestMapping("/delete") - public R delete(@RequestBody Integer[] ids){ - bookClockinCommentService.removeByIds(Arrays.asList(ids)); - - return R.ok(); - } - - - - - -} - - - - diff --git a/src/main/java/com/peanut/modules/book/controller/BookClockinController.java b/src/main/java/com/peanut/modules/book/controller/BookClockinController.java deleted file mode 100644 index bb2953c9..00000000 --- a/src/main/java/com/peanut/modules/book/controller/BookClockinController.java +++ /dev/null @@ -1,350 +0,0 @@ -package com.peanut.modules.book.controller; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.peanut.common.utils.PageUtils; -import com.peanut.common.utils.R; -import com.peanut.modules.book.entity.*; -import com.peanut.modules.book.service.*; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import java.util.*; -/** - * 签到内容信息 - * - */ -@RestController -@RequestMapping("book/clockin") -public class BookClockinController { - @Autowired - private BookClockInService bookClockinService; - @Autowired - private BookTaskService bookTaskService; - @Autowired - private BookClockinCommentService bookClockinCommentService; - @Autowired - private MyUserService myUserService; - @Autowired - private BookService bookService; - @Autowired - private BookClockinPunchService bookClockinPunchService; - /** - * 列表 app post请求 - */ - @RequestMapping("/applistSS") - public R applist(@RequestParam Map params) { - PageUtils page = bookClockinService.queryPage(params); - - return R.ok().put("page", page); - } - - - /** - * 查看全部评价 - */ - @RequestMapping("/applist") - public R applist(@RequestParam("bookid") String bookid, - @RequestParam("taskid") String taskid) { - - List bookClockinEntityList = bookClockinService.getBaseMapper().selectList(new QueryWrapper() - .eq("book_id", bookid).eq("task_id", taskid)); - List list = new ArrayList<>(); - for (BookClockInEntity bookClockinEntity : bookClockinEntityList) { - Map map = new HashMap<>(); - String name = ""; - String avatar=""; - Integer id2 =null; - Integer userId = bookClockinEntity.getUserId(); - Integer taskId = bookClockinEntity.getTaskId(); - Integer bookId = bookClockinEntity.getBookId(); - String conTent = bookClockinEntity.getContent(); - Integer id1 = bookClockinEntity.getId(); - String images = (String)bookClockinEntity.getImages(); - Date createTime = bookClockinEntity.getCreateTime(); - List id = myUserService.getBaseMapper().selectList(new QueryWrapper().eq("id", userId)); - for (MyUserEntity user : id) { - name = user.getNickname(); - id2 = user.getId(); - avatar = user.getAvatar(); - } - - //评论信息 - map.put("userid", id2); - map.put("name", name); - map.put("avatar", avatar); - map.put("bookid", bookId); - map.put("taskId", taskId); - map.put("content", conTent); - map.put("images", images); - map.put("createdate", createTime); - list.add(map); - } - Collections.reverse(list); - return R.ok().put("list", list); - } - - - - - - /** - * 列表 后台get请求 - */ - @RequestMapping("/list") - public R list(@RequestParam Map params) { - PageUtils page = bookClockinService.queryPage(params); - - return R.ok().put("page", page); - } - - - /** - * 信息 - */ - @RequestMapping("/info/{id}") - public R info(@PathVariable("id") Integer id) { - BookClockInEntity bookClockinEntity = bookClockinService.getById(id); - return R.ok().put("bookBuyConfig", bookClockinEntity); - } - - /** - * 保存 - */ - @RequestMapping("/save") - public R save(@RequestBody BookClockInEntity bookClockinEntity) { - - Integer bookId = bookClockinEntity.getBookId(); - Integer userId = bookClockinEntity.getUserId(); - Integer taskId = bookClockinEntity.getTaskId(); - Integer dayId = bookClockinEntity.getDayId(); - BookClockinPunchEntity bookClockinPunchEntity = bookClockinPunchService.getBaseMapper().selectOne(new QueryWrapper() - .eq("book_id", bookId) - .eq("t_id", taskId) - .eq("days", dayId) - .eq("user_id", userId) - ); - if (bookClockinPunchEntity==null) { - return R.error("当天打卡内容未发布"); - } - BookClockInEntity bookClockin = bookClockinService.getBaseMapper().selectOne(new QueryWrapper() - .eq("book_id", bookId) - .eq("task_id", taskId) - .eq("day_id", dayId) - .eq("user_id", userId) - ); - if (bookClockin!=null) { - return R.error("您已参与第"+dayId+"天签到评论"); - } - List> imageList = (ArrayList>) bookClockinEntity.getImageeStrings(); - String imageStr = ""; - for (Map m : imageList) { - imageStr += m.get("url") + ","; - - } - - if (imageStr!=null &&!imageStr.isEmpty()){ - String substring = imageStr.substring(0, imageStr.length() - 1); - bookClockinEntity.setImages(substring); - }else { - bookClockinEntity.setImages(""); - } - - - - bookClockinEntity.setDelFlag(0); - bookClockinService.save(bookClockinEntity); - return R.ok(); - } - - - /** - * 修改 - */ - @RequestMapping("/update") - public R update(@RequestBody BookClockInEntity bookClockinEntity) { - bookClockinService.updateById(bookClockinEntity); - return R.ok("提交成功"); - } - - - /** - * 删除 - */ - @RequestMapping("/delete") - public R delete(@RequestBody Integer[] ids) { - bookClockinService.removeByIds(Arrays.asList(ids)); - return R.ok(); - } - - - /** - * 全部评价 - * - * @param bookId - * @return - */ - @RequestMapping("commentAll") - public R commentAll(@RequestParam("bookId") Integer bookId) { - List applist = new ArrayList<>(); - Map productMap = new HashMap<>(); - //根据bookid查找出签到表中签到的用户数据 - List bookid = bookClockinService.getBaseMapper().selectList(new QueryWrapper() - .eq("book_id", bookId) - .orderByDesc("create_time")); - - for (BookClockInEntity book : bookid) { - HashMap map = new HashMap<>(); - - Integer bookid1 = book.getBookId(); - //BookClockinEntity获取点赞总数 - String likes = book.getLikeSum(); - - Integer userid1 = book.getUserId(); - Integer taskId = book.getTaskId(); - Integer id1 = book.getId(); - applist.add(taskId); - //根据id和bookid查询出对应的签到下评论的全部数据 - - productMap.put("bookid",bookid1); - productMap.put("userid",userid1); - } - PageUtils pages = bookClockinService.queryPage(productMap); - return R.ok().put("days",applist).put("pages",pages); - } - - - /** - * 我的 :我的签到记录 - * @param id - * @param bookId - * @return - */ - @RequestMapping("/myinfo") - public R myinfo(@RequestParam("userid") Integer id, - @RequestParam("bookid") Integer bookId) { - - - List bookClockinEntityList = bookClockinService.getBaseMapper().selectList(new QueryWrapper() - .eq("user_id",id) .eq("book_id",bookId).orderByDesc("create_time")); - List list = new ArrayList<>(); - - for (BookClockInEntity bookClockinEntity : bookClockinEntityList) { - Map productMap = new HashMap<>(); - Integer userId = bookClockinEntity.getUserId(); - Integer dayId = bookClockinEntity.getDayId(); - Integer bookIds = bookClockinEntity.getBookId(); - Integer typeId = bookClockinEntity.getTaskId(); - String content = bookClockinEntity.getContent(); - Object images = bookClockinEntity.getImages(); - Date createTime = bookClockinEntity.getCreateTime(); - BookEntity byId = bookService.getById(bookId); - String name = byId.getName(); - String images1 = byId.getImages(); - BookTaskEntity bookTaskEntity = bookTaskService.getById(typeId); - String heading = bookTaskEntity.getHeading(); - - - String myUsername = ""; - String avatar=""; - List myUserid = myUserService.getBaseMapper().selectList(new QueryWrapper().eq("id", userId)); - for (MyUserEntity user : myUserid) { - myUsername = user.getNickname(); - avatar = user.getAvatar(); - } - - productMap.put("myUseravatar",avatar); - productMap.put("myUsername",myUsername); - - productMap.put("dayId",dayId); - productMap.put("userId",userId); - productMap.put("taskId",typeId); - productMap.put("content",content); - productMap.put("clockinimages",images); - productMap.put("createTime",createTime); - productMap.put("bookId",bookIds); - productMap.put("bookname",name); - productMap.put("bookimages",images1); - productMap.put("TaskHeading",heading); - list.add(productMap); - - } -// Collections.sort(list); -// Collections.reverse(list); - return R.ok().put("ClockinList", list); - } - - - /** - * 详情页我的签到评论 - * @param id - * @param taskid - * @param bookId - * @return - */ - @RequestMapping("/myinfolist") - public R myinfolist(@RequestParam("userid") Integer id, - @RequestParam("taskid") Integer taskid, - @RequestParam("bookid") Integer bookId - ) { - List list = new ArrayList<>(); - Map productMap = new HashMap<>(); - BookClockInEntity bookClockin = bookClockinService.getBaseMapper().selectOne(new QueryWrapper() - .eq("user_id",id) - .eq("task_id",taskid) - .eq("book_id",bookId) - ); - BookClockinPunchEntity bookClockinPunchEntity = bookClockinPunchService.getBaseMapper().selectOne(new QueryWrapper() - .eq("user_id",id) - .eq("t_id",taskid) - .eq("book_id",bookId) - ); - - - if (bookClockin == null ) { - return R.ok(); - } - - Integer userId = bookClockin.getUserId(); - Integer bookIds = bookClockin.getBookId(); - Integer taskId = bookClockin.getTaskId(); - Integer dayId = bookClockin.getDayId(); - String content = bookClockin.getContent(); - Object images = bookClockin.getImages(); - Date createTime = bookClockin.getCreateTime(); - BookEntity byId = bookService.getById(bookId); - String name = byId.getName(); - String images1 = byId.getImages(); - BookTaskEntity bookTaskEntity = bookTaskService.getById(taskId); - String heading = bookTaskEntity.getHeading(); - - - - String myUsername = ""; - String avatar=""; - List myUserid = myUserService.getBaseMapper().selectList(new QueryWrapper().eq("id", userId)); - for (MyUserEntity user : myUserid) { - myUsername = user.getNickname(); - avatar = user.getAvatar(); - } - - productMap.put("myUseravatar",avatar); - productMap.put("myUsername",myUsername); - - - - productMap.put("userId",userId); - productMap.put("taskId",taskId); - productMap.put("dayId",dayId); - - productMap.put("content",content); - productMap.put("clockinimages",images); - productMap.put("createTime",createTime); - productMap.put("bookId",bookIds); - productMap.put("bookname",name); - productMap.put("bookimages",images1); - productMap.put("TaskHeading",heading); - list.add(productMap); - - Collections.reverse(list); - return R.ok().put("productlist", list); - } - -} \ No newline at end of file diff --git a/src/main/java/com/peanut/modules/book/controller/BookClockinPunchController.java b/src/main/java/com/peanut/modules/book/controller/BookClockinPunchController.java deleted file mode 100644 index adb671d1..00000000 --- a/src/main/java/com/peanut/modules/book/controller/BookClockinPunchController.java +++ /dev/null @@ -1,220 +0,0 @@ -package com.peanut.modules.book.controller; - -import cn.hutool.core.date.DateUnit; -import cn.hutool.core.date.DateUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.TypeReference; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.github.yulichang.wrapper.MPJLambdaWrapper; -import com.peanut.common.utils.PageUtils; -import com.peanut.common.utils.R; -import com.peanut.modules.book.dao.UserEbookBuyDao; -import com.peanut.modules.book.entity.*; -import com.peanut.modules.book.service.*; -import io.swagger.models.auth.In; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.*; - -@RestController -@RequestMapping("book/clockinPunch") -public class BookClockinPunchController { - @Autowired - private BookClockinPunchService bookClockinPunchService; - @Autowired - private BookService bookService; - @Autowired - private MyUserService myUserService; - @Autowired - private BookClockinCommentService bookClockinCommentService; - @Autowired - private UserEbookBuyDao userEbookBuyDao; - @Autowired - UserBookClockService userBookClockService; - - - /** - * 列表 app post请求 /applistSS - */ - @RequestMapping("/applist") - public R applist(@RequestParam Map params) { - PageUtils page = bookClockinPunchService.queryPage(params); - return R.ok().put("page", page); - } - - - - - /** - * 信息 - */ - @RequestMapping("/info/{id}") - public R info(@PathVariable("id") Integer id) { - BookClockinPunchEntity bookClockinPunchEntity = bookClockinPunchService.getById(id); - - return R.ok().put("bookClockinPunchEntity", bookClockinPunchEntity); - } - - /** - * 保存 - */ - @RequestMapping("/save") - public R save(@RequestBody BookClockinPunchEntity bookClockinPunchEntity) { - Integer bookid1 = bookClockinPunchEntity.getBookId(); - Integer userId = bookClockinPunchEntity.getUserId(); - Integer taskId = bookClockinPunchEntity.getTId(); - BookEntity bookEntity = bookService.getBaseMapper().selectById(bookid1); - Boolean canListen = bookEntity.getCanListen(); - BookClockinPunchEntity bookClock = bookClockinPunchService.getBaseMapper().selectOne(new QueryWrapper() - .eq("book_id", bookid1) - .eq("user_id", userId) - .eq("t_id", taskId) - - - ); - if (bookClock != null) { - return R.error("您已经签到,请勿重复签到"); - } - - - if (canListen == true) { - boolean b = myUserService.bookAuthen(bookid1, userId); - if (b) { - bookClockinPunchEntity.setDelFlag(0); - bookClockinPunchService.save(bookClockinPunchEntity); - return R.ok("签到成功"); - } else { - return R.error("您还未购买此书,购买后即可签到"); - - } - - } else { - return R.error("该书暂未开放打卡权限"); - } - - - } - - - /** - * 获取用户打卡已购图书 - * - * @param userId - * @return - */ - @RequestMapping("/myClockBooks") - public R myClockBooks(@RequestParam Integer userId, @RequestParam Integer limit, @RequestParam Integer page) { - MPJLambdaWrapper wrapper = new MPJLambdaWrapper<>(); - wrapper.selectAll(BookEntity.class); - wrapper.leftJoin(BookEntity.class, BookEntity::getId, UserEbookBuyEntity::getBookId); - wrapper.eq(UserEbookBuyEntity::getUserId, userId); - wrapper.eq(BookEntity::getDelFlag, 0); - wrapper.eq(BookEntity::getClockIn, 1); - Page userBookEntityPage = userEbookBuyDao.selectJoinPage(new Page(page, limit), BookEntity.class, wrapper); - return R.ok().put("page", userBookEntityPage); - } - - /** - * 获取打卡推荐图书 - * - * @param userId - * @param limit - * @param page - * @return - */ - @RequestMapping("/getBestClockBooks") - public R getBestClockBooks(@RequestParam Integer userId, @RequestParam Integer limit, @RequestParam Integer page) { - String not_ex_sql = "select 1 from user_ebook_buy where book.id = book_id and user_id = " + userId; - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(BookEntity::getDelFlag, 0); - wrapper.eq(BookEntity::getClockIn, 1); - wrapper.notExists(not_ex_sql); - Page bookEntityPage = bookService.getBaseMapper().selectPage(new Page<>(page, limit), wrapper); - return R.ok().put("page", bookEntityPage); - } - - - /** - * 修改 - */ - @RequestMapping("/update") - public R update(@RequestBody BookClockinPunchEntity bookClockinPunchEntity) { - bookClockinPunchService.updateById(bookClockinPunchEntity); - return R.ok("提交成功"); - } - - - /** - * 删除 - */ - @RequestMapping("/delete") - public R delete(@RequestBody Integer[] ids) { - bookClockinPunchService.removeByIds(Arrays.asList(ids)); - - return R.ok(); - } - - - /** - * 获取评论 - * - * @param bookClockinPunchEntity - * @return - */ - @RequestMapping("/punchcoments") - public R punchcoments(@RequestBody BookClockinPunchEntity bookClockinPunchEntity) { - //图书Id - Integer bookId = bookClockinPunchEntity.getBookId(); - //用户id - Integer userId = bookClockinPunchEntity.getUserId(); - //天数 - Integer days = bookClockinPunchEntity.getDays(); - - ArrayList list = new ArrayList<>(); - List bookClockinCommentEntities = bookClockinCommentService.getBaseMapper().selectList(new QueryWrapper() - .eq("user_id", userId) - .eq("book_id", bookId) - .eq("task_id", days) - //pid等于1时为一级评论 -// .eq("pid",1) - ); - for (BookClockinCommentEntity bookClockinCommentEntity : bookClockinCommentEntities) { - HashMap map = new HashMap<>(); - String name = ""; - String avatar = ""; - - Integer userId1 = bookClockinCommentEntity.getUserId(); - Integer bookId1 = bookClockinCommentEntity.getBookId(); - String content = bookClockinCommentEntity.getContent(); - String images = bookClockinCommentEntity.getImages(); - Date createTime = bookClockinCommentEntity.getCreateTime(); - - - List id = myUserService.getBaseMapper().selectList(new QueryWrapper().eq("id", userId)); - for (MyUserEntity user : id) { - name = user.getNickname(); - avatar = user.getAvatar(); - } - map.put("userid", userId1); - map.put("name", name); - map.put("avatar", avatar); - map.put("bookid", bookId1); - map.put("content", content); - map.put("images", images); - map.put("createdate", createTime); - list.add(map); - - } - - Collections.reverse(list); - return R.ok().put("list", list); - - - } - - -} - diff --git a/src/main/java/com/peanut/modules/book/controller/BookTaskController.java b/src/main/java/com/peanut/modules/book/controller/BookTaskController.java deleted file mode 100644 index ef9c9167..00000000 --- a/src/main/java/com/peanut/modules/book/controller/BookTaskController.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.peanut.modules.book.controller; - - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.peanut.common.utils.PageUtils; -import com.peanut.common.utils.R; -import com.peanut.modules.book.entity.BookClockinPunchEntity; -import com.peanut.modules.book.entity.BookTaskEntity; -import com.peanut.modules.book.service.*; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - - -/** - * 发布签到任务 - */ -@RestController -@RequestMapping("book/task") -public class BookTaskController { - - @Autowired - private BookTaskService bookTaskService; - @Autowired - private BookService bookService; - @Autowired - private BookClockInService bookClockinService; - @Autowired - private MyUserService myUserService; - @Autowired - private BookClockinPunchService bookClockinPunchService; - - /** - * 列表后台 - * - */ - @RequestMapping("/list") - public R list(@RequestParam Map params) { - PageUtils page = bookTaskService.queryPage(params); - - - return R.ok().put("page", page); - } - - - /** - * 列表app根据days查询 - * - */ - @RequestMapping("/applist") - public R applist(@RequestParam Map params) { - PageUtils page = bookTaskService.queryPageServi(params); - - - return R.ok().put("page", page); - } - - - - - - /** - * 信息 - */ - @RequestMapping("/info/{id}") - public R info(@PathVariable("id") Integer id) { - - //根据id找到详细数据信息 - BookTaskEntity bookTaskEntity = bookTaskService.getById(id); - Integer ids = bookTaskEntity.getId(); - Integer bookid = bookTaskEntity.getBookid(); - List bookClockinPunchEntity = bookClockinPunchService.getBaseMapper().selectList(new QueryWrapper() - .eq("user_id", ids) - .eq("book_id", bookid)); - - // 遍历 bookClockinEntityList 中的每个 bookClockinEntity,查询 BookClockinEntity 表中对应的总数 - int total = 0; - for ( BookClockinPunchEntity bookClockin : bookClockinPunchEntity) { - - Integer id1 = bookClockin.getId(); -// BookClockinEntity byId = bookClockinService.getById(id1); - //++获取到总条数 - total ++; - } - //返回总条数 - - return R.ok().put("bookTaskEntity", bookTaskEntity).put("totalCont",total); - } - - /** - * 保存 - */ - @RequestMapping("/save") - public R save(@RequestBody BookTaskEntity bookTaskEntity) { - - bookTaskEntity.setDelFlag(0); - bookTaskService.save(bookTaskEntity); - return R.ok(); - } - - - /** - * 修改 - */ - @RequestMapping("/update") - public R update(@RequestBody BookTaskEntity bookTaskEntity) { - - bookTaskService.updateById(bookTaskEntity); - return R.ok(); - } - - - /** - * 删除 - */ - @RequestMapping("/delete") - public R delete(@RequestBody Integer[] ids) { - bookTaskService.removeByIds(Arrays.asList(ids)); - - return R.ok(); - } - - - - /** - * 总条数 - */ - @RequestMapping("/totalsum") - public R totalsum(@RequestBody BookTaskEntity bookTaskEntity) { - - // 获取 BookTaskEntity 表中所有的 bookid和id - String days = bookTaskEntity.getDays(); - Integer bookid = bookTaskEntity.getBookid(); - List books = bookClockinPunchService.getBaseMapper().selectList(new QueryWrapper() - .eq("days", days) - .eq("book_id", bookid)); - - - - // 遍历 bookClockinEntityList 中的每个 bookClockinEntity,查询 BookClockinEntity 表中对应的总数 - int total = 0; - for ( BookClockinPunchEntity book : books) { - // 使用 bookClockinEntity 进行匹配查询 - Integer id1 = book.getId(); - BookClockinPunchEntity byId = bookClockinPunchService.getById(id1); - //++获取到总条数 - total ++; - } - //返回总条数 - return R.ok().put("totalSum",total); - - } - - - -} \ No newline at end of file diff --git a/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java b/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java index 12fe0620..e514305f 100644 --- a/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java +++ b/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java @@ -78,33 +78,6 @@ public class BuyOrderController { return R.ok().put("page", page); } - - /** - * @param params - * @return 听书未购买页面展示 - * (销量最多的书,最先放最前面展示。最新上线的书,预售的书,放最前面展示 - * @throws Exception - */ - @RequestMapping("/lists") - public R lists(@RequestParam Map params) throws Exception { - - if ("all".equals(params.get("orderStatus"))) { - params.remove("orderStatus"); - } - PageUtils page = buyOrderService.queryPages(params); - return R.ok().put("page", page); - } - - /** - * 信息 - */ - @RequestMapping("/info/{orderId}") - public R info(@PathVariable("orderId") Integer orderId) { - BuyOrderEntity buyOrder = buyOrderService.getById(orderId); - return R.ok().put("buyOrder", buyOrder); - } - - /** * 下单 * @@ -202,74 +175,13 @@ public class BuyOrderController { return R.ok(); } - /** - * 列表 - */ - @RequestMapping("/appUserGetlist") - public R appUserGetlist(@RequestParam Map params) { - PageUtils page = buyOrderService.queryPage1(params); - return R.ok().put("page", page); - } - - - /** - * app 端 取消订单 - */ - @RequestMapping("/appDelete") - @Transactional - public R appDelete(@RequestParam("orderId") Integer orderId) { - - //1. 判断订单状态 - BuyOrderEntity byId = buyOrderService.getById(orderId); - if (byId != null) { - //2. 判断当前订单是否存在优惠券 进行 回显 - Integer couponId = byId.getCouponId(); - if (couponId != null) { - - CouponHistoryEntity byId1 = couponHistoryService.getById(couponId); - byId1.setUseStatus(0); - couponHistoryService.updateById(byId1); - } - // 库存回滚 - List buyOrderDetailEntities = buyOrderDetailService.getBaseMapper().selectList(new QueryWrapper() - .eq("order_id", byId.getOrderId())); - for (BuyOrderDetailEntity buyOrderDetailEntity : buyOrderDetailEntities) { - Integer productId = buyOrderDetailEntity.getProductId(); - ShopProductEntity product = shopProductService.getById(productId); - product.setProductStock(product.getProductStock() + buyOrderDetailEntity.getQuantity()); - shopProductService.updateById(product); - } - buyOrderService.removeById(orderId); - } - return R.ok(); - } - - @RequestMapping("/randomOrderCode") - @Transactional - public R randomOrderCode(@RequestBody BuyOrderEntity buyOrder) { - return R.ok(); - } - - /** - * 充值专用订单生成接口 - */ - @RequestMapping("/rechargeSave") - @Transactional - public R rechargeSave(@RequestBody BuyOrderEntity buyOrder) { - String timeId = IdWorker.getTimeId().substring(0, 32); - buyOrder.setOrderSn(timeId); - buyOrderService.save(buyOrder); - return R.ok().put("orderSn", timeId); - } - - /** * 信息 */ @RequestMapping("/appGetOrderInfo/{type}") public R appGetOrderInfo(@PathVariable String type, @RequestParam("orderId") Integer orderId) { BuyOrderEntity buyOrder = buyOrderService.getById(orderId); - buyOrder.setTimestamp(buyOrder.getCreateTime().getTime()/1000); + buyOrder.setTimestamp(buyOrder.getCreateTime().getTime() / 1000); List orderDetail = null; if ("1".equals(type)) { orderDetail = buyOrderDetailService.getBaseMapper().selectList(new QueryWrapper() @@ -307,36 +219,6 @@ public class BuyOrderController { return R.ok().put("buyOrder", buyOrder).put("CreateTime", createDate).put("userRecordid", id); } - /** - * 计算快递费用 - */ - @RequestMapping("/getTransPrice/{area}") - public R getTransPrice(@PathVariable String area, @RequestParam Map productMap) { - Map params = new HashMap<>(); - params.put("kdCode", "YD"); - params.put("area", area); - int price = this.buyOrderService.getProductGoodsType(params, productMap); - return R.ok().put("price", price); - } - - - /** - * 后台发货按钮 - * - * @Param shipperCode 快递公司编码 - * @Param sendType 0:订单列表发货 1:商品列表发货 - * @Param type 合并发货/拆分发货 - * @Param ids 订单id串 - */ - @RequestMapping("/delivery/{shipperCode}") - public R delivery(@PathVariable("shipperCode") String shipperCode, @RequestParam("shipperName") String shipperName, @RequestBody Integer[] ids) { - - buyOrderService.sendFMS(ids, shipperCode, shipperName); - - return R.ok(); - } - - /** * 及时查询快递信息 */ @@ -381,44 +263,22 @@ public class BuyOrderController { } /** - * 批量发货功能 + * 分包发货 * - * @param orderDetailIds 订单详情 - * @return + * @param expressCompanyCode 快递公司编码 + * @param userAddressId 用户地址 ID + * @param productIds 商品 ID 列表 + * @return R */ - @RequestMapping("/blendSendFMS/{shipperCode}") - public R blendSendFMS(@PathVariable("shipperCode") String shipperCode, @RequestParam("shipperName") String shipperName, @RequestBody Integer[] orderDetailIds) { - - - buyOrderService.blendSendFMS(orderDetailIds, shipperCode, shipperName); + @RequestMapping(value = "/createSplitPackages", method = RequestMethod.POST) + public R createSplitPackageOrder(@RequestParam("expressCompanyCode") String expressCompanyCode, + @RequestParam("userAddressId") Integer userAddressId, + @RequestBody List productIds) { + buyOrderService.createSplitPackageOrder(expressCompanyCode, userAddressId, productIds); return R.ok(); } - /** - * 后台取消订单接口 - */ - @RequestMapping("/cancelFMS") - public R cancelFMS(@RequestParam Map params) { - buyOrderService.cancelFMS(params.get("orderSn").toString(), params.get("shipperCode").toString(), - params.get("expNo").toString()); - return R.ok().put("paramsTEXT", params); - } - - /** - * 去重查询可打印面单 - * - * @param params - * @return - */ - @RequestMapping("/querySheetPage") - public R querySheetPage(@RequestParam Map params) { - - PageUtils page = buyOrderDetailService.querySheet(params); - - return R.ok().put("page", page); - } - /** * 获取商品实际价格 * @@ -548,7 +408,7 @@ public class BuyOrderController { private MessagePostProcessor messagePostProcessor() { return message -> { //设置有效期30分钟 - message.getMessageProperties().setExpiration(String.valueOf(30*60*1000)); + message.getMessageProperties().setExpiration(String.valueOf(30 * 60 * 1000)); return message; }; } diff --git a/src/main/java/com/peanut/modules/book/controller/ExpressController.java b/src/main/java/com/peanut/modules/book/controller/ExpressController.java new file mode 100644 index 00000000..bee10721 --- /dev/null +++ b/src/main/java/com/peanut/modules/book/controller/ExpressController.java @@ -0,0 +1,39 @@ +package com.peanut.modules.book.controller; + +import com.peanut.common.utils.R; +import com.peanut.modules.book.service.ExpressCompanyService; +import com.peanut.modules.book.vo.ExpressCompanyVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @Description: 快递 Controller + * @Author: Cauchy + * @CreateTime: 2023/10/16 + */ +@RestController +@RequestMapping("/express") +public class ExpressController { + + private final ExpressCompanyService expressCompanyService; + + /** + * 获取快递公司列表 + * + * @return R + */ + @RequestMapping(path = "/getExpressCompanyList") + public R getExpressCompanyList() { + List expressCompanyList = expressCompanyService.getExpressCompanyList(); + return R.ok().put("result", expressCompanyList); + } + + @Autowired + ExpressController(ExpressCompanyService expressCompanyService) { + this.expressCompanyService = expressCompanyService; + } + +} diff --git a/src/main/java/com/peanut/modules/book/controller/ProvinceController.java b/src/main/java/com/peanut/modules/book/controller/ProvinceController.java index b461f3a8..a002b9d3 100644 --- a/src/main/java/com/peanut/modules/book/controller/ProvinceController.java +++ b/src/main/java/com/peanut/modules/book/controller/ProvinceController.java @@ -69,7 +69,6 @@ public class ProvinceController { public R getCityList(@RequestParam("provId") Integer provId){ List prov = cityService.getBaseMapper().selectList(new QueryWrapper() .eq("prov_id", provId)); - return R.ok().put("prov",prov); } diff --git a/src/main/java/com/peanut/modules/book/controller/UserAddressController.java b/src/main/java/com/peanut/modules/book/controller/UserAddressController.java index 8be428f8..752f9af5 100644 --- a/src/main/java/com/peanut/modules/book/controller/UserAddressController.java +++ b/src/main/java/com/peanut/modules/book/controller/UserAddressController.java @@ -1,133 +1,84 @@ package com.peanut.modules.book.controller; -import java.util.Arrays; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.peanut.common.utils.PageUtils; +import com.peanut.common.utils.R; +import com.peanut.modules.book.entity.UserAddress; +import com.peanut.modules.book.service.UserAddressService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + import java.util.List; import java.util.Map; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; -import com.peanut.modules.book.entity.UserAddressEntity; -import com.peanut.modules.book.service.UserAddressService; -import com.peanut.common.utils.PageUtils; -import com.peanut.common.utils.R; - - - -/** - * - * - * @author yl - * @email yl328572838@163.com - * @date 2022-10-31 11:20:32 - */ @RestController -@RequestMapping("book/useraddress") +@RequestMapping("book/userAddress") public class UserAddressController { @Autowired private UserAddressService userAddressService; /** - * 列表 + * 用户地址列表 + * + * @param params param + * @return R */ @RequestMapping("/list") -// @RequiresPermissions("book:useraddress:list") - public R list(@RequestParam Map params){ + public R list(@RequestParam Map params) { PageUtils page = userAddressService.queryPage(params); - return R.ok().put("page", page); } /** - * 信息 + * 获取地址信息 + * + * @param addressId address ID + * @return R */ - @RequestMapping("/info/{addressid}") -// @RequiresPermissions("book:useraddress:info") - public R info(@PathVariable("addressid") Integer addressid){ - UserAddressEntity userAddress = userAddressService.getById(addressid); - + @RequestMapping("/info/{addressId}") + public R info(@PathVariable("addressId") Integer addressId) { + UserAddress userAddress = userAddressService.getById(addressId); return R.ok().put("userAddress", userAddress); } /** - * 保存 + * 保存、更新 + * + * @param userAddress 用户地址 + * @return R */ @RequestMapping("/save") -// @RequiresPermissions("book:useraddress:save") - public R save(@RequestBody UserAddressEntity userAddress){ - Integer isdefault = userAddress.getIsdefault(); - if (isdefault == 1) { - Integer userid = userAddress.getUserid(); - List list = userAddressService.list(new QueryWrapper().eq("userId", userid)); - for (UserAddressEntity userAddressEntity : list) { - if (userAddressEntity.getIsdefault() == 1) { - userAddressEntity.setIsdefault(0); - } - } - userAddressService.updateBatchById(list); - } - userAddressService.save(userAddress); + public R save(@RequestBody UserAddress userAddress) { + userAddressService.saveOrUpdate(userAddress); return R.ok(); } /** - * 修改 + * 删除用户地址 + * + * @param id address ID + * @return R */ - @RequestMapping("/update") -// @RequiresPermissions("book:useraddress:update") - public R update(@RequestBody UserAddressEntity userAddress){ - - Integer isdefault = userAddress.getIsdefault(); - - if (isdefault == 1) { - - Integer userid = userAddress.getUserid(); - - List list = userAddressService.list(new QueryWrapper().eq("userId", userid)); - - for (UserAddressEntity userAddressEntity : list) { - if (userAddressEntity.getIsdefault() == 1) { - userAddressEntity.setIsdefault(0); - userAddressService.updateById(userAddressEntity); - } - } - - } - - userAddressService.updateById(userAddress); - + @RequestMapping(value = "/delete", method = RequestMethod.GET) + public R delete(@RequestParam("id") Integer id) { + userAddressService.removeById(id); return R.ok(); } /** - * 删除 - */ - @RequestMapping("/delete") -// @RequiresPermissions("book:useraddress:delete") - public R delete(@RequestBody Integer[] addressids){ - userAddressService.removeByIds(Arrays.asList(addressids)); - - return R.ok(); - } - - /** - * app获取用户 收货地址 + * 获取用户收货地址列表 + * + * @param userId 用户 ID + * @return R */ @RequestMapping("/getUserAddress") -// @RequiresPermissions("book:useraddress:delete") - public R getUserAddress(@RequestParam("userId") Integer userId){ - - List list = userAddressService.list(new QueryWrapper().eq("userId", userId).orderByDesc("isDefault")); - - return R.ok().put("list",list); + public R getUserAddress(@RequestParam("userId") Integer userId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("user_id", userId); + queryWrapper.orderByDesc("is_default"); + List userAddressList = userAddressService.list(queryWrapper); + return R.ok().put("list", userAddressList); } - - } diff --git a/src/main/java/com/peanut/modules/book/dao/BookClockinCommentDao.java b/src/main/java/com/peanut/modules/book/dao/BookClockinCommentDao.java deleted file mode 100644 index 78b3ec99..00000000 --- a/src/main/java/com/peanut/modules/book/dao/BookClockinCommentDao.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.peanut.modules.book.dao; - - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.github.yulichang.base.MPJBaseMapper; -import com.peanut.modules.book.entity.BookClockinCommentEntity; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface BookClockinCommentDao extends MPJBaseMapper { -} diff --git a/src/main/java/com/peanut/modules/book/dao/BookClockinDao.java b/src/main/java/com/peanut/modules/book/dao/BookClockinDao.java deleted file mode 100644 index 46e11221..00000000 --- a/src/main/java/com/peanut/modules/book/dao/BookClockinDao.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.peanut.modules.book.dao; - -import com.github.yulichang.base.MPJBaseMapper; -import com.peanut.modules.book.entity.BookClockInEntity; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface BookClockinDao extends MPJBaseMapper { - - - -} diff --git a/src/main/java/com/peanut/modules/book/dao/BookClockinPunchDao.java b/src/main/java/com/peanut/modules/book/dao/BookClockinPunchDao.java deleted file mode 100644 index 02a74121..00000000 --- a/src/main/java/com/peanut/modules/book/dao/BookClockinPunchDao.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.peanut.modules.book.dao; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.github.yulichang.base.MPJBaseMapper; -import com.peanut.modules.book.entity.BookClockinPunchEntity; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface BookClockinPunchDao extends MPJBaseMapper { - - - - -} diff --git a/src/main/java/com/peanut/modules/book/dao/ExpressCompanyDao.java b/src/main/java/com/peanut/modules/book/dao/ExpressCompanyDao.java new file mode 100644 index 00000000..a808c9c3 --- /dev/null +++ b/src/main/java/com/peanut/modules/book/dao/ExpressCompanyDao.java @@ -0,0 +1,18 @@ +package com.peanut.modules.book.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.peanut.modules.book.entity.ExpressCompany; +import com.peanut.modules.book.vo.ExpressCompanyVo; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * @Description: 快递公司持久层接口 + * @Author: Cauchy + * @CreateTime: 2023/10/16 + */ +@Mapper +public interface ExpressCompanyDao extends BaseMapper { + List getExpressCompanyList(); +} diff --git a/src/main/java/com/peanut/modules/book/dao/BookTaskDao.java b/src/main/java/com/peanut/modules/book/dao/ExpressFeeDao.java similarity index 55% rename from src/main/java/com/peanut/modules/book/dao/BookTaskDao.java rename to src/main/java/com/peanut/modules/book/dao/ExpressFeeDao.java index abc6323f..8bbe6672 100644 --- a/src/main/java/com/peanut/modules/book/dao/BookTaskDao.java +++ b/src/main/java/com/peanut/modules/book/dao/ExpressFeeDao.java @@ -1,9 +1,10 @@ package com.peanut.modules.book.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.peanut.modules.book.entity.BookTaskEntity; +import com.peanut.modules.book.entity.ExpressFee; import org.apache.ibatis.annotations.Mapper; @Mapper -public interface BookTaskDao extends BaseMapper { +public interface ExpressFeeDao extends BaseMapper { + } diff --git a/src/main/java/com/peanut/modules/book/dao/FMSCommodityDao.java b/src/main/java/com/peanut/modules/book/dao/FMSCommodityDao.java deleted file mode 100644 index 5a3bc160..00000000 --- a/src/main/java/com/peanut/modules/book/dao/FMSCommodityDao.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.peanut.modules.book.dao; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.peanut.modules.book.entity.FMSCommodity; -import com.peanut.modules.book.entity.FMSOrderEntity; -import org.apache.ibatis.annotations.Mapper; - -import java.util.List; - -/** - * 快递发货 - * - * @author yl - * @email yl328572838@163.com - * @date 2022-08-29 15:27:44 - */ -@Mapper -public interface FMSCommodityDao extends BaseMapper { - - /** - * 批量保存快递信息 - * - * @param fmsOrderList - * @return - */ - public int batchInsert(List fmsOrderList); - -} diff --git a/src/main/java/com/peanut/modules/book/dao/FMSOrderDao.java b/src/main/java/com/peanut/modules/book/dao/FMSOrderDao.java deleted file mode 100644 index 11c06bd2..00000000 --- a/src/main/java/com/peanut/modules/book/dao/FMSOrderDao.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.peanut.modules.book.dao; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.peanut.modules.book.entity.BuyOrderEntity; -import com.peanut.modules.book.entity.FMSOrderEntity; -import org.apache.ibatis.annotations.Mapper; - -import java.util.List; - -/** - * 快递发货 - * - * @author yl - * @email yl328572838@163.com - * @date 2022-08-29 15:27:44 - */ -@Mapper -public interface FMSOrderDao extends BaseMapper { - - /** - * 批量保存快递信息 - * - * @param fmsOrderList - * @return - */ - public int batchInsert(List fmsOrderList); - -} diff --git a/src/main/java/com/peanut/modules/book/dao/FMSOrderDetailDao.java b/src/main/java/com/peanut/modules/book/dao/FMSOrderDetailDao.java deleted file mode 100644 index 9475ae41..00000000 --- a/src/main/java/com/peanut/modules/book/dao/FMSOrderDetailDao.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.peanut.modules.book.dao; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.peanut.modules.book.entity.FMSOrderDetailEntity; -import org.apache.ibatis.annotations.Mapper; - - -@Mapper -public interface FMSOrderDetailDao extends BaseMapper { - -} diff --git a/src/main/java/com/peanut/modules/book/dao/ShopProductDao.java b/src/main/java/com/peanut/modules/book/dao/ShopProductDao.java index b80093e3..a6c85f0e 100644 --- a/src/main/java/com/peanut/modules/book/dao/ShopProductDao.java +++ b/src/main/java/com/peanut/modules/book/dao/ShopProductDao.java @@ -8,7 +8,7 @@ import java.util.List; /** * 商品表 - * + * * @author yl * @email yl328572838@163.com * @date 2022-10-28 09:43:14 @@ -17,5 +17,7 @@ import java.util.List; public interface ShopProductDao extends BaseMapper { List appGetCategoryList(Integer catId); - + + int getTotalWeight(List productIdList); + } diff --git a/src/main/java/com/peanut/modules/book/dao/UserAddressDao.java b/src/main/java/com/peanut/modules/book/dao/UserAddressDao.java index 59bc110e..bbfc4bb4 100644 --- a/src/main/java/com/peanut/modules/book/dao/UserAddressDao.java +++ b/src/main/java/com/peanut/modules/book/dao/UserAddressDao.java @@ -1,6 +1,6 @@ package com.peanut.modules.book.dao; -import com.peanut.modules.book.entity.UserAddressEntity; +import com.peanut.modules.book.entity.UserAddress; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; @@ -12,6 +12,6 @@ import org.apache.ibatis.annotations.Mapper; * @date 2022-10-31 11:20:32 */ @Mapper -public interface UserAddressDao extends BaseMapper { +public interface UserAddressDao extends BaseMapper { } diff --git a/src/main/java/com/peanut/modules/book/entity/BookClockInEntity.java b/src/main/java/com/peanut/modules/book/entity/BookClockInEntity.java deleted file mode 100644 index 3d4e7c82..00000000 --- a/src/main/java/com/peanut/modules/book/entity/BookClockInEntity.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.peanut.modules.book.entity; - -import com.baomidou.mybatisplus.annotation.*; -import lombok.Data; - -import java.io.Serializable; -import java.util.Date; - -/** - * - * 打卡评论表 - * @author - * @email - * @date - */ -@Data -@TableName("book_clockin") -public class BookClockInEntity implements Serializable { - - - - /** - * - */ - @TableId - private Integer id; - /** - * - */ - @TableField("book_id") - private Integer bookId; - /** - * - */ - @TableField("user_id") - private Integer userId; - /** - * - */ - @TableField("content") - private String content; - /** - * - */ - @TableField("clockin_sum") - private String clockinSum; - - - /** - * 集合 - */ - @TableField(exist = false) - private Object imageeStrings; - /** - *创建注解 - */ - @TableField(fill = FieldFill.INSERT) - private Date createTime; - /** - * - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private Date updateTime; - /** - * - */ - @TableLogic - private Integer delFlag; - /** - * - */ - @TableField("images") - private Object images; - /** - * - */ - @TableField("voices") - private String voices; - /** - * - */ - @TableField("like_s") - private String likes; - - /** - * - */ - @TableField(" like_sum") - private String likeSum; - /** - * - */ - @TableField(" comment_sum") - private String commentSum; - - //taskId 与 dayId 反转存储 - - - /** - * - * 打卡对应天id - */ - @TableField("day_id") - private Integer dayId; - /** - * 列表id - * - */ - @TableField("task_id") - private Integer taskId; - - - - -} diff --git a/src/main/java/com/peanut/modules/book/entity/BookClockinCommentEntity.java b/src/main/java/com/peanut/modules/book/entity/BookClockinCommentEntity.java deleted file mode 100644 index 178390a6..00000000 --- a/src/main/java/com/peanut/modules/book/entity/BookClockinCommentEntity.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.peanut.modules.book.entity; - - -import com.baomidou.mybatisplus.annotation.*; -import lombok.Data; - -import java.io.Serializable; -import java.util.Date; - - -/** - * 打卡评论追评表 - * - */ - -@Data -@TableName("book_clockin_comment") -public class BookClockinCommentEntity implements Serializable { - @TableId - private Integer id; - /** - * 签到表关联id - */ - @TableField("task_id") - private Integer taskId; - /** - * 图书id - */ - @TableField("book_id") - private Integer bookId; - /** - * 用户id - */ - @TableField("user_id") - private Integer userId; - /** - * 删除 - */ - @TableField("del_flag") - private Integer delFlag; - /** - * 图片 - */ - @TableField("images") - private String images; - /** - * 内容 - */ - @TableField("content") - private String content; - /** - * 点赞总数 - */ - @TableField("like_sum") - private String likeSum; - /** - *创建时间 - */ - @TableField(fill = FieldFill.INSERT) - private Date createTime; - /** - *修改时间 - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private Date updateTime; - - /** - * 关联评论 - */ - @TableField("pid") - private Integer pid; - - - - - - - - -} diff --git a/src/main/java/com/peanut/modules/book/entity/BookClockinPunchEntity.java b/src/main/java/com/peanut/modules/book/entity/BookClockinPunchEntity.java deleted file mode 100644 index 266954dc..00000000 --- a/src/main/java/com/peanut/modules/book/entity/BookClockinPunchEntity.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.peanut.modules.book.entity; -import com.baomidou.mybatisplus.annotation.*; -import lombok.Data; -import java.io.Serializable; -import java.util.Date; - -/** - * 签到表 - */ -@Data -@TableName("book_clockin_punch") -public class BookClockinPunchEntity implements Serializable { - - /** - * - */ - @TableId - private Integer id; - /** - * - */ - @TableField("book_id") - private Integer bookId; - /** - * - */ - @TableField("user_id") - private Integer userId; - /** - * - */ - @TableField("days") - private Integer days; - /** - *创建注解 - */ - @TableField(fill = FieldFill.INSERT) - private Date createTime; - /** - * - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private Date updateTime; - /** - * - */ - @TableField("t_id") - private Integer tId; - - - - @TableLogic - private Integer delFlag; - -} diff --git a/src/main/java/com/peanut/modules/book/entity/BookTaskEntity.java b/src/main/java/com/peanut/modules/book/entity/BookTaskEntity.java deleted file mode 100644 index 3b458763..00000000 --- a/src/main/java/com/peanut/modules/book/entity/BookTaskEntity.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.peanut.modules.book.entity; - -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.Date; - -/** - * 发布打卡内容表 - * - */ -@Data -@TableName("book_task") -public class BookTaskEntity implements Serializable { - /** - * - */ - @TableId - private Integer id; - /** - * - */ - @TableField("book_id") - private Integer bookid; - /** - * - */ - @TableField("content") - private String content; - /** - * - */ - @TableField("images") - private String images; - /** - * - */ - @TableField("voices") - private String voices; - /** - * - */ - @TableField("like_sun") - private String likesun; - - /** - * - */ - @TableField("days") - private String days; - /** - * - */ - - @TableField(fill = FieldFill.INSERT) - private Date createTime; - /** - * - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private Date updateTime; - - - /** - * 删除标记 - */ - @TableField("del_flag") - private Integer delFlag; - - @TableField("video") - private String video; - - @TableField("heading") - private String heading; - - - - -} diff --git a/src/main/java/com/peanut/modules/book/entity/BuyOrderDetailEntity.java b/src/main/java/com/peanut/modules/book/entity/BuyOrderDetailEntity.java index 42a33eaa..019662fe 100644 --- a/src/main/java/com/peanut/modules/book/entity/BuyOrderDetailEntity.java +++ b/src/main/java/com/peanut/modules/book/entity/BuyOrderDetailEntity.java @@ -16,7 +16,7 @@ import lombok.Data; * @author yl * @email yl328572838@163.com * @date 2022-08-29 15:27:44 - * @modify wu chunlei + * @modified Cauchy * @date 2023-10-07 13:06:00 */ @Data diff --git a/src/main/java/com/peanut/modules/book/entity/ExpressCompany.java b/src/main/java/com/peanut/modules/book/entity/ExpressCompany.java new file mode 100644 index 00000000..22791f04 --- /dev/null +++ b/src/main/java/com/peanut/modules/book/entity/ExpressCompany.java @@ -0,0 +1,37 @@ +package com.peanut.modules.book.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Description: 快递公司实体类 + * @Author: Cauchy + * @CreateTime: 2023/10/16 + */ +@Data +@TableName("express_company") +public class ExpressCompany implements Serializable { + /** + * ID + */ + private int id; + /** + * 快递公司名称 + */ + private String name; + /** + * 快递公司编码 + */ + private String code; + /** + * 创建时间 + */ + private Date createTime; + /** + * 删除标识 + */ + private int delFlag; +} diff --git a/src/main/java/com/peanut/modules/book/entity/ExpressFee.java b/src/main/java/com/peanut/modules/book/entity/ExpressFee.java new file mode 100644 index 00000000..79655e26 --- /dev/null +++ b/src/main/java/com/peanut/modules/book/entity/ExpressFee.java @@ -0,0 +1,46 @@ +package com.peanut.modules.book.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * @Description: 快递费实体类 + * @Author: Cauchy + * @CreateTime: 2023/10/16 + */ +@Data +@TableName("express_fee") +public class ExpressFee implements Serializable { + /** + * ID + */ + private int id; + /** + * 快递公司代码 + */ + private String expressCode; + /** + * 目的地代码 + */ + private String destCode; + /** + * 首重费用 + */ + private BigDecimal firstWeightFee; + /** + * 续重 + */ + private BigDecimal additionalWeightFee; + /** + * 创建时间 + */ + private Date createTime; + /** + * 删除标识 + */ + private int delFlag; +} diff --git a/src/main/java/com/peanut/modules/book/entity/ExpressOrder.java b/src/main/java/com/peanut/modules/book/entity/ExpressOrder.java new file mode 100644 index 00000000..aaa3afd8 --- /dev/null +++ b/src/main/java/com/peanut/modules/book/entity/ExpressOrder.java @@ -0,0 +1,45 @@ +package com.peanut.modules.book.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * @Description: 快递订单 + * @Author: Cauchy + * @CreateTime: 2023/10/16 + */ +@Data +@TableName("express_order") +public class ExpressOrder { + /** + * ID + */ + private int id; + /** + * 用户 ID + */ + private int userId; + /** + * 用户地址 ID + */ + private int userAddressId; + /** + * 快递费 + */ + private BigDecimal expressFee; + /** + * 总重量 + */ + private BigDecimal totalWeight; + /** + * 创建时间 + */ + private Date createTime; + /** + * 删除标识 + */ + private int delFlag; +} diff --git a/src/main/java/com/peanut/modules/book/entity/FMSCommodity.java b/src/main/java/com/peanut/modules/book/entity/FMSCommodity.java deleted file mode 100644 index 18df8045..00000000 --- a/src/main/java/com/peanut/modules/book/entity/FMSCommodity.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.peanut.modules.book.entity; - -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; - - -/** - * 发送快递商品详情 - */ -@Data -@TableName("fms_commodity") -public class FMSCommodity implements Serializable { - - private static final long serialVersionUID = 1L; - - @TableId - private Integer id; - - /** - * 商品名称 - */ - private String goodsName; - - /** - * 商品数量 - */ - private Integer goodsQuantity; - - /** - * 商品价格 - */ - private BigDecimal goodsPrice; - - /** - * 商品重量kg - */ - private Float goodsWeight; - - /** - * 商品描述 - */ - private String goodsDesc; - - /** - * 发送快递表主键 - */ - private Integer fmsOrderId; - - -} diff --git a/src/main/java/com/peanut/modules/book/entity/FMSOrderDetailEntity.java b/src/main/java/com/peanut/modules/book/entity/FMSOrderDetailEntity.java deleted file mode 100644 index 1f1b6cd6..00000000 --- a/src/main/java/com/peanut/modules/book/entity/FMSOrderDetailEntity.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.peanut.modules.book.entity; - -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; - -import java.io.Serializable; -import java.util.List; - -/** - * 发送快递信息实体 - */ -@Data -@TableName("fms_order_detail") -public class FMSOrderDetailEntity implements Serializable { - - private static final long serialVersionUID = 1L; - - @TableId - private Integer id; - - /** - * 订单id - */ - private Integer orderId; - - /** - * 订单商品id - */ - private Long detailId; - - /** - * 快递编号 - */ - private String orderCode; - - -} diff --git a/src/main/java/com/peanut/modules/book/entity/FMSOrderEntity.java b/src/main/java/com/peanut/modules/book/entity/FMSOrderEntity.java deleted file mode 100644 index 28cc2c20..00000000 --- a/src/main/java/com/peanut/modules/book/entity/FMSOrderEntity.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.peanut.modules.book.entity; - -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; - -import java.io.Serializable; -import java.util.List; - -/** - * 发送快递信息实体 - */ -@Data -@TableName("fms_order") -public class FMSOrderEntity implements Serializable { - - private static final long serialVersionUID = 1L; - - @TableId - private Integer id; - - /** - * 订单号 - */ - private String orderCode; - - /** - * 快递公司编码 - */ - private String shipperCode; - - /** - * 收件人姓名 - */ - private String receiverName; - - /** - * 收件人电话 - */ - private String receiverMobile; - - /** - * 收件省 - */ - private String receiverProvinceName; - - /** - * 收件市 - */ - private String receiverCityName; - - /** - * 收件区/县 - */ - private String receiverExpAreaName; - - /** - * 收件人详细地址 - */ - private String receiverAddress; - - /** - * 商品信息列表 - */ - private List commodityList; - - /** - * 备注 - */ - private String remark; - - /** - * 订单详情ID - */ - private Integer orderId; - - -} diff --git a/src/main/java/com/peanut/modules/book/entity/ShopProductEntity.java b/src/main/java/com/peanut/modules/book/entity/ShopProductEntity.java index 021ce6e6..0560cba6 100644 --- a/src/main/java/com/peanut/modules/book/entity/ShopProductEntity.java +++ b/src/main/java/com/peanut/modules/book/entity/ShopProductEntity.java @@ -45,7 +45,7 @@ public class ShopProductEntity implements Serializable { /** * 商品重量 */ - private Float weight; + private int weight; /** * 上架状态 */ diff --git a/src/main/java/com/peanut/modules/book/entity/UserAddress.java b/src/main/java/com/peanut/modules/book/entity/UserAddress.java new file mode 100644 index 00000000..8eec2e41 --- /dev/null +++ b/src/main/java/com/peanut/modules/book/entity/UserAddress.java @@ -0,0 +1,59 @@ +package com.peanut.modules.book.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.io.Serializable; +import java.util.Date; + +import lombok.Data; + +@Data +@TableName("user_address") +public class UserAddress implements Serializable { + + private static final long serialVersionUID = 1L; + /** + * 自增 ID + */ + @TableId + private int id; + /** + * 会员 ID + */ + private Integer userId; + /** + * 收货人 + */ + private String consigneeName; + /** + * 收货人手机号码 + */ + private String consigneePhone; + /** + * 区域代码 + */ + private String regionCode; + /** + * 详细地址 + */ + private String detailAddress; + /** + * 默认 + */ + private Integer isDefault; + /** + * 删除标识 + */ + @TableLogic + private Integer delFlag; + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private Date createTime; + /** + * 更新时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateTime; +} diff --git a/src/main/java/com/peanut/modules/book/entity/UserAddressEntity.java b/src/main/java/com/peanut/modules/book/entity/UserAddressEntity.java deleted file mode 100644 index 937b3b4f..00000000 --- a/src/main/java/com/peanut/modules/book/entity/UserAddressEntity.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.peanut.modules.book.entity; - -import com.baomidou.mybatisplus.annotation.*; - -import java.io.Serializable; -import java.util.Date; -import lombok.Data; - -/** - * - * - * @author yl - * @email yl328572838@163.com - * @date 2022-10-31 11:20:32 - */ -@Data -@TableName("user_address") -public class UserAddressEntity implements Serializable { - private static final long serialVersionUID = 1L; - - /** - * 自增ID - */ - @TableId - private Integer addressid; - /** - * 会员ID - */ - private Integer userid; - /** - * 收货人名称 - */ - private String username; - /** - * 收货人手机号码 - */ - private String userphone; - /** - * 区域ID路径 - */ - private String areaidpath; - /** - * 区域ID文字 - */ - private String areaidpathtext; - /** - * 最后一级区域ID - */ - private Integer areaid; - /** - * 详细地址 - */ - private String useraddress; - /** - * 默认 - */ - private Integer isdefault; - /** - * 有效状态 - */ - @TableLogic - private Integer delFlag; - /** - * 创建时间 - */ - @TableField(fill = FieldFill.INSERT)//创建注解 - private Date createTime; - /** - * 更新时间 - */ - @TableField(fill = FieldFill.INSERT_UPDATE)//更新注解 - private Date updateTime; - -} diff --git a/src/main/java/com/peanut/modules/book/service/BookClockInService.java b/src/main/java/com/peanut/modules/book/service/BookClockInService.java deleted file mode 100644 index 688d8887..00000000 --- a/src/main/java/com/peanut/modules/book/service/BookClockInService.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.peanut.modules.book.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.peanut.common.utils.PageUtils; -import com.peanut.modules.book.entity.BookClockInEntity; - -import java.util.Map; - -public interface BookClockInService extends IService { - PageUtils queryPage(Map params); - - PageUtils queryPagemylist(Map params); -} diff --git a/src/main/java/com/peanut/modules/book/service/BookClockinCommentService.java b/src/main/java/com/peanut/modules/book/service/BookClockinCommentService.java deleted file mode 100644 index 8be9c648..00000000 --- a/src/main/java/com/peanut/modules/book/service/BookClockinCommentService.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.peanut.modules.book.service; - - -import com.baomidou.mybatisplus.extension.service.IService; -import com.peanut.common.utils.PageUtils; -import com.peanut.modules.book.entity.BookClockinCommentEntity; - -import java.util.Map; - -public interface BookClockinCommentService extends IService { - PageUtils queryPage(Map params); -} diff --git a/src/main/java/com/peanut/modules/book/service/BookClockinPunchService.java b/src/main/java/com/peanut/modules/book/service/BookClockinPunchService.java deleted file mode 100644 index dbd140d5..00000000 --- a/src/main/java/com/peanut/modules/book/service/BookClockinPunchService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.peanut.modules.book.service; - - -import com.baomidou.mybatisplus.extension.service.IService; -import com.peanut.common.utils.PageUtils; -import com.peanut.modules.book.entity.BookClockinPunchEntity; - -import java.util.Map; - -public interface BookClockinPunchService extends IService { - - - PageUtils queryPage(Map params); -} diff --git a/src/main/java/com/peanut/modules/book/service/BookTaskService.java b/src/main/java/com/peanut/modules/book/service/BookTaskService.java deleted file mode 100644 index c9e15fdf..00000000 --- a/src/main/java/com/peanut/modules/book/service/BookTaskService.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.peanut.modules.book.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.peanut.common.utils.PageUtils; -import com.peanut.modules.book.entity.BookTaskEntity; - -import java.util.Map; - -public interface BookTaskService extends IService { - PageUtils queryPage(Map params); - - PageUtils queryPageServi(Map params); -} diff --git a/src/main/java/com/peanut/modules/book/service/BuyOrderDetailService.java b/src/main/java/com/peanut/modules/book/service/BuyOrderDetailService.java index 0ef452bf..e7650e48 100644 --- a/src/main/java/com/peanut/modules/book/service/BuyOrderDetailService.java +++ b/src/main/java/com/peanut/modules/book/service/BuyOrderDetailService.java @@ -21,7 +21,5 @@ public interface BuyOrderDetailService extends IService { PageUtils querybuy(Mapparams); - PageUtils querybuyss(Mapparams); - - public void batchUpdateByShippingSns(String[] shippingSnList); + void batchUpdateByShippingSns(String[] shippingSnList); } diff --git a/src/main/java/com/peanut/modules/book/service/BuyOrderService.java b/src/main/java/com/peanut/modules/book/service/BuyOrderService.java index 6a745f7e..98282a83 100644 --- a/src/main/java/com/peanut/modules/book/service/BuyOrderService.java +++ b/src/main/java/com/peanut/modules/book/service/BuyOrderService.java @@ -7,7 +7,6 @@ import com.peanut.common.utils.PageUtils; import com.peanut.common.utils.R; import com.peanut.modules.book.entity.BuyOrderEntity; -import javax.xml.soap.Text; import java.util.List; import java.util.Map; @@ -21,40 +20,18 @@ import java.util.Map; public interface BuyOrderService extends IService { PageUtils queryPage(Map params) throws Exception; - PageUtils queryPage1(Map params); //更新订单状态 - void updateOrderStatus(Integer userId,String orderSn,String type); - - // 发送快递 - public void sendFMS(Integer[] orderIds,String shipperCode,String shipperName); - - // 取消快递 - public void cancelFMS(String orderSn, String shipperCode, String expNo); + void updateOrderStatus(Integer userId, String orderSn, String type); // 及时查询 - public JSONObject queryFMS(String shipperCode, String expNo); + JSONObject queryFMS(String shipperCode, String expNo); // 查询勾选的订单是否有可合并 - public List checkOrder(Integer[] orderIds); + List checkOrder(Integer[] orderIds); // 查询所有订单是否有可合并 - public Page checkOrder(Map params); - - // 批量发货功能 - public void blendSendFMS(Integer[] orderDetailIds, String shipperCode, String shipperName); - - - public int getProductGoodsType (Map param,Map productMap); - - - public R randomOrderCode( BuyOrderEntity buyOrder); - - PageUtils querySheet(Map params); - - - PageUtils queryPages(Map params); - - -} + Page checkOrder(Map params); + void createSplitPackageOrder(String expressCompanyCode, Integer userAddressId, List shopProductIdList); +} \ No newline at end of file diff --git a/src/main/java/com/peanut/modules/book/service/ExpressCompanyService.java b/src/main/java/com/peanut/modules/book/service/ExpressCompanyService.java new file mode 100644 index 00000000..cce8b98a --- /dev/null +++ b/src/main/java/com/peanut/modules/book/service/ExpressCompanyService.java @@ -0,0 +1,23 @@ +package com.peanut.modules.book.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.peanut.modules.book.entity.ExpressCompany; +import com.peanut.modules.book.vo.ExpressCompanyVo; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @Description: 快递公司服务层 + * @Author: Cauchy + * @CreateTime: 2023/10/16 + */ +@Service +public interface ExpressCompanyService extends IService { + /** + * 获取快递公司列表 + * + * @return List + */ + List getExpressCompanyList(); +} diff --git a/src/main/java/com/peanut/modules/book/service/ExpressFeeService.java b/src/main/java/com/peanut/modules/book/service/ExpressFeeService.java new file mode 100644 index 00000000..93f6ebca --- /dev/null +++ b/src/main/java/com/peanut/modules/book/service/ExpressFeeService.java @@ -0,0 +1,20 @@ +package com.peanut.modules.book.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.peanut.modules.book.entity.ExpressFee; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; + +@Service +public interface ExpressFeeService extends IService { + /** + * 计算快递费 + * + * @param expressCompanyCode 快递公司代码 + * @param weight 重量 + * @param regionCode 地区代码 + * @return BigDecimal 费用 + */ + BigDecimal calculateExpressFee(String expressCompanyCode, int weight, String regionCode); +} diff --git a/src/main/java/com/peanut/modules/book/service/FMSOrderDetailService.java b/src/main/java/com/peanut/modules/book/service/FMSOrderDetailService.java deleted file mode 100644 index cce3ee99..00000000 --- a/src/main/java/com/peanut/modules/book/service/FMSOrderDetailService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.peanut.modules.book.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.peanut.common.utils.PageUtils; -import com.peanut.modules.book.entity.FMSOrderDetailEntity; -import com.peanut.modules.book.entity.FMSOrderEntity; - -import java.util.Map; - -public interface FMSOrderDetailService extends IService { - - PageUtils queryPage(Map params); -} - diff --git a/src/main/java/com/peanut/modules/book/service/UserAddressService.java b/src/main/java/com/peanut/modules/book/service/UserAddressService.java index cb8ca635..59fb6a40 100644 --- a/src/main/java/com/peanut/modules/book/service/UserAddressService.java +++ b/src/main/java/com/peanut/modules/book/service/UserAddressService.java @@ -2,7 +2,7 @@ package com.peanut.modules.book.service; import com.baomidou.mybatisplus.extension.service.IService; import com.peanut.common.utils.PageUtils; -import com.peanut.modules.book.entity.UserAddressEntity; +import com.peanut.modules.book.entity.UserAddress; import java.util.Map; @@ -13,7 +13,7 @@ import java.util.Map; * @email yl328572838@163.com * @date 2022-10-31 11:20:32 */ -public interface UserAddressService extends IService { +public interface UserAddressService extends IService { PageUtils queryPage(Map params); } diff --git a/src/main/java/com/peanut/modules/book/service/impl/BookClockInServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/BookClockInServiceImpl.java deleted file mode 100644 index b523cf85..00000000 --- a/src/main/java/com/peanut/modules/book/service/impl/BookClockInServiceImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.peanut.modules.book.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.peanut.common.utils.PageUtils; -import com.peanut.common.utils.Query; -import com.peanut.modules.book.dao.BookClockinDao; -import com.peanut.modules.book.entity.BookClockInEntity; -import com.peanut.modules.book.service.BookClockInService; -import org.springframework.stereotype.Service; - -import java.util.Map; - -@Service -public class BookClockInServiceImpl extends ServiceImpl implements BookClockInService { - - - @Override - public PageUtils queryPage(Map params) { - Object book = params.get("bookid"); - Object taskid = params.get("taskid"); - IPage page = this.page( - new Query().getPage(params), - new QueryWrapper() - .eq("book_id", book) - .eq("task_id", taskid) - .orderByDesc("create_time") - - ); - - return new PageUtils(page); - } - - @Override - public PageUtils queryPagemylist(Map params) { - IPage page = this.page( - new Query().getPage(params), - new QueryWrapper() - - ); - return new PageUtils(page); - } - -} \ No newline at end of file diff --git a/src/main/java/com/peanut/modules/book/service/impl/BookClockinCommentServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/BookClockinCommentServiceImpl.java deleted file mode 100644 index 14024d93..00000000 --- a/src/main/java/com/peanut/modules/book/service/impl/BookClockinCommentServiceImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.peanut.modules.book.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.peanut.common.utils.PageUtils; -import com.peanut.common.utils.Query; -import com.peanut.modules.book.dao.BookClockinCommentDao; -import com.peanut.modules.book.entity.BookClockinCommentEntity; -import com.peanut.modules.book.service.BookClockinCommentService; -import org.springframework.stereotype.Service; - -import java.util.Map; - -@Service -public class BookClockinCommentServiceImpl extends ServiceImpl implements BookClockinCommentService{ - - - @Override - public PageUtils queryPage(Map params) { - IPage page = this.page( - new Query().getPage(params), - new QueryWrapper().orderByDesc("create_time") - - ); - - return new PageUtils(page); - } -} diff --git a/src/main/java/com/peanut/modules/book/service/impl/BookClockinPunchServiceImp.java b/src/main/java/com/peanut/modules/book/service/impl/BookClockinPunchServiceImp.java deleted file mode 100644 index 2a33c9f9..00000000 --- a/src/main/java/com/peanut/modules/book/service/impl/BookClockinPunchServiceImp.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.peanut.modules.book.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.peanut.common.utils.PageUtils; -import com.peanut.common.utils.Query; -import com.peanut.modules.book.dao.BookClockinPunchDao; -import com.peanut.modules.book.entity.BookClockinPunchEntity; -import com.peanut.modules.book.service.BookClockinPunchService; -import org.springframework.stereotype.Service; - -import java.util.Map; - -@Service -public class BookClockinPunchServiceImp extends ServiceImpl implements BookClockinPunchService { - @Override - public PageUtils queryPage(Map params) { - - Object book =params.get("bookid"); - Object days = params.get("days"); - IPage page = this.page( - new Query().getPage(params), - new QueryWrapper() - .eq("book_id",book) - .eq("days",days) - .orderByDesc("create_time") - - ); - - return new PageUtils(page); - } - -} \ No newline at end of file diff --git a/src/main/java/com/peanut/modules/book/service/impl/BookTaskServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/BookTaskServiceImpl.java deleted file mode 100644 index 2a9cda40..00000000 --- a/src/main/java/com/peanut/modules/book/service/impl/BookTaskServiceImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.peanut.modules.book.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.peanut.common.utils.PageUtils; -import com.peanut.common.utils.Query; -import com.peanut.modules.book.dao.BookTaskDao; -import com.peanut.modules.book.entity.BookTaskEntity; -import com.peanut.modules.book.service.BookTaskService; -import org.springframework.stereotype.Service; - -import java.util.Map; - -@Service -public class BookTaskServiceImpl extends ServiceImpl implements BookTaskService { - - - @Override - public PageUtils queryPage(Map params) { - Object bookid = params.get("bookid"); - IPage page = this.page( - new Query().getPage(params), - new QueryWrapper().eq("book_id",bookid).orderByAsc("days") - - ); - - return new PageUtils(page); - } - - @Override - public PageUtils queryPageServi(Map params) { - Object bookid = params.get("bookid"); - Object days = params.get("days"); - IPage page = this.page( - new Query().getPage(params), - new QueryWrapper().eq("book_id",bookid).orderByDesc("create_time").eq("days",days) - ); - - return new PageUtils(page); - } -} \ No newline at end of file diff --git a/src/main/java/com/peanut/modules/book/service/impl/BuyOrderDetailServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/BuyOrderDetailServiceImpl.java index a20af434..596d516a 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/BuyOrderDetailServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/BuyOrderDetailServiceImpl.java @@ -1,15 +1,8 @@ package com.peanut.modules.book.service.impl; -import com.peanut.modules.book.entity.BookEntity; -import com.peanut.modules.book.entity.ShopProductEntity; -import com.peanut.modules.book.service.BookService; -import com.peanut.modules.book.service.ShopProductService; import jodd.util.StringUtil; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.awt.print.Book; -import java.util.ArrayList; import java.util.List; import java.util.Map; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -74,13 +67,6 @@ public class BuyOrderDetailServiceImpl extends ServiceImpl params) { - - - return null; - } - @Override public void batchUpdateByShippingSns(String[] shippingSnList) { diff --git a/src/main/java/com/peanut/modules/book/service/impl/BuyOrderServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/BuyOrderServiceImpl.java index a8074bed..dbaacb42 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/BuyOrderServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/BuyOrderServiceImpl.java @@ -1,6 +1,5 @@ package com.peanut.modules.book.service.impl; -import com.alibaba.druid.mock.MockConnection; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -9,19 +8,17 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.fasterxml.jackson.databind.ObjectMapper; import com.peanut.common.Interface.KdApiEOrder; import com.peanut.common.utils.ExcludeEmptyQueryWrapper; import com.peanut.common.utils.PageUtils; import com.peanut.common.utils.Query; -import com.peanut.common.utils.R; import com.peanut.modules.book.dao.BuyOrderDao; import com.peanut.modules.book.dao.BuyOrderDetailDao; +import com.peanut.modules.book.dao.ShopProductDao; import com.peanut.modules.book.entity.*; import com.peanut.modules.book.service.*; import com.peanut.modules.book.vo.ProductVo; import com.peanut.modules.book.vo.UserOrderVo; -import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -29,6 +26,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -44,17 +42,22 @@ public class BuyOrderServiceImpl extends ServiceImpl params) throws Exception { @@ -103,50 +106,6 @@ public class BuyOrderServiceImpl extends ServiceImpl params) { - - String orderStatus = (String) params.get("orderStatus"); - if (orderStatus.equals("9")) { - orderStatus = null; - } - - String userId = (String) params.get("userId"); - - IPage page = this.page( - new Query().getPage(params), - new QueryWrapper() - .eq("user_id", userId) - .eq(StringUtils.isNotBlank(orderStatus), "order_status", orderStatus) - .orderByDesc("create_time") - ); - List records = page.getRecords(); - for (BuyOrderEntity buyOrderEntity : records) { - Integer orderId = buyOrderEntity.getOrderId(); - buyOrderEntity.setTimestamp(buyOrderEntity.getCreateTime().getTime()/1000); - List entities = buyOrderDetailService.getBaseMapper().selectList(new QueryWrapper() - .eq("order_id", orderId)); - if (entities != null) { - for (BuyOrderDetailEntity entity : entities) { - Integer productId = entity.getProductId(); - ShopProductEntity shopPro = shopProductService.getById(productId); - if (shopPro != null) { - String productImages = shopPro.getProductImages(); - - entity.setImage(productImages); - } - - - } - } - - buyOrderEntity.setProducts(entities); - } - - return new PageUtils(page); - } - @Override public void updateOrderStatus(Integer userId, String orderSn, String type) { @@ -171,127 +130,6 @@ public class BuyOrderServiceImpl extends ServiceImpl fmsOrderList = new ArrayList<>(); - // 查询订单详情 - List orderList = this.buyOrderDao.queryListByOrderIds(orderIds); - Map userMap = new HashMap<>(); - // 清洗出有哪些用户 - for (BuyOrderEntity order : orderList) { - order.setOrderCode(timeId + order.getUserId()); - userMap.put(order.getUserId(), order); - } - this.saveOrUpdateBatch(orderList); - List keys = userMap.keySet().stream().collect(Collectors.toList()); - List buyOrderDetailList = this.buyOrderDetailDao.queryListByOrderIds(orderIds); - for (int k : keys) { - Object o = userMap.get(k); - BuyOrderEntity order = new ObjectMapper().convertValue(o, BuyOrderEntity.class); - - FMSOrderEntity fmsOrder = new FMSOrderEntity(); - // 生成一个新的订单号保存到订单表中 - fmsOrder.setOrderCode(order.getOrderCode()); - fmsOrder.setShipperCode(shipperCode); - fmsOrder.setReceiverName(order.getShippingUser()); - fmsOrder.setReceiverMobile(order.getUserPhone()); - fmsOrder.setReceiverProvinceName(order.getProvince()); - fmsOrder.setReceiverCityName(order.getCity()); - fmsOrder.setReceiverExpAreaName(order.getDistrict()); - fmsOrder.setReceiverAddress(order.getAddress()); - fmsOrder.setRemark(order.getRemark()); - List fmsCommoditylist = new ArrayList<>(); - for (BuyOrderDetailEntity orderDetail : buyOrderDetailList) { - if (orderDetail.getUserId().equals(k)) { - FMSCommodity fmsCommodity = new FMSCommodity(); - fmsCommodity.setGoodsName(orderDetail.getProductName()); - fmsCommodity.setGoodsQuantity(orderDetail.getQuantity()); - fmsCommodity.setGoodsPrice(orderDetail.getProductPrice()); - fmsCommodity.setGoodsWeight(orderDetail.getWeight()); - fmsCommodity.setGoodsDesc(orderDetail.getRemark()); - fmsCommodity.setFmsOrderId(orderDetail.getOrderId()); - fmsCommoditylist.add(fmsCommodity); - fmsOrder.setCommodityList(fmsCommoditylist); - } - } - fmsOrderList.add(fmsOrder); - } - - // 消息队列批量保存 -// fmsOrderDao.batchInsert(fmsOrderList); -// fmsCommodityDao.batchInsert(fmsCommoditylist); - - JSONArray jsonArr = KdApiEOrder.orderOnlineByJson(fmsOrderList); - for (Object jsobj : jsonArr) { - JSONObject json = JSONObject.parseObject(jsobj.toString()); - if ("true".equals(json.getString("Success"))) { - JSONObject jsonObj = JSONObject.parseObject(json.getString("Order")); - // 业务数据 - Map objMap = new HashMap<>(); - List list = this.list(new QueryWrapper().eq("order_code", jsonObj.getString("OrderCode"))); - for (BuyOrderEntity order : list) { - // 改变订单状态为已发货 - order.setOrderStatus("2"); - // 改变订单信息为已有商品发货 - order.setIsSend("1"); - this.updateById(order); - objMap.put(order.getOrderId(), order); - } - List orderIdList = objMap.keySet().stream().collect(Collectors.toList()); - Integer[] oIds = orderIdList.toArray(new Integer[orderIdList.size()]); - List buyOrderEntityList = this.buyOrderDetailDao.queryListByOrderIds(oIds); - String SortingCode = jsonObj.getString("SortingCode"); - for (BuyOrderDetailEntity buy : buyOrderEntityList) { - buy.setFmsHtml(json.getString("PrintTemplate")); - buy.setCreatTime(new Date()); - buy.setShippingSn(SortingCode.substring(0, SortingCode.indexOf("/"))); - buy.setShipperCode(jsonObj.getString("ShipperCode")); - buy.setShipperName(shipperName); - buy.setIsPrint("0"); - this.buyOrderDetailService.updateById(buy); - } - - } - } - logger.info("##########################结束批量发货!时间:" + new Date()); - } catch (Exception e) { - e.printStackTrace(); - } - - } - - /** - * 取消快递信息 - * - * @param orderSn 订单编号 - * @param shipperCode 快递公司编码 - * @param expNo 快递单号 - * @return - */ - @Override - public void cancelFMS(String orderSn, String shipperCode, String expNo) { - - Map param = new HashMap<>(); - param.put("orderSn", orderSn); - param.put("ShipperCode", shipperCode); - param.put("ExpNo", expNo); - try { - KdApiEOrder.cancelOrderByJson(param); - } catch (Exception e) { - e.printStackTrace(); - } - } /** * 及时查询快递信息 @@ -305,16 +143,7 @@ public class BuyOrderServiceImpl extends ServiceImpl param = new HashMap<>(); param.put("ShipperCode", shipperCode); param.put("LogisticCode", expNo); - //todo 如果使用顺丰需要加上CustomerName手机号后四位才可以 -// param.put("CustomerName",phone) try { - //todo expNo不等于1,则执行第一个代码块,否则执行第二个代码块。 5.5 -// if (!expNo.equals(1)) { -// 列出所有包裹 -// }else { -// 直接展示 -// } - String A = expNo; if (!expNo.equals(1)) { String rntStr = KdApiEOrder.queryOrderOnlineByJson(param); JSONObject jsonObject = JSONObject.parseObject(rntStr); @@ -464,204 +293,16 @@ public class BuyOrderServiceImpl extends ServiceImpl fmsList = new ArrayList<>(); - List washDetailList = new ArrayList<>(); - List detailList = this.buyOrderDetailService.list(new QueryWrapper()); + public void createSplitPackageOrder(String expressCompanyCode, Integer userAddressId, List shopProductIdList) { + // 根据商品 id 获取总重量 + int totalWeight = shopProductDao.getTotalWeight(shopProductIdList); + // 获取用户地址 + UserAddress address = userAddressService.getById(userAddressId); + // 计算快递费用 + BigDecimal expressFee = expressFeeService.calculateExpressFee(expressCompanyCode, totalWeight, address.getRegionCode()); + // 打印面单 - for (BuyOrderDetailEntity buy : detailList) { - for (int orderDetailId : orderDetailIds) { - if (buy.getAllOrderId() == orderDetailId) { - FMSOrderDetailEntity fms = new FMSOrderDetailEntity(); - fms.setDetailId(buy.getAllOrderId()); - fms.setOrderCode(timeId + buy.getUserId()); - fms.setOrderId(buy.getOrderId()); - fmsList.add(fms); - washDetailList.add(buy); - } - } - } - fmsOrderDetailService.saveBatch(fmsList); - - FMSOrderEntity fmsOrder = new FMSOrderEntity(); - // 初始化快递订单信息 - List fmsOrderList = new ArrayList<>(); - // 初始化快递商品信息 - List fmsCommoditylist = new ArrayList<>(); - - if (washDetailList != null && washDetailList.size() > 0) { - BuyOrderEntity order = this.getById(washDetailList.get(0).getOrderId()); - fmsOrder.setOrderCode(timeId + order.getUserId()); - fmsOrder.setShipperCode(shipperCode); - fmsOrder.setReceiverName(order.getShippingUser()); - fmsOrder.setReceiverMobile(order.getUserPhone()); - fmsOrder.setReceiverProvinceName(order.getProvince()); - fmsOrder.setReceiverCityName(order.getCity()); - fmsOrder.setReceiverExpAreaName(order.getDistrict()); - fmsOrder.setReceiverAddress(order.getAddress()); - for (BuyOrderDetailEntity buy : washDetailList) { - FMSCommodity fmsCommodity = new FMSCommodity(); - fmsCommodity.setGoodsName(buy.getProductName()); - fmsCommodity.setGoodsQuantity(buy.getQuantity()); - fmsCommodity.setGoodsPrice(buy.getProductPrice()); - fmsCommodity.setGoodsWeight(buy.getWeight()); - fmsCommodity.setGoodsDesc(buy.getRemark()); - fmsCommodity.setFmsOrderId(buy.getOrderId()); - fmsCommoditylist.add(fmsCommodity); - } - fmsOrder.setCommodityList(fmsCommoditylist); - fmsOrderList.add(fmsOrder); - JSONArray jsonArr = KdApiEOrder.orderOnlineByJson(fmsOrderList); - JSONObject json = JSONObject.parseObject(jsonArr.getString(0)); - if ("true".equals(json.getString("Success"))) { - JSONObject jsonObj = JSONObject.parseObject(json.getString("Order")); - String orderCode = jsonObj.getString("OrderCode"); - List fmsOrderDetailList = this.fmsOrderDetailService.list(new QueryWrapper().eq("order_code", orderCode)); - System.out.println("############################################开始进入判断4444444jsonArr!:" + jsonArr + "json=" + json + "orderCode=" + orderCode); - String SortingCode = jsonObj.getString("LogisticCode"); - String ShipperCode = jsonObj.getString("ShipperCode"); - String PrintTemplate = json.getString("PrintTemplate"); - for (FMSOrderDetailEntity fms : fmsOrderDetailList) { - BuyOrderEntity o = this.getById(fms.getOrderId()); - BuyOrderDetailEntity detail = this.buyOrderDetailService.getById(fms.getDetailId()); - detail.setOrderStatus("1"); - if (PrintTemplate.equals(buyOrderDetailService.getById(detail))) { - return; - } else { - detail.setFmsHtml(PrintTemplate); - } - -// detail.setFmsHtml(PrintTemplate); - detail.setCreatTime(new Date()); - detail.setShippingSn(SortingCode); - detail.setShipperCode(ShipperCode); - detail.setShipperName(shipperName); - detail.setIsPrint("0"); -// this.buyOrderDetailService.updateById(detail); - this.buyOrderDetailService.saveOrUpdate(detail); - List list = this.buyOrderDetailService.list(new QueryWrapper().eq("order_id", fms.getOrderId()) - .eq("order_status", "0")); - // .eq("order_status", "0") - if (list.size() == 0) { - o.setIsSend("1"); - o.setOrderStatus("2"); - } else { - o.setIsSend("1"); - } - this.updateById(o); - buyOrderDao.updateById(o); - - //todo 混合发货原本属于订单A的的信息无缘无故跑到订单B。或者订单C里面去 - - - // todo 打印面单快递单号重复 主要问题在html表格里面有 可能是数据太多导致混乱把数据清除再做一次混合发货 查看错误 - - Map map = new HashMap<>(); - buyOrderDetailService.querySheet(map); - } - - } - } - logger.info("##########################结束混合发货!时间:" + new Date()); - } catch (Exception e) { - e.printStackTrace(); - } - - } - - /** - * 根据商品类型计算快递费 - * - * @param param - * @param productMap - * @return - */ - - @Override - public int getProductGoodsType(Map param, Map productMap) { - // param : key商品Id,value商品数量 - // 定义不同种类的数组 - Map pictureMap = new HashMap<>(); - Map bookMap = new HashMap<>(); - List advanceBookingList = new ArrayList<>(); - List deviceList = new ArrayList<>(); - - int transPrice = 0; - - if (!ObjectUtils.isEmpty(productMap)) { - Set set = productMap.keySet(); - Iterator ite = set.iterator(); - while (ite.hasNext()) { - int i = 1; - Object next = ite.next(); - // 根据Id查询信息后 计算出各个种类商品的总重量 - ShopProductEntity product = this.shopProductService.getById(Integer.valueOf(next.toString())); - if ("0".equals(product.getIsFreeMail())) { - product.setWeight(0f); - } - if ("01".equals(product.getGoodsType())) { - if (ObjectUtils.isEmpty(pictureMap)) { - pictureMap.put("picture", (float) product.getWeight() * Integer.valueOf(productMap.get(next.toString()).toString())); - } else { - pictureMap.put("picture", (float) pictureMap.get("picture") + (float) product.getWeight() * Integer.valueOf(productMap.get(next.toString()).toString())); - } - } - if ("02".equals(product.getGoodsType())) { - if (ObjectUtils.isEmpty(bookMap)) { - bookMap.put("book", (float) product.getWeight() * Integer.valueOf(productMap.get(next.toString()).toString())); - } else { - bookMap.put("book", (float) bookMap.get("book") + (float) product.getWeight() * Integer.valueOf(productMap.get(next.toString()).toString())); - } - } - if ("03".equals(product.getGoodsType())) { - ProductVo p = new ProductVo(); - p.setKdCode(param.get("kdCode").toString()); - p.setArea(param.get("area").toString()); - p.setNum(Integer.valueOf(productMap.get(next.toString()).toString())); - p.setWeight(product.getWeight().intValue()); - deviceList.add(p); - } - if ("04".equals(product.getGoodsType())) { - ProductVo p = new ProductVo(); - p.setKdCode(param.get("kdCode").toString()); - p.setArea(param.get("area").toString()); - p.setNum(Integer.valueOf(productMap.get(next.toString()).toString())); - p.setWeight(product.getWeight().intValue()); - advanceBookingList.add(p); - } - } - } - if (!ObjectUtils.isEmpty(pictureMap)) { - pictureMap.put("kdCode", param.get("kdCode")); - pictureMap.put("area", param.get("area")); - pictureMap.put("weight", pictureMap.get("picture")); - transPrice += this.getTransPrice(pictureMap); - } - if (!ObjectUtils.isEmpty(bookMap)) { - bookMap.put("kdCode", param.get("kdCode")); - bookMap.put("area", param.get("area")); - bookMap.put("weight", bookMap.get("book")); - transPrice += this.getTransPrice(bookMap); - } - if (!ObjectUtils.isEmpty(deviceList)) { - transPrice += this.getTransPrice(deviceList); - } - if (!ObjectUtils.isEmpty(advanceBookingList)) { - transPrice += this.getTransPrice(advanceBookingList); - } - return transPrice; } @@ -674,65 +315,6 @@ public class BuyOrderServiceImpl extends ServiceImpl params) { - IPage page = this.page( - new Query().getPage(params), - new QueryWrapper().eq("is_print", "0") - .groupBy("shipping_sn") - ); - return new PageUtils(page); - } - - @Override - public PageUtils queryPages(Map params) { - - String orderStatus = (String) params.get("orderStatus"); - if (orderStatus.equals("9")) { - orderStatus = null; - } - - String userId = (String) params.get("userId"); - - IPage page = this.page( - new Query().getPage(params), - new QueryWrapper() - .eq("user_id", userId) - .eq(StringUtils.isNotBlank(orderStatus), "order_status", orderStatus) - .orderByDesc("create_time") - ); - List records = page.getRecords(); - for (BuyOrderEntity buyOrderEntity : records) { - Integer orderId = buyOrderEntity.getOrderId(); - List entities = buyOrderDetailService.getBaseMapper().selectList(new QueryWrapper() - .eq("order_id", orderId)); - for (BuyOrderDetailEntity entity : entities) { - Integer productId = entity.getProductId(); - ShopProductEntity shopPro = shopProductService.getById(productId); - entity.setImage(shopPro.getProductImages()); - } - buyOrderEntity.setProducts(entities); - } - - return new PageUtils(page); - } - /** * 计算仪器,预售快递费用 diff --git a/src/main/java/com/peanut/modules/book/service/impl/ExpressCompanyServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/ExpressCompanyServiceImpl.java new file mode 100644 index 00000000..b3435a86 --- /dev/null +++ b/src/main/java/com/peanut/modules/book/service/impl/ExpressCompanyServiceImpl.java @@ -0,0 +1,27 @@ +package com.peanut.modules.book.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.peanut.modules.book.dao.ExpressCompanyDao; +import com.peanut.modules.book.entity.ExpressCompany; +import com.peanut.modules.book.service.ExpressCompanyService; +import com.peanut.modules.book.vo.ExpressCompanyVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @Description: 快递公司服务层实现类 + * @Author: Cauchy + * @CreateTime: 2023/10/16 + */ +@Service +public class ExpressCompanyServiceImpl extends ServiceImpl implements ExpressCompanyService { + @Autowired + ExpressCompanyDao expressCompanyDao; + + @Override + public List getExpressCompanyList() { + return expressCompanyDao.getExpressCompanyList(); + } +} diff --git a/src/main/java/com/peanut/modules/book/service/impl/ExpressFeeServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/ExpressFeeServiceImpl.java new file mode 100644 index 00000000..4b24ba1a --- /dev/null +++ b/src/main/java/com/peanut/modules/book/service/impl/ExpressFeeServiceImpl.java @@ -0,0 +1,91 @@ +package com.peanut.modules.book.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.peanut.modules.book.dao.ExpressFeeDao; +import com.peanut.modules.book.entity.ExpressFee; +import com.peanut.modules.book.service.ExpressFeeService; + +import java.math.BigDecimal; +import java.math.MathContext; +import java.math.RoundingMode; + +/** + * @Description: 快递费用服务接口实现类 + * @Author: Cauchy + * @CreateTime: 2023/10/16 + */ +public class ExpressFeeServiceImpl extends ServiceImpl implements ExpressFeeService { + @Override + public BigDecimal calculateExpressFee(String expressCompanyCode, int weight, String regionCode) { + int integerPart = weight / 100; + int decimalPart = weight % 100; + // 将重量转换为公斤 + BigDecimal realWeight = BigDecimal.valueOf(integerPart).add(BigDecimal.valueOf(decimalPart) + .divide(new BigDecimal(100), MathContext.DECIMAL64)); + realWeight = realWeight.setScale(0, RoundingMode.UP); + BigDecimal fee = null; + switch (expressCompanyCode) { + case "SF": + fee = calculateSFExpressFee(realWeight, regionCode); + break; + case "YD": + fee = calculateYDExpressFee(realWeight, regionCode); + break; + } + return fee; + } + + /** + * 计算顺丰快递运费 + * + * @param weight 重量 + * @param regionCode 地区编码 + * @return 费用 + */ + private BigDecimal calculateSFExpressFee(BigDecimal weight, String regionCode) { + // 判断运费计算区间 + int weightInterval; + BigDecimal additionalWeight = null; + if (weight.compareTo(new BigDecimal(0)) >= 0 && weight.compareTo(new BigDecimal(3)) < 0) { + weightInterval = 1; + additionalWeight = weight.subtract(new BigDecimal(1)); + } else if (weight.compareTo(new BigDecimal(3)) >= 0 && weight.compareTo(new BigDecimal(15)) < 0) { + weightInterval = 2; + additionalWeight = weight.subtract(new BigDecimal(3)); + } else { + weightInterval = 3; + additionalWeight = weight.subtract(new BigDecimal(15)); + } + QueryWrapper queryWrapper = new QueryWrapper<>(); + regionCode = regionCode.substring(0, 3).concat("00"); + queryWrapper.eq("dest_code", regionCode); + queryWrapper.eq("weight_interval", weightInterval); + queryWrapper.eq("express_code", "SF"); + ExpressFee expressFee = this.getOne(queryWrapper); + BigDecimal firstWeightFee = expressFee.getFirstWeightFee(); + BigDecimal additionalWeightFee = (expressFee.getAdditionalWeightFee()).multiply(additionalWeight); + return firstWeightFee.add(additionalWeightFee); + } + + /** + * 计算韵达快递运费 + * + * @param weight 重量 + * @param regionCode 地区编码 + * @return 费用 + */ + private BigDecimal calculateYDExpressFee(BigDecimal weight, String regionCode) { + regionCode = regionCode.substring(0, 3).concat("00"); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("dest_code", regionCode); + queryWrapper.eq("express_code", "YD"); + ExpressFee expressFee = this.getOne(queryWrapper); + BigDecimal firstWeightFee = expressFee.getFirstWeightFee(); + if (weight.compareTo(new BigDecimal(0)) >= 0 && weight.compareTo(new BigDecimal(1)) < 0) { + return firstWeightFee; + } + BigDecimal additionalWeight = weight.subtract(new BigDecimal("1")); + return firstWeightFee.add(additionalWeight.multiply(expressFee.getAdditionalWeightFee())); + } +} diff --git a/src/main/java/com/peanut/modules/book/service/impl/FMSOrderDetailServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/FMSOrderDetailServiceImpl.java deleted file mode 100644 index e2a403a5..00000000 --- a/src/main/java/com/peanut/modules/book/service/impl/FMSOrderDetailServiceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.peanut.modules.book.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.peanut.common.utils.PageUtils; -import com.peanut.modules.book.dao.FMSOrderDetailDao; -import com.peanut.modules.book.entity.FMSOrderDetailEntity; -import com.peanut.modules.book.service.FMSOrderDetailService; -import org.springframework.stereotype.Service; - -import java.util.Map; - - -@Service("fmsOrderService") -public class FMSOrderDetailServiceImpl extends ServiceImpl - implements FMSOrderDetailService { - - @Override - public PageUtils queryPage(Map params) { - return null; - } -} diff --git a/src/main/java/com/peanut/modules/book/service/impl/UserAddressServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/UserAddressServiceImpl.java index 3d15ffb1..16d2d1dd 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/UserAddressServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/UserAddressServiceImpl.java @@ -9,21 +9,19 @@ import com.peanut.common.utils.PageUtils; import com.peanut.common.utils.Query; import com.peanut.modules.book.dao.UserAddressDao; -import com.peanut.modules.book.entity.UserAddressEntity; +import com.peanut.modules.book.entity.UserAddress; import com.peanut.modules.book.service.UserAddressService; @Service("userAddressService") -public class UserAddressServiceImpl extends ServiceImpl implements UserAddressService { +public class UserAddressServiceImpl extends ServiceImpl implements UserAddressService { @Override public PageUtils queryPage(Map params) { - IPage page = this.page( - new Query().getPage(params), - new QueryWrapper() + IPage page = this.page( + new Query().getPage(params), + new QueryWrapper<>() ); - return new PageUtils(page); } - } \ No newline at end of file diff --git a/src/main/java/com/peanut/modules/book/vo/ExpressCompanyVo.java b/src/main/java/com/peanut/modules/book/vo/ExpressCompanyVo.java new file mode 100644 index 00000000..43d4a273 --- /dev/null +++ b/src/main/java/com/peanut/modules/book/vo/ExpressCompanyVo.java @@ -0,0 +1,20 @@ +package com.peanut.modules.book.vo; + +import lombok.Data; + +/** + * @Description: 快递公司 Vo + * @Author: Cauchy + * @CreateTime: 2023/10/16 + */ +@Data +public class ExpressCompanyVo { + /** + * 快递公司名称 + */ + private String expressName; + /** + * 快递公司编码 + */ + private String expressCode; +} diff --git a/src/main/resources/cent/apiclient_cert.p12 b/src/main/resources/cent/apiclient_cert.p12 index c8f48277..d6c535a5 100644 Binary files a/src/main/resources/cent/apiclient_cert.p12 and b/src/main/resources/cent/apiclient_cert.p12 differ diff --git a/src/main/resources/mapper/book/BookClockinCommentDao.xml b/src/main/resources/mapper/book/BookClockinCommentDao.xml deleted file mode 100644 index cb28a9dc..00000000 --- a/src/main/resources/mapper/book/BookClockinCommentDao.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/mapper/book/BookClockinDao.xml b/src/main/resources/mapper/book/BookClockinDao.xml deleted file mode 100644 index 3f4a0aa3..00000000 --- a/src/main/resources/mapper/book/BookClockinDao.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/mapper/book/BookClockinPunchDao.xml b/src/main/resources/mapper/book/BookClockinPunchDao.xml deleted file mode 100644 index 5cf71a8a..00000000 --- a/src/main/resources/mapper/book/BookClockinPunchDao.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/mapper/book/BookTaskDao.xml b/src/main/resources/mapper/book/BookTaskDao.xml deleted file mode 100644 index 855906eb..00000000 --- a/src/main/resources/mapper/book/BookTaskDao.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/mapper/book/ExpressCompanyDao.xml b/src/main/resources/mapper/book/ExpressCompanyDao.xml new file mode 100644 index 00000000..4fcd83d4 --- /dev/null +++ b/src/main/resources/mapper/book/ExpressCompanyDao.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/book/ExpressFeeDao.xml b/src/main/resources/mapper/book/ExpressFeeDao.xml new file mode 100644 index 00000000..88ee20eb --- /dev/null +++ b/src/main/resources/mapper/book/ExpressFeeDao.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/book/FMSCommodityDao.xml b/src/main/resources/mapper/book/FMSCommodityDao.xml deleted file mode 100644 index af73b880..00000000 --- a/src/main/resources/mapper/book/FMSCommodityDao.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - ( - goods_name, - goods_quantity, - goods_price, - goods_weight, - goods_desc, - fms_order_id - ) - - - - - insert into fms_commodity - - values - - ( - #{item.goodsName},#{item.goodsQuantity},#{item.goodsPrice},#{item.goodsWeight},#{item.goodsDesc},#{item.fmsOrderId} - ) - - - - \ No newline at end of file diff --git a/src/main/resources/mapper/book/FMSOrderDao.xml b/src/main/resources/mapper/book/FMSOrderDao.xml deleted file mode 100644 index 4f8e11c4..00000000 --- a/src/main/resources/mapper/book/FMSOrderDao.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ( - order_code, - shipper_code, - receiver_name, - receiver_mobile, - receiver_province_name, - receiver_city_name, - receiverExp_area_name, - receiver_address, - remark, - order_id - ) - - - - - insert into fms_order - - values - - ( - #{item.orderCode},#{item.shipperCode},#{item.receiverName},#{item.receiverMobile},#{item.receiverProvinceName}, - #{item.receiverCityName},#{item.receiverExpAreaName},#{item.receiverAddress},#{item.remark},#{item.orderId} - ) - - - - \ No newline at end of file diff --git a/src/main/resources/mapper/book/FMSOrderDetailDao.xml b/src/main/resources/mapper/book/FMSOrderDetailDao.xml deleted file mode 100644 index 3b3a8696..00000000 --- a/src/main/resources/mapper/book/FMSOrderDetailDao.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/mapper/book/ShopProductDao.xml b/src/main/resources/mapper/book/ShopProductDao.xml index 9ed45b4a..eefe232d 100644 --- a/src/main/resources/mapper/book/ShopProductDao.xml +++ b/src/main/resources/mapper/book/ShopProductDao.xml @@ -3,42 +3,36 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -56,4 +50,11 @@ order by a.sort desc + + \ No newline at end of file diff --git a/src/main/resources/mapper/book/UserAddressDao.xml b/src/main/resources/mapper/book/UserAddressDao.xml index eaab1aa7..b30af89a 100644 --- a/src/main/resources/mapper/book/UserAddressDao.xml +++ b/src/main/resources/mapper/book/UserAddressDao.xml @@ -4,7 +4,7 @@ - + diff --git a/src/main/resources/weChatConfig.properties b/src/main/resources/weChatConfig.properties index 0a3a6a74..509e4a89 100644 --- a/src/main/resources/weChatConfig.properties +++ b/src/main/resources/weChatConfig.properties @@ -9,18 +9,18 @@ wxpay.notifyUrl:https://testapi.nuttyreading.com/pay/payNotify # ?? url wxpay.refundNotifyUrl:http://pjm6m9.natappfree.cc/pay/refundNotify # key pem -wxpay.keyPemPath:/usr/local/hs/peanut_book/target/classes/cent/apiclient_key.pem -#wxpay.keyPemPath:C:/Users/Cauchy/IdeaProjects/nuttyreading-java/src/main/resources/cent/apiclient_key.pem +#wxpay.keyPemPath:/usr/local/hs/peanut_book/target/classes/cent/apiclient_key.pem +wxpay.keyPemPath:C:/Users/Cauchy/IdeaProjects/nuttyreading-java/src/main/resources/cent/apiclient_key.pem #wxpay.keyPemPath:D:/hs/nuttyreading-java/src/main/resources/cent/apiclient_key.pem # ??? wxpay.serialNo:679AECB2F7AC4183033F713828892BA640E4EEE3 # API v3 key wxpay.apiV3Key:4aYFklzaULeGlr7oJPZ6rHWKcxjihZUF # ???? -wxpay.wechatPayCertificateUrl:/usr/local/hs/peanut_book/target/classes/cent/wechatpay_7B5676E3CDF56680D0414A009CE501C844DBE2D6.pem -# wxpay.wechatPayCertificateUrl:C:/Users/Cauchy/IdeaProjects/nuttyreading-java/src/main/resources/cent/wechatpay_7B5676E3CDF56680D0414A009CE501C844DBE2D6.pem +#wxpay.wechatPayCertificateUrl:/usr/local/hs/peanut_book/target/classes/cent/wechatpay_7B5676E3CDF56680D0414A009CE501C844DBE2D6.pem +wxpay.wechatPayCertificateUrl:C:/Users/Cauchy/IdeaProjects/nuttyreading-java/src/main/resources/cent/wechatpay_7B5676E3CDF56680D0414A009CE501C844DBE2D6.pem # wxpay.wechatPayCertificateUrl:D:/hs/nuttyreading-java/src/main/resources/cent/wechatpay_7B5676E3CDF56680D0414A009CE501C844DBE2D6.pem # ?? url -wxpay.privateKeyUrl:/usr/local/hs/peanut_book/target/classes/cent/apiclient_key.pem -#wxpay.privateKeyUrl:C:/Users/Cauchy/IdeaProjects/nuttyreading-java/src/main/resources/cent/apiclient_key.pem +#wxpay.privateKeyUrl:/usr/local/hs/peanut_book/target/classes/cent/apiclient_key.pem +wxpay.privateKeyUrl:C:/Users/Cauchy/IdeaProjects/nuttyreading-java/src/main/resources/cent/apiclient_key.pem #wxpay.privateKeyUrl:D:/hs/nuttyreading-java/src/main/resources/cent/apiclient_key.pem \ No newline at end of file