Merge branch 'master' of https://gitee.com/wjl2008_admin/nuttyreading-java
This commit is contained in:
@@ -1,352 +0,0 @@
|
||||
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
|
||||
*
|
||||
*
|
||||
* 系统级参数
|
||||
* 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 用户自定义回传字段
|
||||
* CustomerName String(50) C 电子面单客户号,需要下载《快递鸟电子面单客户号参数对照表.xlsx》,参考对应字段传值 https://www.kdniao.com/documents
|
||||
* CustomerPwd String(50) C 同上
|
||||
* SendSite String(50) C 同上
|
||||
* SendStaff String(50) C 同上
|
||||
* MonthCode String(20) C 同上
|
||||
* CustomArea String(500) O 商家自定义区域,需查看技术文档说明
|
||||
* WareHouseID String(30) C 发货仓编码(ShipperCode为JD或JDKY时必填)
|
||||
* TransType Int(2) O 京东(ShipperCode为JD或JDKY)的产品类型,需查看技术文档说明
|
||||
* ShipperCode String(10) R 快递公司编码详细编码参考《快递鸟接口支持快递公司编码.xlsx》 https://www.kdniao.com/documents
|
||||
* LogisticCode String(30) O 快递单号(仅宅急送可用)
|
||||
* OrderCode String(30) R 订单编号(自定义,不可重复)
|
||||
* ThrOrderCode String(50) C 京东商城的订单号(ShipperCode为JD且ExpType为1时必填)
|
||||
* PayType Int(1) R 运费支付方式:1-现付,2-到付,3-月结
|
||||
* ExpType String(2) R 详细快递类型参考《快递公司快递业务类型.xlsx》 https://www.kdniao.com/documents
|
||||
* IsReturnSignBill Int(1) O 是否要求签回单 0-不要求,1-要求
|
||||
* Receiver.Company String(30) O 收件人公司
|
||||
* Receiver.Name String(30) R 收件人
|
||||
* Receiver.Tel String(20) R 电话(电话与手机,必填一个)
|
||||
* Receiver.Mobile String(20) R 手机(电话与手机,必填一个)
|
||||
* Receiver.PostCode String(10) C 收件地邮编(ShipperCode为EMS、YZPY、YZBK时必填)
|
||||
* Receiver.ProvinceName String(20) R 收件省(如广东省,不要缺少“省”;如是直辖市,请直接传北京、上海等;如是自治区,请直接传广西壮族自治区等)
|
||||
* Receiver.CityName String(20) R 收件市(如深圳市,不要缺少“市;如是市辖区,请直接传北京市、上海市等”)
|
||||
* Receiver.ExpAreaName String(20) R 收件区/县(如福田区,不要缺少“区”或“县”)
|
||||
* Receiver.Address String(100) R 收件人详细地址(不用传省市区)
|
||||
* Sender.Company String(30) O 发件人公司
|
||||
* Sender.Name String(30) R 发件人
|
||||
* Sender.Tel String(20) R 电话(电话与手机,必填一个)
|
||||
* Sender.Mobile String(20) R 手机(电话与手机,必填一个)
|
||||
* Sender.PostCode String(10) C 发件地邮编(ShipperCode为EMS、YZPY、YZBK时必填)
|
||||
* Sender.ProvinceName String(20) R 发件省(如广东省,不要缺少“省”;如是直辖市,请直接传北京、上海等;如是自治区,请直接传广西壮族自治区等)
|
||||
* Sender.CityName String(20) R 发件市(如深圳市,不要缺少“市;如是市辖区,请直接传北京市、上海市等”)
|
||||
* Sender.ExpAreaName String(20) R 发件区/县(如福田区,不要缺少“区”或“县”)
|
||||
* Sender.Address String(100) R 发件人详细地址(不用传省市区)
|
||||
* IsNotice Int(1) O 是否通知快递员上门揽件 0-通知,1-不通知,不填则默认为1
|
||||
* StartDate String(32) O 上门揽件时间段,格式:YYYY-MM-DD HH24:MM:SS
|
||||
* EndDate String(32) O 上门揽件时间段,格式:YYYY-MM-DD HH24:MM:SS
|
||||
* Weight Double(10,3) C 包裹总重量kg 1、当为快运的订单时必填;2、ShipperCode为JD时必填;
|
||||
* Quantity Int(2) R 包裹数(最多支持300件)一个包裹对应一个运单号,如果是大于1个包裹,返回则按照子母件的方式返回母运单号和子运单号
|
||||
* Volume Double(20,3) C 包裹总体积m3 1、当为快运的订单时必填;2、ShipperCode为JD时必填;
|
||||
* Remark String(60) O 备注
|
||||
* AddService.Name String(20) C 增值服务名称(数组形式,可以有多个增值服务)
|
||||
* AddService.Value String(30) C 增值服务值
|
||||
* AddService.CustomerID String(30) O 客户标识
|
||||
* Commodity.GoodsName String(100) R 商品名称(数组形式)
|
||||
* IsReturnPrintTemplate String(1) O 是否返回电子面单模板:0-不需要,1-需要
|
||||
* IsSendMessage Int(1) O 是否订阅短信:0-不需要,1-需要
|
||||
* IsSubscribe String(1) O 是否订阅轨迹推送 0-不订阅,1-订阅,不填默认为1
|
||||
* TemplateSize String(10) O 模板规格,需查看技术文档说明
|
||||
* PackingType Int(2) C 包装类型(快运字段),需查看技术文档说明
|
||||
* DeliveryMethod Int(1) C 送货方式/派送类型/配送方式(快运字段),需查看技术文档说明
|
||||
* CurrencyCode String(10) C 货物单价的币种:CNY: 人民币 HKD: 港币 NTD: 新台币 MOP: 澳门元 (ShipperCode为SF且收件地址为港澳台地区,必填)
|
||||
* Dutiable.DeclaredValue Number(15,3) C 申报价值:订单货物总声明价值,包含子母件,精确到小数点后3位 (ShipperCode为SF且收件地址为港澳台地区,必填)
|
||||
*/
|
||||
|
||||
public class KdApiEOrder {
|
||||
|
||||
//用户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="34f033ae-9c73-4b9a-899e-943a65fd86bf";//即API key
|
||||
|
||||
|
||||
// 电子面单
|
||||
private static String OnlineReqURL="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 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";
|
||||
|
||||
|
||||
// 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<FMSOrderEntity> 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<String, String> params = new HashMap<String, String>();
|
||||
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<String,Object> param) throws Exception{
|
||||
|
||||
// 组装应用级参数
|
||||
String RequestData= "{"+
|
||||
"'ShipperCode':" +param.get("ShipperCode")+","+
|
||||
"'OrderCode': "+param.get("orderSn")+","+
|
||||
"'ExpNo': '"+param.get("ExpNo")+"',"+
|
||||
"}";
|
||||
// 组装系统级参数
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
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<String,Object> param) throws Exception{
|
||||
// 组装应用级参数
|
||||
String RequestData= "{"+
|
||||
"'ShipperCode': '"+ param.get("ShipperCode") +"',"+
|
||||
"'LogisticCode': '"+ param.get("LogisticCode") +"',"+
|
||||
"}";
|
||||
// 组装系统级参数
|
||||
Map<String,String> params = new HashMap<String,String>();
|
||||
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<String,Object> param) throws Exception{
|
||||
// 组装应用级参数
|
||||
String RequestData= "{"+
|
||||
"'Callback':'OrderCode',"+
|
||||
"'ShipperCode':'" + param.get("ShipperCode") + "',"+
|
||||
"'LogisticCode':'" + param.get("LogisticCode") + "',"+
|
||||
"}";
|
||||
// 组装系统级参数
|
||||
Map<String,String> params = new HashMap<String,String>();
|
||||
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 "";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,52 +2,46 @@ package com.peanut.common.utils;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.http.Consts;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.config.RequestConfig.Builder;
|
||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.conn.ConnectTimeoutException;
|
||||
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
|
||||
import org.apache.http.conn.ssl.SSLContextBuilder;
|
||||
import org.apache.http.conn.ssl.TrustStrategy;
|
||||
import org.apache.http.conn.ssl.X509HostnameVerifier;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLException;
|
||||
import javax.net.ssl.SSLSession;
|
||||
import javax.net.ssl.SSLSocket;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
public class HttpClientUtils {
|
||||
|
||||
public static final int connTimeout=10000;
|
||||
public static final int readTimeout=10000;
|
||||
public static final String charset="UTF-8";
|
||||
private static HttpClient client = null;
|
||||
public static final int connTimeout = 10000;
|
||||
public static final int readTimeout = 10000;
|
||||
public static final String charset = "UTF-8";
|
||||
private static HttpClient client;
|
||||
private static final Logger log = LoggerFactory.getLogger(HttpClientUtils.class);
|
||||
|
||||
static {
|
||||
@@ -57,24 +51,6 @@ public class HttpClientUtils {
|
||||
client = HttpClients.custom().setConnectionManager(cm).build();
|
||||
}
|
||||
|
||||
public static String postParameters(String url, String parameterStr) throws ConnectTimeoutException, SocketTimeoutException, Exception{
|
||||
return post(url,parameterStr,"application/x-www-form-urlencoded",charset,connTimeout,readTimeout);
|
||||
}
|
||||
|
||||
public static String postParameters(String url, String parameterStr,String charset, Integer connTimeout, Integer readTimeout) throws ConnectTimeoutException, SocketTimeoutException, Exception{
|
||||
return post(url,parameterStr,"application/x-www-form-urlencoded",charset,connTimeout,readTimeout);
|
||||
}
|
||||
|
||||
public static String postParameters(String url, Map<String, Object> params) throws ConnectTimeoutException,
|
||||
SocketTimeoutException, Exception {
|
||||
return postForm(url, params, null, connTimeout, readTimeout);
|
||||
}
|
||||
|
||||
public static String postParameters(String url, Map<String, Object> params, Integer connTimeout,Integer readTimeout) throws ConnectTimeoutException,
|
||||
SocketTimeoutException, Exception {
|
||||
return postForm(url, params, null, connTimeout, readTimeout);
|
||||
}
|
||||
|
||||
public static String get(String url) throws Exception {
|
||||
return get(url, charset, null, null);
|
||||
}
|
||||
@@ -87,9 +63,9 @@ public class HttpClientUtils {
|
||||
* 发送一个 Post 请求, 使用指定的字符集编码.
|
||||
*
|
||||
* @param url
|
||||
* @param body RequestBody
|
||||
* @param mimeType 例如 application/xml "application/x-www-form-urlencoded" a=1&b=2&c=3
|
||||
* @param charset 编码
|
||||
* @param body RequestBody
|
||||
* @param mimeType 例如 application/xml "application/x-www-form-urlencoded" a=1&b=2&c=3
|
||||
* @param charset 编码
|
||||
* @param connTimeout 建立链接超时时间,毫秒.
|
||||
* @param readTimeout 响应超时时间,毫秒.
|
||||
* @return ResponseBody, 使用指定的字符集编码.
|
||||
@@ -97,7 +73,7 @@ public class HttpClientUtils {
|
||||
* @throws SocketTimeoutException 响应超时
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String post(String url, String body, String mimeType,String charset, Integer connTimeout, Integer readTimeout)
|
||||
public static String post(String url, String body, String mimeType, String charset, Integer connTimeout, Integer readTimeout)
|
||||
throws ConnectTimeoutException, SocketTimeoutException, Exception {
|
||||
HttpClient client = null;
|
||||
HttpPost post = new HttpPost(url);
|
||||
@@ -130,7 +106,7 @@ public class HttpClientUtils {
|
||||
result = IOUtils.toString(res.getEntity().getContent(), charset);
|
||||
} finally {
|
||||
post.releaseConnection();
|
||||
if (url.startsWith("https") && client != null&& client instanceof CloseableHttpClient) {
|
||||
if (url.startsWith("https") && client instanceof CloseableHttpClient) {
|
||||
((CloseableHttpClient) client).close();
|
||||
}
|
||||
}
|
||||
@@ -138,73 +114,11 @@ public class HttpClientUtils {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 提交form表单
|
||||
*
|
||||
* @param url
|
||||
* @param params
|
||||
* @param connTimeout
|
||||
* @param readTimeout
|
||||
* @return
|
||||
* @throws ConnectTimeoutException
|
||||
* @throws SocketTimeoutException
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String postForm(String url, Map<String, Object> params, Map<String, String> headers, Integer connTimeout,Integer readTimeout) throws ConnectTimeoutException,
|
||||
SocketTimeoutException, Exception {
|
||||
|
||||
HttpClient client = null;
|
||||
HttpPost post = new HttpPost(url);
|
||||
try {
|
||||
if (params != null && !params.isEmpty()) {
|
||||
List<NameValuePair> formParams = new ArrayList<NameValuePair>();
|
||||
Set<Entry<String, Object>> entrySet = params.entrySet();
|
||||
for (Entry<String, Object> entry : entrySet) {
|
||||
formParams.add(new BasicNameValuePair(entry.getKey(), entry.toString()));
|
||||
}
|
||||
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formParams, Consts.UTF_8);
|
||||
post.setEntity(entity);
|
||||
}
|
||||
|
||||
if (headers != null && !headers.isEmpty()) {
|
||||
for (Entry<String, String> entry : headers.entrySet()) {
|
||||
post.addHeader(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
// 设置参数
|
||||
Builder customReqConf = RequestConfig.custom();
|
||||
if (connTimeout != null) {
|
||||
customReqConf.setConnectTimeout(connTimeout);
|
||||
}
|
||||
if (readTimeout != null) {
|
||||
customReqConf.setSocketTimeout(readTimeout);
|
||||
}
|
||||
post.setConfig(customReqConf.build());
|
||||
HttpResponse res = null;
|
||||
if (url.startsWith("https")) {
|
||||
// 执行 Https 请求.
|
||||
client = createSSLInsecureClient();
|
||||
res = client.execute(post);
|
||||
} else {
|
||||
// 执行 Http 请求.
|
||||
client = HttpClientUtils.client;
|
||||
res = client.execute(post);
|
||||
}
|
||||
return IOUtils.toString(res.getEntity().getContent(), "UTF-8");
|
||||
} finally {
|
||||
post.releaseConnection();
|
||||
if (url.startsWith("https") && client != null
|
||||
&& client instanceof CloseableHttpClient) {
|
||||
((CloseableHttpClient) client).close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送一个 GET 请求
|
||||
*/
|
||||
public static String get(String url, String charset, Integer connTimeout,Integer readTimeout)
|
||||
throws ConnectTimeoutException,SocketTimeoutException, Exception {
|
||||
public static String get(String url, String charset, Integer connTimeout, Integer readTimeout)
|
||||
throws Exception {
|
||||
|
||||
HttpClient client = null;
|
||||
HttpGet get = new HttpGet(url);
|
||||
@@ -248,7 +162,7 @@ public class HttpClientUtils {
|
||||
@SuppressWarnings("unused")
|
||||
private static String getCharsetFromResponse(HttpResponse ressponse) {
|
||||
// Content-Type:text/html; charset=GBK
|
||||
if (ressponse.getEntity() != null && ressponse.getEntity().getContentType() != null && ressponse.getEntity().getContentType().getValue() != null) {
|
||||
if (ressponse.getEntity() != null && ressponse.getEntity().getContentType() != null && ressponse.getEntity().getContentType().getValue() != null) {
|
||||
String contentType = ressponse.getEntity().getContentType().getValue();
|
||||
if (contentType.contains("charset=")) {
|
||||
return contentType.substring(contentType.indexOf("charset=") + 8);
|
||||
@@ -259,16 +173,13 @@ public class HttpClientUtils {
|
||||
|
||||
/**
|
||||
* 创建 SSL连接
|
||||
*
|
||||
* @return
|
||||
* @throws GeneralSecurityException
|
||||
*/
|
||||
private static CloseableHttpClient createSSLInsecureClient() throws GeneralSecurityException {
|
||||
try {
|
||||
SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustStrategy() {
|
||||
public boolean isTrusted(X509Certificate[] chain,String authType) throws CertificateException {
|
||||
return true;
|
||||
}
|
||||
}).build();
|
||||
SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, (chain, authType) -> true).build();
|
||||
|
||||
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext, new X509HostnameVerifier() {
|
||||
|
||||
@@ -278,18 +189,16 @@ public class HttpClientUtils {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void verify(String host, SSLSocket ssl)
|
||||
throws IOException {
|
||||
public void verify(String host, SSLSocket ssl) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void verify(String host, X509Certificate cert)
|
||||
throws SSLException {
|
||||
public void verify(String host, X509Certificate cert) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void verify(String host, String[] cns,
|
||||
String[] subjectAlts) throws SSLException {
|
||||
String[] subjectAlts) {
|
||||
}
|
||||
});
|
||||
return HttpClients.custom().setSSLSocketFactory(sslsf).build();
|
||||
@@ -300,83 +209,11 @@ public class HttpClientUtils {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 向指定 URL 发送POST方法的请求
|
||||
*
|
||||
* @param url 发送请求的 URL
|
||||
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
|
||||
* @return 所代表远程资源的响应结果
|
||||
*/
|
||||
public static String sendPost(String url, String param)
|
||||
{
|
||||
PrintWriter out = null;
|
||||
BufferedReader in = null;
|
||||
StringBuilder result = new StringBuilder();
|
||||
try
|
||||
{
|
||||
log.info("sendPost - {}", url);
|
||||
URL realUrl = new URL(url);
|
||||
URLConnection conn = realUrl.openConnection();
|
||||
conn.setRequestProperty("accept", "*/*");
|
||||
conn.setRequestProperty("connection", "Keep-Alive");
|
||||
conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
||||
conn.setRequestProperty("Accept-Charset", "utf-8");
|
||||
conn.setRequestProperty("contentType", "utf-8");
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
out = new PrintWriter(conn.getOutputStream());
|
||||
out.print(param);
|
||||
out.flush();
|
||||
in = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null)
|
||||
{
|
||||
result.append(line);
|
||||
}
|
||||
log.info("recv - {}", result);
|
||||
}
|
||||
catch (ConnectException e)
|
||||
{
|
||||
log.error("调用HttpUtils.sendPost ConnectException, url=" + url + ",param=" + param, e);
|
||||
}
|
||||
catch (SocketTimeoutException e)
|
||||
{
|
||||
log.error("调用HttpUtils.sendPost SocketTimeoutException, url=" + url + ",param=" + param, e);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
log.error("调用HttpUtils.sendPost IOException, url=" + url + ",param=" + param, e);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("调用HttpsUtil.sendPost Exception, url=" + url + ",param=" + param, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (out != null)
|
||||
{
|
||||
out.close();
|
||||
}
|
||||
if (in != null)
|
||||
{
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
log.error("调用in.close Exception, url=" + url + ",param=" + param, ex);
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 快递鸟向指定 URL 发送POST方法的请求
|
||||
* url 发送请求的 URL
|
||||
* params 请求的参数集合
|
||||
*
|
||||
* @return 远程资源的响应结果
|
||||
*/
|
||||
public static String kdSendPost(String url, Map<String, String> params) {
|
||||
@@ -385,7 +222,7 @@ public class HttpClientUtils {
|
||||
StringBuilder result = new StringBuilder();
|
||||
try {
|
||||
URL realUrl = new URL(url);
|
||||
HttpURLConnection conn =(HttpURLConnection) realUrl.openConnection();
|
||||
HttpURLConnection conn = (HttpURLConnection) realUrl.openConnection();
|
||||
// 发送POST请求必须设置如下两行
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
@@ -399,27 +236,27 @@ public class HttpClientUtils {
|
||||
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
conn.connect();
|
||||
// 获取URLConnection对象对应的输出流
|
||||
out = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
|
||||
out = new OutputStreamWriter(conn.getOutputStream(), StandardCharsets.UTF_8);
|
||||
// 发送请求参数
|
||||
if (params != null) {
|
||||
StringBuilder param = new StringBuilder();
|
||||
for (Map.Entry<String, String> entry : params.entrySet()) {
|
||||
if(param.length()>0){
|
||||
if (param.length() > 0) {
|
||||
param.append("&");
|
||||
}
|
||||
param.append(entry.getKey());
|
||||
param.append("=");
|
||||
param.append(entry.getValue());
|
||||
log.info(entry.getKey()+":"+entry.getValue());
|
||||
log.info(entry.getKey() + ":" + entry.getValue());
|
||||
}
|
||||
log.info("param:"+param.toString());
|
||||
log.info("param:" + param.toString());
|
||||
out.write(param.toString());
|
||||
}
|
||||
// flush输出流的缓冲
|
||||
out.flush();
|
||||
// 定义BufferedReader输入流来读取URL的响应
|
||||
in = new BufferedReader(
|
||||
new InputStreamReader(conn.getInputStream(), "UTF-8"));
|
||||
new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
result.append(line);
|
||||
@@ -428,22 +265,18 @@ public class HttpClientUtils {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//使用finally块来关闭输出流、输入流
|
||||
finally{
|
||||
try{
|
||||
if(out!=null){
|
||||
finally {
|
||||
try {
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
if(in!=null){
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
catch(IOException ex){
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -43,8 +43,7 @@ public class KdUtils {
|
||||
}
|
||||
|
||||
public static String urlEncoder(String str, String charset) throws UnsupportedEncodingException{
|
||||
String result = URLEncoder.encode(str, charset);
|
||||
return result;
|
||||
return URLEncoder.encode(str, charset);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,7 +54,7 @@ public class KdUtils {
|
||||
* @throws UnsupportedEncodingException ,Exception
|
||||
* @return DataSign签名
|
||||
*/
|
||||
public static String encrypt (String content, String keyValue, String charset) throws UnsupportedEncodingException, Exception
|
||||
public static String encrypt (String content, String keyValue, String charset) throws Exception
|
||||
{
|
||||
if (keyValue != null)
|
||||
{
|
||||
|
||||
@@ -3,9 +3,9 @@ package com.peanut.common.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.peanut.modules.book.entity.CityEntity;
|
||||
import com.peanut.modules.book.entity.CountyEntity;
|
||||
import com.peanut.modules.book.entity.ProvinceEntity;
|
||||
import com.peanut.modules.book.entity.City;
|
||||
import com.peanut.modules.book.entity.County;
|
||||
import com.peanut.modules.book.entity.Province;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
@@ -14,7 +14,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class ReadProvinceUtil {
|
||||
public static List<ProvinceEntity> getFile(String filePath) {
|
||||
public static List<Province> getFile(String filePath) {
|
||||
JSONArray proJsonArray = null;
|
||||
JSONArray cityJsonArray = null;
|
||||
JSONArray countyJsonArray = null;
|
||||
@@ -23,9 +23,9 @@ public class ReadProvinceUtil {
|
||||
JSONObject countyJson = null;
|
||||
Date date = new Date();
|
||||
|
||||
List<ProvinceEntity> provinceList = null;
|
||||
List<CityEntity> cityList = null;
|
||||
List<CountyEntity> countyList = null;
|
||||
List<Province> provinceList = null;
|
||||
List<City> cityList = null;
|
||||
List<County> countyList = null;
|
||||
|
||||
// String path = request.getSession().getServletContext().getRealPath("/");
|
||||
// path = path + filePath;
|
||||
@@ -39,29 +39,29 @@ public class ReadProvinceUtil {
|
||||
if (proJson != null) {
|
||||
// 取出数据
|
||||
proJsonArray = proJson.getJSONArray("china");
|
||||
provinceList = new ArrayList<ProvinceEntity>();
|
||||
provinceList = new ArrayList<Province>();
|
||||
if (proJsonArray != null) {
|
||||
for (int i = 0; i < proJsonArray.size(); i++) {
|
||||
ProvinceEntity province = new ProvinceEntity();
|
||||
Province province = new Province();
|
||||
JSONObject temp = proJsonArray.getJSONObject(i);
|
||||
province.setProvName(temp.getString("name"));
|
||||
province.setCreateDate(date);
|
||||
province.setRegionCode(temp.getString("code"));
|
||||
|
||||
cityJsonArray = JSONArray.parseArray(temp.getString("cityList"));
|
||||
cityList = new ArrayList<CityEntity>();
|
||||
cityList = new ArrayList<City>();
|
||||
if (cityJsonArray != null) {
|
||||
for (int j = 0; j < cityJsonArray.size(); j++) {
|
||||
CityEntity city = new CityEntity();
|
||||
City city = new City();
|
||||
cityJson = cityJsonArray.getJSONObject(j);
|
||||
city.setCityName(cityJson.getString("name"));
|
||||
city.setRegionCode(cityJson.getString("code"));
|
||||
city.setCreateDate(date);
|
||||
countyJsonArray = JSONArray.parseArray(cityJson.getString("areaList"));
|
||||
countyList = new ArrayList<CountyEntity>();
|
||||
countyList = new ArrayList<County>();
|
||||
if (countyJsonArray != null) {
|
||||
for (int k = 0; k < countyJsonArray.size(); k++) {
|
||||
CountyEntity county = new CountyEntity();
|
||||
County county = new County();
|
||||
countyJson = countyJsonArray.getJSONObject(k);
|
||||
county.setCountyName(countyJson.getString("name"));
|
||||
county.setRegionCode(countyJson.getString("code"));
|
||||
|
||||
@@ -56,4 +56,33 @@ public class Constants {
|
||||
* 购买方式 - 购物车
|
||||
*/
|
||||
public static final String BUY_TYPE_CART = "1";
|
||||
|
||||
/**
|
||||
* 快递鸟 API key
|
||||
*/
|
||||
public static final String EXPRESS_API_KEY = "f4342e6c-5cfa-458f-997b-f973eb29eb1d";
|
||||
/**
|
||||
* business ID
|
||||
*/
|
||||
public static final String EXPRESS_BUSINESS_ID = "1788532";
|
||||
/**
|
||||
* 顺丰月付码
|
||||
*/
|
||||
public static final String EXPRESS_SF_MONTH_CODE = "0226032007";
|
||||
/**
|
||||
* 快递接口指令-下单
|
||||
*/
|
||||
public static final String EXPRESS_REQUEST_TYPE_PLACE_ORDER = "1007";
|
||||
/**
|
||||
* 快递接口指令-下单
|
||||
*/
|
||||
public static final String EXPRESS_REQUEST_TYPE_QUERY = "1002";
|
||||
/**
|
||||
* 快递接口 - 下单 URL
|
||||
*/
|
||||
public static final String EXPRESS_PLACE_ORDER_URL = "https://api.kdniao.com/api/EOrderService";
|
||||
/**
|
||||
* 快递接口 - 查询 URL
|
||||
*/
|
||||
public static final String EXPRESS_QUERY_URL = "https://api.kdniao.com/Ebusiness/EbusinessOrderHandle.aspx";
|
||||
}
|
||||
@@ -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<String, Object> 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<BookClockinCommentEntity>()
|
||||
.eq("book_id", bookid1)
|
||||
.eq("user_id", userId)
|
||||
.eq("task_id", taskId)
|
||||
|
||||
);
|
||||
BookClockinPunchEntity ClockinCommen = bookClockinPunchService.getBaseMapper().selectOne(new QueryWrapper<BookClockinPunchEntity>()
|
||||
.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<BookClockInEntity>()
|
||||
.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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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<String, Object> 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<BookClockInEntity> bookClockinEntityList = bookClockinService.getBaseMapper().selectList(new QueryWrapper<BookClockInEntity>()
|
||||
.eq("book_id", bookid).eq("task_id", taskid));
|
||||
List list = new ArrayList<>();
|
||||
for (BookClockInEntity bookClockinEntity : bookClockinEntityList) {
|
||||
Map<String, Object> 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<MyUserEntity> id = myUserService.getBaseMapper().selectList(new QueryWrapper<MyUserEntity>().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<String, Object> 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<BookClockinPunchEntity>()
|
||||
.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<BookClockInEntity>()
|
||||
.eq("book_id", bookId)
|
||||
.eq("task_id", taskId)
|
||||
.eq("day_id", dayId)
|
||||
.eq("user_id", userId)
|
||||
);
|
||||
if (bookClockin!=null) {
|
||||
return R.error("您已参与第"+dayId+"天签到评论");
|
||||
}
|
||||
List<Map<String, String>> imageList = (ArrayList<Map<String, String>>) 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<String, Object> productMap = new HashMap<>();
|
||||
//根据bookid查找出签到表中签到的用户数据
|
||||
List<BookClockInEntity> bookid = bookClockinService.getBaseMapper().selectList(new QueryWrapper<BookClockInEntity>()
|
||||
.eq("book_id", bookId)
|
||||
.orderByDesc("create_time"));
|
||||
|
||||
for (BookClockInEntity book : bookid) {
|
||||
HashMap<Object, Object> 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<BookClockInEntity> bookClockinEntityList = bookClockinService.getBaseMapper().selectList(new QueryWrapper<BookClockInEntity>()
|
||||
.eq("user_id",id) .eq("book_id",bookId).orderByDesc("create_time"));
|
||||
List list = new ArrayList<>();
|
||||
|
||||
for (BookClockInEntity bookClockinEntity : bookClockinEntityList) {
|
||||
Map<String, Object> 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<MyUserEntity> myUserid = myUserService.getBaseMapper().selectList(new QueryWrapper<MyUserEntity>().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<String, Object> productMap = new HashMap<>();
|
||||
BookClockInEntity bookClockin = bookClockinService.getBaseMapper().selectOne(new QueryWrapper<BookClockInEntity>()
|
||||
.eq("user_id",id)
|
||||
.eq("task_id",taskid)
|
||||
.eq("book_id",bookId)
|
||||
);
|
||||
BookClockinPunchEntity bookClockinPunchEntity = bookClockinPunchService.getBaseMapper().selectOne(new QueryWrapper<BookClockinPunchEntity>()
|
||||
.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<MyUserEntity> myUserid = myUserService.getBaseMapper().selectList(new QueryWrapper<MyUserEntity>().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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<String, Object> 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<BookClockinPunchEntity>()
|
||||
.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<UserEbookBuyEntity> 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<BookEntity> userBookEntityPage = userEbookBuyDao.selectJoinPage(new Page<BookEntity>(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<BookEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(BookEntity::getDelFlag, 0);
|
||||
wrapper.eq(BookEntity::getClockIn, 1);
|
||||
wrapper.notExists(not_ex_sql);
|
||||
Page<BookEntity> 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<Object> list = new ArrayList<>();
|
||||
List<BookClockinCommentEntity> bookClockinCommentEntities = bookClockinCommentService.getBaseMapper().selectList(new QueryWrapper<BookClockinCommentEntity>()
|
||||
.eq("user_id", userId)
|
||||
.eq("book_id", bookId)
|
||||
.eq("task_id", days)
|
||||
//pid等于1时为一级评论
|
||||
// .eq("pid",1)
|
||||
);
|
||||
for (BookClockinCommentEntity bookClockinCommentEntity : bookClockinCommentEntities) {
|
||||
HashMap<Object, Object> 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<MyUserEntity> id = myUserService.getBaseMapper().selectList(new QueryWrapper<MyUserEntity>().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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -747,18 +747,18 @@ public class BookController {
|
||||
@RequestMapping("/file")
|
||||
public String getFile() {
|
||||
String filePath = "C:\\Users\\Administrator\\IdeaProjects\\peanut_book\\2020年8月中华人民共和国县以上行政区划代码.json";
|
||||
List<ProvinceEntity> provinceList = ReadProvinceUtil.getFile(filePath);
|
||||
List<Province> provinceList = ReadProvinceUtil.getFile(filePath);
|
||||
// System.out.println(provinceList);
|
||||
if (provinceList != null && provinceList.size() > 0) {
|
||||
for (ProvinceEntity province : provinceList) {
|
||||
for (Province province : provinceList) {
|
||||
// ProvinceEntity provinceEntity = new ProvinceEntity();
|
||||
// provinceEntity.setProvName(province.getProvName());
|
||||
// provinceEntity.setCreateDate(province.getCreateDate());
|
||||
// provinceEntity.setRegionCode(province.getRegionCode());
|
||||
provinceService.save(province);
|
||||
List<CityEntity> cityList = province.getCityList();
|
||||
List<City> cityList = province.getCityList();
|
||||
if (cityList != null && cityList.size() > 0) {
|
||||
for (CityEntity city : cityList) {
|
||||
for (City city : cityList) {
|
||||
// CityEntity cityEntity = new CityEntity();
|
||||
// cityEntity.setCreateDate(city.getCreateDate());
|
||||
// cityEntity.setCityName(city.getCityName());
|
||||
@@ -766,9 +766,9 @@ public class BookController {
|
||||
// city.setProvId(province.getProvId());
|
||||
city.setProvId(province.getProvId());
|
||||
cityService.save(city);
|
||||
List<CountyEntity> countyList = city.getCountyList();
|
||||
List<County> countyList = city.getCountyList();
|
||||
if (countyList != null && countyList.size() > 0) {
|
||||
for (CountyEntity county : countyList) {
|
||||
for (County county : countyList) {
|
||||
// CountyEntity countyEntity = new CountyEntity();
|
||||
county.setCityId(city.getCityId());
|
||||
// countyEntity.setCountyName(county.getCountyName());
|
||||
|
||||
@@ -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<String, Object> params) {
|
||||
PageUtils page = bookTaskService.queryPage(params);
|
||||
|
||||
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 列表app根据days查询
|
||||
*
|
||||
*/
|
||||
@RequestMapping("/applist")
|
||||
public R applist(@RequestParam Map<String, Object> 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> bookClockinPunchEntity = bookClockinPunchService.getBaseMapper().selectList(new QueryWrapper<BookClockinPunchEntity>()
|
||||
.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<BookClockinPunchEntity> books = bookClockinPunchService.getBaseMapper().selectList(new QueryWrapper<BookClockinPunchEntity>()
|
||||
.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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.peanut.modules.book.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
@@ -11,8 +10,15 @@ import com.peanut.config.Constants;
|
||||
import com.peanut.config.DelayQueueConfig;
|
||||
import com.peanut.modules.book.entity.*;
|
||||
import com.peanut.modules.book.service.*;
|
||||
import com.peanut.modules.book.vo.request.ProductRequestVo;
|
||||
import com.peanut.modules.book.vo.request.ProductTransportVo;
|
||||
import com.peanut.modules.book.vo.response.ExpressQueryResponseVo;
|
||||
import com.peanut.modules.book.vo.ShippingAddressRequestVo;
|
||||
import com.peanut.modules.book.vo.UserAddressVo;
|
||||
import com.peanut.modules.pay.weChatPay.dto.WechatPaymentInfo;
|
||||
import com.peanut.modules.pay.weChatPay.service.WxpayService;
|
||||
import com.peanut.modules.sys.entity.SysConfigEntity;
|
||||
import com.peanut.modules.sys.service.SysConfigService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.MessagePostProcessor;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
@@ -22,6 +28,8 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.MathContext;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -35,7 +43,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("book/buyorder")
|
||||
@RequestMapping("book/buyOrder")
|
||||
public class BuyOrderController {
|
||||
@Autowired
|
||||
private BuyOrderService buyOrderService;
|
||||
@@ -56,14 +64,19 @@ public class BuyOrderController {
|
||||
@Autowired
|
||||
private UserEbookBuyService userEbookBuyService;
|
||||
@Autowired
|
||||
private UserRecordService userRecordService;
|
||||
@Autowired
|
||||
private WxpayService wxpayService;
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Autowired
|
||||
private ShopProductBookService shopProductBookService;
|
||||
@Autowired
|
||||
private ExpressOrderService expressOrderService;
|
||||
@Autowired
|
||||
private UserAddressService userAddressService;
|
||||
@Autowired
|
||||
private ExpressFeeService expressFeeService;
|
||||
@Autowired
|
||||
private SysConfigService sysConfigService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
@@ -78,33 +91,6 @@ public class BuyOrderController {
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param params
|
||||
* @return 听书未购买页面展示
|
||||
* (销量最多的书,最先放最前面展示。最新上线的书,预售的书,放最前面展示
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/lists")
|
||||
public R lists(@RequestParam Map<String, Object> 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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下单
|
||||
*
|
||||
@@ -113,13 +99,13 @@ public class BuyOrderController {
|
||||
*/
|
||||
@RequestMapping("/buySave")
|
||||
@Transactional
|
||||
public R buySave(@RequestBody BuyOrderEntity buyOrder) throws IOException {
|
||||
public R buySave(@RequestBody BuyOrder buyOrder) throws IOException {
|
||||
// 获取订单详情
|
||||
List<BuyOrderDetailEntity> products = buyOrder.getProducts();
|
||||
List<BuyOrderDetail> buyOrderDetails = buyOrder.getProducts();
|
||||
// 订单总金额
|
||||
BigDecimal totalPrice = new BigDecimal(0);
|
||||
// 遍历商品总价计算
|
||||
for (BuyOrderDetailEntity buyOrderDetail : products) {
|
||||
for (BuyOrderDetail buyOrderDetail : buyOrderDetails) {
|
||||
Integer productId = buyOrderDetail.getProductId();
|
||||
int quantity = buyOrderDetail.getQuantity();
|
||||
ShopProductEntity product = shopProductService.getById(productId);
|
||||
@@ -130,7 +116,11 @@ public class BuyOrderController {
|
||||
totalPrice = totalPrice.add(price.multiply(BigDecimal.valueOf(quantity)));
|
||||
buyOrderDetail.setProductName(product.getProductName());
|
||||
buyOrderDetail.setProductPrice(product.getPrice());
|
||||
buyOrderDetail.setAddressId(buyOrder.getAddressId());
|
||||
int originWeight = product.getWeight();
|
||||
int originWeightIntValue = originWeight / 100;
|
||||
int originWeightDecimalValue = originWeightIntValue % 100;
|
||||
buyOrderDetail.setWeight(BigDecimal.valueOf(originWeightIntValue).add(BigDecimal.valueOf(originWeightDecimalValue).divide(new BigDecimal(100),
|
||||
MathContext.DECIMAL64)));
|
||||
buyOrderDetail.setProductUrl(product.getProductImages());
|
||||
buyOrderDetail.setOrderStatus(Constants.ORDER_STATUS_TO_BE_PAID);
|
||||
}
|
||||
@@ -140,16 +130,24 @@ public class BuyOrderController {
|
||||
String orderSn = IdWorker.getTimeId().substring(0, 32);
|
||||
buyOrder.setOrderSn(orderSn);
|
||||
buyOrder.setPaymentDate(new Date());
|
||||
QueryWrapper<UserAddress> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("id", buyOrder.getAddressId());
|
||||
UserAddress userAddress = userAddressService.getOne(queryWrapper);
|
||||
UserAddressVo vo = new UserAddressVo();
|
||||
vo = userAddressService.getAddressName(vo, userAddress.getRegionCode());
|
||||
buyOrder.setProvince(vo.getProvince());
|
||||
buyOrder.setCity(vo.getCity());
|
||||
buyOrder.setDistrict(vo.getCity());
|
||||
buyOrderService.save(buyOrder);
|
||||
|
||||
for (BuyOrderDetailEntity buyOrderDetail : products) {
|
||||
for (BuyOrderDetail buyOrderDetail : buyOrderDetails) {
|
||||
buyOrderDetail.setOrderId(buyOrder.getOrderId());
|
||||
buyOrderDetail.setUserId(buyOrder.getUserId());
|
||||
if (Constants.BUY_TYPE_CART.equals(buyOrder.getBuyType())) {
|
||||
handleBuyCart(buyOrder, buyOrderDetail);
|
||||
}
|
||||
}
|
||||
buyOrderDetailService.saveBatch(products);
|
||||
buyOrderDetailService.saveBatch(buyOrderDetails);
|
||||
// 1. 虚拟币支付
|
||||
if (Constants.PAYMENT_METHOD_VIRTUAL.equals(buyOrder.getPaymentMethod())) {
|
||||
buyOrder.setOrderStatus(Constants.ORDER_STATUS_TO_BE_SHIPPED);
|
||||
@@ -158,7 +156,7 @@ public class BuyOrderController {
|
||||
// 更新订单状态
|
||||
buyOrderService.updateOrderStatus(user.getId(), buyOrder.getOrderSn(), "0");
|
||||
recordTransaction(buyOrder, user, totalPrice);
|
||||
addEbookToUser(products, buyOrder);
|
||||
addEbookToUser(buyOrderDetails, buyOrder);
|
||||
} else {
|
||||
return R.error(500, "花生币余额不足!");
|
||||
}
|
||||
@@ -183,12 +181,39 @@ public class BuyOrderController {
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/calculateTransportPrice", method = RequestMethod.POST)
|
||||
public R getTransportPrice(@RequestBody ProductTransportVo vo) {
|
||||
String regionCode = vo.getRegionCode();
|
||||
List<ProductRequestVo> products = vo.getProducts();
|
||||
BigDecimal totalWeight = new BigDecimal(0);
|
||||
for (ProductRequestVo product : products) {
|
||||
ShopProductEntity shopProduct = shopProductService.getById(product.getProductId());
|
||||
BigDecimal weight = BigDecimal.valueOf(Double.valueOf(shopProduct.getWeight()) / 1000.0);
|
||||
totalWeight = totalWeight.add(weight.multiply(new BigDecimal(product.getQuantity())));
|
||||
}
|
||||
totalWeight = totalWeight.setScale(0, RoundingMode.UP);
|
||||
QueryWrapper<SysConfigEntity> configQueryWrapper = new QueryWrapper<>();
|
||||
configQueryWrapper.eq("param_key", "DEFAULT_EXPRESS");
|
||||
SysConfigEntity config = sysConfigService.getOne(configQueryWrapper);
|
||||
BigDecimal expressFee = expressFeeService.calculateExpressFee(config.getParamValue(), totalWeight, regionCode);
|
||||
return R.ok().put("result", expressFee);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/getMyOrderList")
|
||||
public R getMyOrderList(@RequestParam Map<String, Object> params) {
|
||||
PageUtils page = buyOrderService.queryPage1(params);
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
public R update(@RequestBody BuyOrderEntity buyOrder) {
|
||||
public R update(@RequestBody BuyOrder buyOrder) {
|
||||
buyOrderService.updateById(buyOrder);
|
||||
return R.ok();
|
||||
}
|
||||
@@ -202,15 +227,6 @@ public class BuyOrderController {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/appUserGetlist")
|
||||
public R appUserGetlist(@RequestParam Map<String, Object> params) {
|
||||
PageUtils page = buyOrderService.queryPage1(params);
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* app 端 取消订单
|
||||
@@ -220,7 +236,7 @@ public class BuyOrderController {
|
||||
public R appDelete(@RequestParam("orderId") Integer orderId) {
|
||||
|
||||
//1. 判断订单状态
|
||||
BuyOrderEntity byId = buyOrderService.getById(orderId);
|
||||
BuyOrder byId = buyOrderService.getById(orderId);
|
||||
if (byId != null) {
|
||||
//2. 判断当前订单是否存在优惠券 进行 回显
|
||||
Integer couponId = byId.getCouponId();
|
||||
@@ -231,9 +247,9 @@ public class BuyOrderController {
|
||||
couponHistoryService.updateById(byId1);
|
||||
}
|
||||
// 库存回滚
|
||||
List<BuyOrderDetailEntity> buyOrderDetailEntities = buyOrderDetailService.getBaseMapper().selectList(new QueryWrapper<BuyOrderDetailEntity>()
|
||||
List<BuyOrderDetail> buyOrderDetailEntities = buyOrderDetailService.getBaseMapper().selectList(new QueryWrapper<BuyOrderDetail>()
|
||||
.eq("order_id", byId.getOrderId()));
|
||||
for (BuyOrderDetailEntity buyOrderDetailEntity : buyOrderDetailEntities) {
|
||||
for (BuyOrderDetail buyOrderDetailEntity : buyOrderDetailEntities) {
|
||||
Integer productId = buyOrderDetailEntity.getProductId();
|
||||
ShopProductEntity product = shopProductService.getById(productId);
|
||||
product.setProductStock(product.getProductStock() + buyOrderDetailEntity.getQuantity());
|
||||
@@ -244,23 +260,18 @@ public class BuyOrderController {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping("/randomOrderCode")
|
||||
@Transactional
|
||||
public R randomOrderCode(@RequestBody BuyOrderEntity buyOrder) {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 充值专用订单生成接口
|
||||
*/
|
||||
@RequestMapping("/rechargeSave")
|
||||
@Transactional
|
||||
public R rechargeSave(@RequestBody BuyOrderEntity buyOrder) throws IOException {
|
||||
public R rechargeSave(@RequestBody BuyOrder buyOrder) throws IOException {
|
||||
String timeId = IdWorker.getTimeId().substring(0, 32);
|
||||
buyOrder.setOrderSn(timeId);
|
||||
buyOrderService.save(buyOrder);
|
||||
//下单微信支付预付款订单
|
||||
BuyOrderEntity buyOrderEntity = buyOrderService.getBaseMapper().selectOne(new LambdaQueryWrapper<BuyOrderEntity>().eq(BuyOrderEntity::getOrderSn, timeId));
|
||||
BuyOrder buyOrderEntity = buyOrderService.getBaseMapper().selectOne(new LambdaQueryWrapper<BuyOrder>().eq(BuyOrder::getOrderSn, timeId));
|
||||
WechatPaymentInfo paymentInfo = new WechatPaymentInfo();
|
||||
paymentInfo.setOrderSn(buyOrderEntity.getOrderSn());
|
||||
paymentInfo.setBuyOrderId(Integer.valueOf(buyOrderEntity.getProductId()));
|
||||
@@ -271,121 +282,84 @@ public class BuyOrderController {
|
||||
|
||||
/**
|
||||
* 获取订单详情
|
||||
*
|
||||
* @param orderId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getOrderDetail")
|
||||
public R getOrderDetail(@RequestParam Integer orderId){
|
||||
LambdaQueryWrapper<BuyOrderEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(BuyOrderEntity::getOrderId,orderId);
|
||||
BuyOrderEntity one = buyOrderService.getOne(wrapper);
|
||||
if(one.equals(null)){
|
||||
public R getOrderDetail(@RequestParam Integer orderId) {
|
||||
LambdaQueryWrapper<BuyOrder> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(BuyOrder::getOrderId, orderId);
|
||||
BuyOrder one = buyOrderService.getOne(wrapper);
|
||||
if (one.equals(null)) {
|
||||
return R.error("order error:order is null");
|
||||
}
|
||||
//添加用户信息
|
||||
one.setUser(myUserService.getById(one.getUserId()));
|
||||
//添加商品信息
|
||||
LambdaQueryWrapper<BuyOrderDetailEntity> wrapper1 = new LambdaQueryWrapper<>();
|
||||
wrapper1.eq(BuyOrderDetailEntity::getOrderId,orderId);
|
||||
List<BuyOrderDetailEntity> buyOrderDetailEntities = buyOrderDetailService.getBaseMapper().selectList(wrapper1);
|
||||
LambdaQueryWrapper<BuyOrderDetail> wrapper1 = new LambdaQueryWrapper<>();
|
||||
wrapper1.eq(BuyOrderDetail::getOrderId, orderId);
|
||||
List<BuyOrderDetail> buyOrderDetailEntities = buyOrderDetailService.getBaseMapper().selectList(wrapper1);
|
||||
one.setProducts(buyOrderDetailEntities);
|
||||
|
||||
return R.ok().put("detail",one);
|
||||
return R.ok().put("detail", one);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 信息
|
||||
* 获取订单详情
|
||||
*
|
||||
* @param orderId 订单 ID
|
||||
* @return R
|
||||
*/
|
||||
@RequestMapping("/appGetOrderInfo/{type}")
|
||||
public R appGetOrderInfo(@PathVariable String type, @RequestParam("orderId") Integer orderId) {
|
||||
BuyOrderEntity buyOrder = buyOrderService.getById(orderId);
|
||||
buyOrder.setTimestamp(buyOrder.getCreateTime().getTime()/1000);
|
||||
List<BuyOrderDetailEntity> orderDetail = null;
|
||||
if ("1".equals(type)) {
|
||||
orderDetail = buyOrderDetailService.getBaseMapper().selectList(new QueryWrapper<BuyOrderDetailEntity>()
|
||||
.eq("order_id", orderId));
|
||||
} else {
|
||||
orderDetail = buyOrderDetailService.getBaseMapper().selectList(new QueryWrapper<BuyOrderDetailEntity>()
|
||||
.eq("order_id", orderId));
|
||||
}
|
||||
for (BuyOrderDetailEntity buyOrderDetailEntity : orderDetail) {
|
||||
@RequestMapping(value = "/getOrderInfo", method = RequestMethod.GET)
|
||||
public R appGetOrderInfo(@RequestParam("orderId") Integer orderId) {
|
||||
BuyOrder buyOrder = buyOrderService.getById(orderId);
|
||||
QueryWrapper<BuyOrderDetail> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("order_id", orderId);
|
||||
List<BuyOrderDetail> buyOrderDetailList = buyOrderDetailService.list(queryWrapper);
|
||||
|
||||
ShopProductEntity prod = shopProductService.getById(buyOrderDetailEntity.getProductId());
|
||||
for (BuyOrderDetail buyOrderDetail : buyOrderDetailList) {
|
||||
ShopProductEntity prod = shopProductService.getById(buyOrderDetail.getProductId());
|
||||
if (prod != null) {
|
||||
buyOrderDetailEntity.setImage(prod.getProductImages());
|
||||
buyOrderDetail.setImage(prod.getProductImages());
|
||||
}
|
||||
}
|
||||
|
||||
List<BuyOrderDetailEntity> resultOrder = new ArrayList<BuyOrderDetailEntity>();
|
||||
Set<String> sn_no = new HashSet<String>();
|
||||
for (BuyOrderDetailEntity buyOrderDetailEntity : orderDetail) {
|
||||
resultOrder.add(buyOrderDetailEntity);
|
||||
sn_no.add(buyOrderDetailEntity.getShippingSn());
|
||||
}
|
||||
|
||||
UserRecordEntity userRecordEntity = userRecordService.getBaseMapper().selectOne(new QueryWrapper<UserRecordEntity>()
|
||||
.eq("orderSn", buyOrder.getOrderSn())
|
||||
.eq("userid", buyOrder.getUserId())
|
||||
.eq("orderdid", buyOrder.getOrderId())
|
||||
.last("LIMIT 1"));
|
||||
Integer id = null;
|
||||
if (userRecordEntity != null) {
|
||||
id = userRecordEntity.getId();
|
||||
}
|
||||
buyOrder.setProducts(resultOrder);
|
||||
Date createDate = buyOrder.getCreateTime();
|
||||
return R.ok().put("buyOrder", buyOrder).put("CreateTime", createDate).put("userRecordid", id);
|
||||
return R.ok().put("result", buyOrder);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算快递费用
|
||||
*/
|
||||
@RequestMapping("/getTransPrice/{area}")
|
||||
public R getTransPrice(@PathVariable String area, @RequestParam Map<String, Object> productMap) {
|
||||
Map<String, Object> 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);
|
||||
|
||||
@RequestMapping(value = "/modifyOrderAddress", method = RequestMethod.POST)
|
||||
public R modifyOrderAddress(@RequestBody ShippingAddressRequestVo addressRequestVo) {
|
||||
BuyOrder buyOrder = buyOrderService.getById(addressRequestVo.getOrderId());
|
||||
buyOrder.setProvince(addressRequestVo.getProvince());
|
||||
buyOrder.setCity(addressRequestVo.getCity());
|
||||
buyOrder.setDistrict(addressRequestVo.getCounty());
|
||||
buyOrder.setShippingUser(addressRequestVo.getName());
|
||||
buyOrder.setUserPhone(addressRequestVo.getMobile());
|
||||
buyOrderService.updateById(buyOrder);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 及时查询快递信息
|
||||
* 查询订单快递
|
||||
*
|
||||
* @param orderId 订单号
|
||||
* @return R
|
||||
*/
|
||||
@RequestMapping("/queryFMS")
|
||||
public R queryFMS(@RequestParam Map<String, String> params) {
|
||||
List<BuyOrderDetailEntity> detailList = this.buyOrderDetailService.getBaseMapper().selectList(new QueryWrapper<BuyOrderDetailEntity>().eq("order_id", params.get("orderId")));
|
||||
List<JSONObject> jsonList = new ArrayList<>();
|
||||
JSONObject jsonObj = null;
|
||||
for (BuyOrderDetailEntity detail : detailList) {
|
||||
jsonObj = buyOrderService.queryFMS(detail.getShipperCode(), detail.getShippingSn());
|
||||
if (Objects.isNull(jsonObj)) {
|
||||
return R.ok("暂未查到物流信息!");
|
||||
}
|
||||
jsonObj.put("ShipperName", detail.getShipperName());
|
||||
jsonList.add(jsonObj);
|
||||
|
||||
@RequestMapping(value = "/queryExpress", method = RequestMethod.GET)
|
||||
public R queryExpress(@RequestParam("orderId") Integer orderId) {
|
||||
QueryWrapper<BuyOrderDetail> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("order_id", orderId);
|
||||
List<BuyOrderDetail> buyOrderDetailList = buyOrderDetailService.list(queryWrapper);
|
||||
List<ExpressQueryResponseVo> result = new ArrayList<>();
|
||||
for (BuyOrderDetail buyOrderDetail : buyOrderDetailList) {
|
||||
ExpressQueryResponseVo vo = new ExpressQueryResponseVo();
|
||||
vo.setOrderDetailId(buyOrderDetail.getId());
|
||||
ExpressQueryResponse expressQueryResponse = expressOrderService.queryExpressOrder(buyOrderDetail.getExpressCompanyCode(), buyOrderDetail.getExpressBillNo());
|
||||
vo.setLogisticCode(expressQueryResponse.getLogisticCode());
|
||||
vo.setTraces(expressQueryResponse.getTraces());
|
||||
result.add(vo);
|
||||
}
|
||||
return R.ok().put("rntStr", jsonList);
|
||||
return R.ok().put("result", result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -412,44 +386,20 @@ public class BuyOrderController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量发货功能
|
||||
* 分包发货
|
||||
*
|
||||
* @param orderDetailIds 订单详情
|
||||
* @return
|
||||
* @param expressCompanyCode 快递公司编码
|
||||
* @param buyOrderDetailId 订单详情列表
|
||||
* @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,
|
||||
@RequestBody List<Integer> buyOrderDetailId) throws Exception {
|
||||
buyOrderService.createSplitPackageOrder(expressCompanyCode, buyOrderDetailId);
|
||||
return R.ok();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 后台取消订单接口
|
||||
*/
|
||||
@RequestMapping("/cancelFMS")
|
||||
public R cancelFMS(@RequestParam Map<String, Object> 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<String, Object> params) {
|
||||
|
||||
PageUtils page = buyOrderDetailService.querySheet(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品实际价格
|
||||
*
|
||||
@@ -468,7 +418,7 @@ public class BuyOrderController {
|
||||
* @param product
|
||||
* @return
|
||||
*/
|
||||
private boolean handleStock(BuyOrderDetailEntity buyOrderDetail, ShopProductEntity product) {
|
||||
private boolean handleStock(BuyOrderDetail buyOrderDetail, ShopProductEntity product) {
|
||||
int quantity = buyOrderDetail.getQuantity();
|
||||
if (product.getProductStock() - quantity < 0) {
|
||||
return false;
|
||||
@@ -485,7 +435,7 @@ public class BuyOrderController {
|
||||
* @param buyOrder
|
||||
* @return
|
||||
*/
|
||||
private BigDecimal useCouponAmount(BuyOrderEntity buyOrder) {
|
||||
private BigDecimal useCouponAmount(BuyOrder buyOrder) {
|
||||
Integer couponId = buyOrder.getCouponId();
|
||||
if (couponId != null) {
|
||||
CouponHistoryEntity couponHistory = couponHistoryService.getById(couponId);
|
||||
@@ -506,7 +456,7 @@ public class BuyOrderController {
|
||||
* @param buyOrder
|
||||
* @return
|
||||
*/
|
||||
private BigDecimal getShoppingAmount(BuyOrderEntity buyOrder) {
|
||||
private BigDecimal getShoppingAmount(BuyOrder buyOrder) {
|
||||
return buyOrder.getOrderMoney() == null ? BigDecimal.ZERO : buyOrder.getShippingMoney();
|
||||
}
|
||||
|
||||
@@ -533,7 +483,7 @@ public class BuyOrderController {
|
||||
* @param user
|
||||
* @param totalPrice
|
||||
*/
|
||||
private void recordTransaction(BuyOrderEntity buyOrder, MyUserEntity user, BigDecimal totalPrice) {
|
||||
private void recordTransaction(BuyOrder buyOrder, MyUserEntity user, BigDecimal totalPrice) {
|
||||
TransactionDetailsEntity transactionDetailsEntity = new TransactionDetailsEntity();
|
||||
transactionDetailsEntity.setRemark("订单编号为 - " + buyOrder.getOrderSn());
|
||||
transactionDetailsEntity.setUserId(user.getId());
|
||||
@@ -551,8 +501,8 @@ public class BuyOrderController {
|
||||
* @param products
|
||||
* @param buyOrder
|
||||
*/
|
||||
private void addEbookToUser(List<BuyOrderDetailEntity> products, BuyOrderEntity buyOrder) {
|
||||
List<Integer> productIds = products.stream().map(BuyOrderDetailEntity::getProductId).collect(Collectors.toList());
|
||||
private void addEbookToUser(List<BuyOrderDetail> products, BuyOrder buyOrder) {
|
||||
List<Integer> productIds = products.stream().map(BuyOrderDetail::getProductId).collect(Collectors.toList());
|
||||
for (Integer productId : productIds) {
|
||||
List<Integer> collect = shopProductBookService.getBaseMapper().selectList(new LambdaQueryWrapper<ShopProductBookEntity>()
|
||||
.eq(ShopProductBookEntity::getProductId, productId)
|
||||
@@ -567,7 +517,7 @@ public class BuyOrderController {
|
||||
* @param buyOrder
|
||||
* @param buyOrderDetail
|
||||
*/
|
||||
private void handleBuyCart(BuyOrderEntity buyOrder, BuyOrderDetailEntity buyOrderDetail) {
|
||||
private void handleBuyCart(BuyOrder buyOrder, BuyOrderDetail buyOrderDetail) {
|
||||
List<OrderCartEntity> orderCartList = orderCartService.getBaseMapper().selectList(new QueryWrapper<OrderCartEntity>()
|
||||
.eq("user_id", buyOrder.getUserId()).eq("product_id", buyOrderDetail.getProductId()));
|
||||
if (orderCartList.size() > 0) {
|
||||
@@ -579,7 +529,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;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,24 +1,15 @@
|
||||
package com.peanut.modules.book.controller;
|
||||
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.book.entity.BuyOrderDetail;
|
||||
import com.peanut.modules.book.service.BuyOrderDetailService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import com.peanut.modules.book.entity.BuyOrderEntity;
|
||||
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.BuyOrderDetailEntity;
|
||||
import com.peanut.modules.book.service.BuyOrderDetailService;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 商品订单详情表
|
||||
*
|
||||
@@ -32,32 +23,27 @@ public class BuyOrderDetailController {
|
||||
@Autowired
|
||||
private BuyOrderDetailService buyOrderDetailService;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
// @RequiresPermissions("book:buyorderdetail:list")
|
||||
public R list(@RequestParam Map<String, Object> params){
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
PageUtils page = buyOrderDetailService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询已购买书籍
|
||||
* 查询已购买书籍
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/querybuy")
|
||||
public R querybuy(@RequestParam Map<String, Object> params){
|
||||
public R querybuy(@RequestParam Map<String, Object> params) {
|
||||
PageUtils page = buyOrderDetailService.querybuy(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 去重查询可打印面单
|
||||
*
|
||||
@@ -65,10 +51,8 @@ public class BuyOrderDetailController {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/querySheetPage")
|
||||
public R querySheetPage(@RequestParam Map<String, Object> params){
|
||||
|
||||
public R querySheetPage(@RequestParam Map<String, Object> params) {
|
||||
PageUtils page = buyOrderDetailService.querySheet(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
@@ -76,9 +60,8 @@ public class BuyOrderDetailController {
|
||||
* 信息
|
||||
*/
|
||||
@RequestMapping("/info/{allOrderId}")
|
||||
public R info(@PathVariable("allOrderId") Long allOrderId){
|
||||
BuyOrderDetailEntity buyOrderDetail = buyOrderDetailService.getById(allOrderId);
|
||||
|
||||
public R info(@PathVariable("allOrderId") Long allOrderId) {
|
||||
BuyOrderDetail buyOrderDetail = buyOrderDetailService.getById(allOrderId);
|
||||
return R.ok().put("buyOrderDetail", buyOrderDetail);
|
||||
}
|
||||
|
||||
@@ -86,10 +69,8 @@ public class BuyOrderDetailController {
|
||||
* 保存
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
// @RequiresPermissions("book:buyorderdetail:save")
|
||||
public R save(@RequestBody BuyOrderDetailEntity buyOrderDetail){
|
||||
buyOrderDetailService.save(buyOrderDetail);
|
||||
|
||||
public R save(@RequestBody BuyOrderDetail buyOrderDetail) {
|
||||
buyOrderDetailService.save(buyOrderDetail);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@@ -97,10 +78,8 @@ public class BuyOrderDetailController {
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
// @RequiresPermissions("book:buyorderdetail:update")
|
||||
public R update(@RequestBody BuyOrderDetailEntity buyOrderDetail){
|
||||
buyOrderDetailService.updateById(buyOrderDetail);
|
||||
|
||||
public R update(@RequestBody BuyOrderDetail buyOrderDetail) {
|
||||
buyOrderDetailService.updateById(buyOrderDetail);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@@ -108,15 +87,13 @@ public class BuyOrderDetailController {
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
// @RequiresPermissions("book:buyorderdetail:delete")
|
||||
public R delete(@RequestBody Long[] allOrderIds){
|
||||
buyOrderDetailService.removeByIds(Arrays.asList(allOrderIds));
|
||||
|
||||
public R delete(@RequestBody Long[] allOrderIds) {
|
||||
buyOrderDetailService.removeByIds(Arrays.asList(allOrderIds));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping("/updateOrderStatus")
|
||||
public R updateOrderStatus(@RequestBody BuyOrderDetailEntity buyOrderDetail){
|
||||
public R updateOrderStatus(@RequestBody BuyOrderDetail buyOrderDetail) {
|
||||
buyOrderDetail.setOrderStatus("2");
|
||||
buyOrderDetailService.updateById(buyOrderDetail);
|
||||
return R.ok();
|
||||
@@ -130,8 +107,7 @@ public class BuyOrderDetailController {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/batchUpdateByShippingSns")
|
||||
public R batchUpdateByShippingSns(@RequestBody String[] shippingSnList){
|
||||
buyOrderDetailService.batchUpdateByShippingSns(shippingSnList);
|
||||
public R batchUpdateByShippingSns(@RequestBody String[] shippingSnList) {
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<ExpressCompanyVo> expressCompanyList = expressCompanyService.getExpressCompanyList();
|
||||
return R.ok().put("result", expressCompanyList);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
ExpressController(ExpressCompanyService expressCompanyService) {
|
||||
this.expressCompanyService = expressCompanyService;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,9 +4,9 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.book.entity.CityEntity;
|
||||
import com.peanut.modules.book.entity.CountyEntity;
|
||||
import com.peanut.modules.book.entity.ProvinceEntity;
|
||||
import com.peanut.modules.book.entity.City;
|
||||
import com.peanut.modules.book.entity.County;
|
||||
import com.peanut.modules.book.entity.Province;
|
||||
import com.peanut.modules.book.service.CityService;
|
||||
import com.peanut.modules.book.service.CountyService;
|
||||
import com.peanut.modules.book.service.ProvinceService;
|
||||
@@ -25,7 +25,6 @@ import java.util.Map;
|
||||
@RequestMapping("api/province")
|
||||
public class ProvinceController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ProvinceService provinceService;
|
||||
@Autowired
|
||||
@@ -37,7 +36,7 @@ public class ProvinceController {
|
||||
|
||||
//获取地址
|
||||
@RequestMapping("/getProvince")
|
||||
public R getProvince(){
|
||||
public R getProvince() {
|
||||
|
||||
|
||||
//优化查询速度 目录放入redis中
|
||||
@@ -46,41 +45,36 @@ public class ProvinceController {
|
||||
if (StringUtils.isNotBlank(s)) {
|
||||
List<Object> redisData = JSONArray.parseArray(s);
|
||||
for (Object object : redisData) {
|
||||
Map <String,Object> ret = (Map<String, Object>) object;//取出list里面的值转为map
|
||||
Map<String, Object> ret = (Map<String, Object>) object;//取出list里面的值转为map
|
||||
listData.add(ret);
|
||||
}
|
||||
return R.ok().put("provinceEntity",listData);
|
||||
return R.ok().put("provinceEntity", listData);
|
||||
}
|
||||
List<ProvinceEntity> provinceEntityList = provinceService.getCity();
|
||||
redisTemplate.opsForValue().set("Province", JSON.toJSONString(provinceEntityList));
|
||||
return R.ok().put("provinceEntity",provinceEntityList);
|
||||
List<Province> provinceList = provinceService.getCity();
|
||||
redisTemplate.opsForValue().set("Province", JSON.toJSONString(provinceList));
|
||||
return R.ok().put("provinceEntity", provinceList);
|
||||
}
|
||||
|
||||
//获取省列表
|
||||
@RequestMapping("/getProvinceList")
|
||||
public R getProvinceList(){
|
||||
List<ProvinceEntity> provinceList = provinceService.getBaseMapper().selectList(new QueryWrapper<ProvinceEntity>());
|
||||
public R getProvinceList() {
|
||||
List<Province> provinceList = provinceService.getBaseMapper().selectList(new QueryWrapper<Province>());
|
||||
|
||||
return R.ok().put("provinceList",provinceList);
|
||||
return R.ok().put("provinceList", provinceList);
|
||||
}
|
||||
|
||||
//获取市列表
|
||||
@RequestMapping("/getCityList")
|
||||
public R getCityList(@RequestParam("provId") Integer provId){
|
||||
List<CityEntity> prov = cityService.getBaseMapper().selectList(new QueryWrapper<CityEntity>()
|
||||
public R getCityList(@RequestParam("provId") Integer provId) {
|
||||
List<City> prov = cityService.getBaseMapper().selectList(new QueryWrapper<City>()
|
||||
.eq("prov_id", provId));
|
||||
|
||||
return R.ok().put("prov",prov);
|
||||
return R.ok().put("prov", prov);
|
||||
}
|
||||
|
||||
//获取区列表
|
||||
@RequestMapping("/getCountyList")
|
||||
public R getCountyList(@RequestParam("cityId") Integer cityId){
|
||||
List<CountyEntity> countyList = countyService.getBaseMapper().selectList(new QueryWrapper<CountyEntity>().eq("city_id", cityId));
|
||||
|
||||
|
||||
return R.ok().put("countyList",countyList);
|
||||
public R getCountyList(@RequestParam("cityId") Integer cityId) {
|
||||
List<County> countyList = countyService.getBaseMapper().selectList(new QueryWrapper<County>().eq("city_id", cityId));
|
||||
return R.ok().put("countyList", countyList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,24 +1,15 @@
|
||||
package com.peanut.modules.book.controller;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.peanut.modules.book.entity.AuthorEntity;
|
||||
import com.peanut.modules.book.service.BookService;
|
||||
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.PublisherEntity;
|
||||
import com.peanut.modules.book.service.PublisherService;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.book.entity.PublisherEntity;
|
||||
import com.peanut.modules.book.service.BookService;
|
||||
import com.peanut.modules.book.service.PublisherService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 出版商表
|
||||
@@ -39,10 +30,8 @@ public class PublisherController {
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
// @RequiresPermissions("book:publisher:list")
|
||||
public R list(@RequestParam Map<String, Object> params){
|
||||
PageUtils page = publisherService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
@@ -50,7 +39,6 @@ public class PublisherController {
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/publisherList")
|
||||
// @RequiresPermissions("book:publisher:list")
|
||||
public R publisherList(){
|
||||
List<PublisherEntity> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<PublisherEntity>());
|
||||
ArrayList<Object> list = new ArrayList<>();
|
||||
@@ -60,7 +48,6 @@ public class PublisherController {
|
||||
map.put("value",publisherEntitie.getPublisherName());
|
||||
list.add(map);
|
||||
}
|
||||
|
||||
return R.ok().put("list", list);
|
||||
}
|
||||
|
||||
@@ -68,10 +55,8 @@ public class PublisherController {
|
||||
* 信息
|
||||
*/
|
||||
@RequestMapping("/info/{id}")
|
||||
// @RequiresPermissions("book:publisher:info")
|
||||
public R info(@PathVariable("id") Integer id){
|
||||
PublisherEntity publisher = publisherService.getById(id);
|
||||
|
||||
return R.ok().put("publisher", publisher);
|
||||
}
|
||||
|
||||
@@ -80,7 +65,6 @@ public class PublisherController {
|
||||
* 信息
|
||||
*/
|
||||
@RequestMapping("/appGetInfo/{id}/{limit}/{page}")
|
||||
// @RequiresPermissions("book:author:info")
|
||||
public R appGetInfo(@PathVariable("id") Integer id,
|
||||
@PathVariable("limit") String limit,
|
||||
@PathVariable("page") String page){
|
||||
@@ -103,7 +87,6 @@ public class PublisherController {
|
||||
public R save(@RequestBody PublisherEntity publisher){
|
||||
publisher.setDelFlag(0);
|
||||
publisherService.save(publisher);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@@ -111,10 +94,8 @@ public class PublisherController {
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
// @RequiresPermissions("book:publisher:update")
|
||||
public R update(@RequestBody PublisherEntity publisher){
|
||||
publisherService.updateById(publisher);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@@ -122,11 +103,8 @@ public class PublisherController {
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
// @RequiresPermissions("book:publisher:delete")
|
||||
public R delete(@RequestBody Integer[] ids){
|
||||
publisherService.removeByIds(Arrays.asList(ids));
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,23 +1,16 @@
|
||||
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.SeckillProdRelationEntity;
|
||||
import com.peanut.modules.book.service.SeckillProdRelationService;
|
||||
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;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
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.SeckillProdRelationEntity;
|
||||
import com.peanut.modules.book.service.SeckillProdRelationService;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
|
||||
|
||||
|
||||
@@ -38,7 +31,6 @@ public class SeckillProdRelationController {
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
// @RequiresPermissions("book:seckillprodrelation:list")
|
||||
public R list(@RequestParam Map<String, Object> params){
|
||||
PageUtils page = seckillProdRelationService.queryPage(params);
|
||||
|
||||
@@ -50,7 +42,6 @@ public class SeckillProdRelationController {
|
||||
* 信息
|
||||
*/
|
||||
@RequestMapping("/info/{id}")
|
||||
// @RequiresPermissions("book:seckillprodrelation:info")
|
||||
public R info(@PathVariable("id") Integer id){
|
||||
SeckillProdRelationEntity seckillProdRelation = seckillProdRelationService.getById(id);
|
||||
|
||||
@@ -61,26 +52,18 @@ public class SeckillProdRelationController {
|
||||
* 保存
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
// @RequiresPermissions("book:seckillprodrelation:save")
|
||||
public R save(@RequestBody SeckillProdRelationEntity seckillProdRelation){
|
||||
|
||||
//判断当前场次 是否有相同商品
|
||||
|
||||
Integer prodId = seckillProdRelation.getProdId();
|
||||
|
||||
Integer promotionSeckillId = seckillProdRelation.getPromotionSeckillId();
|
||||
|
||||
List<SeckillProdRelationEntity> list = seckillProdRelationService.list(new QueryWrapper<SeckillProdRelationEntity>().eq("promotion_seckill_id", promotionSeckillId));
|
||||
|
||||
for (SeckillProdRelationEntity seckillProdRelationEntity : list) {
|
||||
Integer prodId1 = seckillProdRelationEntity.getProdId();
|
||||
if (prodId1 == prodId){
|
||||
return R.error("商品已存在");
|
||||
}
|
||||
}
|
||||
|
||||
seckillProdRelationService.save(seckillProdRelation);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@@ -88,7 +71,6 @@ public class SeckillProdRelationController {
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
// @RequiresPermissions("book:seckillprodrelation:update")
|
||||
public R update(@RequestBody SeckillProdRelationEntity seckillProdRelation){
|
||||
seckillProdRelationService.updateById(seckillProdRelation);
|
||||
|
||||
|
||||
@@ -98,17 +98,17 @@ public class ShopProductController {
|
||||
public R bookList(@RequestParam("userId") Integer userId
|
||||
) {
|
||||
//查询已购买的书籍
|
||||
List<BuyOrderDetailEntity> buyOrderDetailEntities = buyOrderDetailService.getBaseMapper().selectList(new QueryWrapper<BuyOrderDetailEntity>()
|
||||
List<BuyOrderDetail> buyOrderDetailEntities = buyOrderDetailService.getBaseMapper().selectList(new QueryWrapper<BuyOrderDetail>()
|
||||
.eq("user_id", userId));
|
||||
//hashset不重复 且无序
|
||||
Set<String> purchasedProductIds = new HashSet<>();
|
||||
ArrayList<Object> list = new ArrayList<>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
for (BuyOrderDetailEntity buyOrderDetailEntity : buyOrderDetailEntities) {
|
||||
map.put("ProductId", String.valueOf(buyOrderDetailEntity.getProductId()));
|
||||
for (BuyOrderDetail buyOrderDetail : buyOrderDetailEntities) {
|
||||
map.put("ProductId", String.valueOf(buyOrderDetail.getProductId()));
|
||||
list.add(map);
|
||||
//去重取出以后买书籍的id
|
||||
purchasedProductIds.add(String.valueOf(buyOrderDetailEntity.getProductId()));
|
||||
purchasedProductIds.add(String.valueOf(buyOrderDetail.getProductId()));
|
||||
}
|
||||
//查询商品表并过滤已购买商品id,根据时间倒叙展示
|
||||
List<ShopProductEntity> allProductEntities = shopProductService.getBaseMapper().selectList(new QueryWrapper<ShopProductEntity>()
|
||||
|
||||
@@ -78,7 +78,6 @@ public class ShopProductLabelController {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/getLabels")
|
||||
public R getLabels(){
|
||||
List<ShopProductLabelEntity> shopProductLabelEntities = shopProductLabelService.getBaseMapper().selectList(new QueryWrapper<ShopProductLabelEntity>()
|
||||
@@ -88,8 +87,6 @@ public class ShopProductLabelController {
|
||||
return R.ok().put("result",re);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 废除
|
||||
* @param params
|
||||
@@ -102,7 +99,6 @@ public class ShopProductLabelController {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取商品列表通过标签
|
||||
* @return
|
||||
@@ -119,12 +115,4 @@ public class ShopProductLabelController {
|
||||
|
||||
return R.ok().put("page",shopProductEntityPage);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,21 +1,17 @@
|
||||
package com.peanut.modules.book.controller;
|
||||
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.book.entity.ShopSeckillEntity;
|
||||
import com.peanut.modules.book.service.ShopSeckillService;
|
||||
import com.peanut.modules.book.to.SeckillRedisTo;
|
||||
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;
|
||||
|
||||
import com.peanut.modules.book.to.SeckillRedisTo;
|
||||
import com.peanut.modules.book.vo.SeckillProdVo;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.peanut.modules.book.entity.ShopSeckillEntity;
|
||||
import com.peanut.modules.book.service.ShopSeckillService;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 秒杀库存表
|
||||
@@ -34,10 +30,8 @@ public class ShopSeckillController {
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
// @RequiresPermissions("book:shopseckill:list")
|
||||
public R list(@RequestParam Map<String, Object> params){
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
PageUtils page = shopSeckillService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
@@ -46,10 +40,8 @@ public class ShopSeckillController {
|
||||
* 信息
|
||||
*/
|
||||
@RequestMapping("/info/{seckillId}")
|
||||
// @RequiresPermissions("book:shopseckill:info")
|
||||
public R info(@PathVariable("seckillId") Long seckillId){
|
||||
ShopSeckillEntity shopSeckill = shopSeckillService.getById(seckillId);
|
||||
|
||||
public R info(@PathVariable("seckillId") Long seckillId) {
|
||||
ShopSeckillEntity shopSeckill = shopSeckillService.getById(seckillId);
|
||||
return R.ok().put("shopSeckill", shopSeckill);
|
||||
}
|
||||
|
||||
@@ -57,10 +49,8 @@ public class ShopSeckillController {
|
||||
* 保存
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
// @RequiresPermissions("book:shopseckill:save")
|
||||
public R save(@RequestBody ShopSeckillEntity shopSeckill){
|
||||
shopSeckillService.save(shopSeckill);
|
||||
|
||||
public R save(@RequestBody ShopSeckillEntity shopSeckill) {
|
||||
shopSeckillService.save(shopSeckill);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@@ -68,10 +58,8 @@ public class ShopSeckillController {
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
// @RequiresPermissions("book:shopseckill:update")
|
||||
public R update(@RequestBody ShopSeckillEntity shopSeckill){
|
||||
shopSeckillService.updateById(shopSeckill);
|
||||
|
||||
public R update(@RequestBody ShopSeckillEntity shopSeckill) {
|
||||
shopSeckillService.updateById(shopSeckill);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@@ -79,28 +67,24 @@ public class ShopSeckillController {
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
// @RequiresPermissions("book:shopseckill:delete")
|
||||
public R delete(@RequestBody Long[] seckillIds){
|
||||
shopSeckillService.removeByIds(Arrays.asList(seckillIds));
|
||||
|
||||
public R delete(@RequestBody Long[] seckillIds) {
|
||||
shopSeckillService.removeByIds(Arrays.asList(seckillIds));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@GetMapping("/getSeckillProd")
|
||||
public R getSeckillProd(){
|
||||
public R getSeckillProd() {
|
||||
List<SeckillRedisTo> list = shopSeckillService.getCurrentSeckillProd();
|
||||
|
||||
return R.ok().put("list",list);
|
||||
return R.ok().put("list", list);
|
||||
}
|
||||
|
||||
@GetMapping("/kill")
|
||||
public R kill(@RequestParam("killId") String killId,
|
||||
@RequestParam("key") String key,
|
||||
@RequestParam("num") Integer num,
|
||||
@RequestParam("userId") Integer userId){
|
||||
String orderId = shopSeckillService.kill(killId,key,num,userId);
|
||||
|
||||
return R.ok().put("orderId",orderId);
|
||||
@RequestParam("userId") Integer userId) {
|
||||
String orderId = shopSeckillService.kill(killId, key, num, userId);
|
||||
return R.ok().put("orderId", orderId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,133 +1,95 @@
|
||||
package com.peanut.modules.book.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
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;
|
||||
import com.peanut.modules.book.entity.UserAddress;
|
||||
import com.peanut.modules.book.service.UserAddressService;
|
||||
import com.peanut.modules.book.vo.UserAddressVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @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 addressId address ID
|
||||
* @return R
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
// @RequiresPermissions("book:useraddress:list")
|
||||
public R list(@RequestParam Map<String, Object> params){
|
||||
PageUtils page = userAddressService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@RequestMapping("/info/{addressid}")
|
||||
// @RequiresPermissions("book:useraddress:info")
|
||||
public R info(@PathVariable("addressid") Integer addressid){
|
||||
UserAddressEntity userAddress = userAddressService.getById(addressid);
|
||||
|
||||
return R.ok().put("userAddress", userAddress);
|
||||
@RequestMapping("/info/{addressId}")
|
||||
public R info(@PathVariable("addressId") Integer addressId) {
|
||||
UserAddress userAddress = userAddressService.getById(addressId);
|
||||
UserAddressVo vo = new UserAddressVo();
|
||||
BeanUtil.copyProperties(userAddress, vo);
|
||||
vo = userAddressService.getAddressName(vo, userAddress.getRegionCode());
|
||||
return R.ok().put("result", vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @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<UserAddressEntity> list = userAddressService.list(new QueryWrapper<UserAddressEntity>().eq("userId", userid));
|
||||
for (UserAddressEntity userAddressEntity : list) {
|
||||
if (userAddressEntity.getIsdefault() == 1) {
|
||||
userAddressEntity.setIsdefault(0);
|
||||
}
|
||||
}
|
||||
userAddressService.updateBatchById(list);
|
||||
public R save(@RequestBody UserAddress userAddress) {
|
||||
// 判断是否已经有默认的地址了
|
||||
if ((userAddressService.getUserDefaultAddressCount(userAddress.getUserId()) >= 1) && userAddress.getIsDefault() == 1) {
|
||||
return R.error("已经存在默认地址");
|
||||
}
|
||||
userAddressService.save(userAddress);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
// @RequiresPermissions("book:useraddress:update")
|
||||
public R update(@RequestBody UserAddressEntity userAddress){
|
||||
|
||||
Integer isdefault = userAddress.getIsdefault();
|
||||
|
||||
if (isdefault == 1) {
|
||||
|
||||
Integer userid = userAddress.getUserid();
|
||||
|
||||
List<UserAddressEntity> list = userAddressService.list(new QueryWrapper<UserAddressEntity>().eq("userId", userid));
|
||||
|
||||
for (UserAddressEntity userAddressEntity : list) {
|
||||
if (userAddressEntity.getIsdefault() == 1) {
|
||||
userAddressEntity.setIsdefault(0);
|
||||
userAddressService.updateById(userAddressEntity);
|
||||
}
|
||||
}
|
||||
|
||||
public R update(@RequestBody UserAddress userAddress) {
|
||||
if ((userAddressService.getUserDefaultAddressCount(userAddress.getUserId()) >= 1) && userAddress.getIsDefault() == 1) {
|
||||
return R.error("已经存在默认地址");
|
||||
}
|
||||
|
||||
userAddressService.updateById(userAddress);
|
||||
|
||||
userAddressService.updateById(userAddress);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* 删除用户地址
|
||||
*
|
||||
* @param id address ID
|
||||
* @return R
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
// @RequiresPermissions("book:useraddress:delete")
|
||||
public R delete(@RequestBody Integer[] addressids){
|
||||
userAddressService.removeByIds(Arrays.asList(addressids));
|
||||
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public R delete(@RequestParam("id") Integer id) {
|
||||
userAddressService.removeById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* app获取用户 收货地址
|
||||
* 获取用户收货地址列表
|
||||
*
|
||||
* @param userId 用户 ID
|
||||
* @return R
|
||||
*/
|
||||
@RequestMapping("/getUserAddress")
|
||||
// @RequiresPermissions("book:useraddress:delete")
|
||||
public R getUserAddress(@RequestParam("userId") Integer userId){
|
||||
|
||||
List<UserAddressEntity> list = userAddressService.list(new QueryWrapper<UserAddressEntity>().eq("userId", userId).orderByDesc("isDefault"));
|
||||
|
||||
return R.ok().put("list",list);
|
||||
public R getUserAddress(@RequestParam("userId") Integer userId) {
|
||||
QueryWrapper<UserAddress> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("user_id", userId);
|
||||
queryWrapper.orderByDesc("is_default");
|
||||
List<UserAddress> userAddressList = userAddressService.list(queryWrapper);
|
||||
List<UserAddressVo> result = new ArrayList<>();
|
||||
for (UserAddress userAddress : userAddressList) {
|
||||
UserAddressVo vo = new UserAddressVo();
|
||||
BeanUtil.copyProperties(userAddress, vo);
|
||||
vo = userAddressService.getAddressName(vo, userAddress.getRegionCode());
|
||||
result.add(vo);
|
||||
}
|
||||
return R.ok().put("list", result);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -32,9 +32,9 @@ public class UserBookClockController {
|
||||
/**
|
||||
* 计算打卡天数
|
||||
*
|
||||
* @param bookId
|
||||
* @param userId
|
||||
* @return
|
||||
* @param bookId book ID
|
||||
* @param userId user ID
|
||||
* @return R
|
||||
*/
|
||||
@RequestMapping(path = "/clockInDays", method = RequestMethod.GET)
|
||||
public R clockInDays(@RequestParam("bookId") Integer bookId,
|
||||
@@ -67,9 +67,9 @@ public class UserBookClockController {
|
||||
/**
|
||||
* 用户打卡
|
||||
*
|
||||
* @param bookId
|
||||
* @param userId
|
||||
* @return
|
||||
* @param bookId book ID
|
||||
* @param userId user ID
|
||||
* @return R
|
||||
*/
|
||||
@RequestMapping(path = "/clockIn", method = RequestMethod.GET)
|
||||
public R clockIn(@RequestParam("bookId") Integer bookId,
|
||||
|
||||
@@ -5,10 +5,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.book.entity.BookClockEntryEntity;
|
||||
import com.peanut.modules.book.entity.BookEntity;
|
||||
import com.peanut.modules.book.service.BookClockEntryChatService;
|
||||
import com.peanut.modules.book.service.BookClockEntryService;
|
||||
import com.peanut.modules.book.service.BookService;
|
||||
import com.peanut.modules.book.service.UserBookClockService;
|
||||
import com.peanut.modules.book.to.PageIdDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -20,13 +18,9 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RequestMapping("book/clock")
|
||||
public class UserClockController {
|
||||
|
||||
@Autowired
|
||||
private UserBookClockService userBookClockService;
|
||||
@Autowired
|
||||
private BookClockEntryService bookClockEntryService;
|
||||
@Autowired
|
||||
private BookClockEntryChatService bookClockEntryChatService;
|
||||
@Autowired
|
||||
private BookService bookService;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.peanut.modules.book.controller;
|
||||
|
||||
import cn.com.marsoft.tool.ToolObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
@@ -118,15 +117,15 @@ public class UserFollowUpController {
|
||||
return R.error("请先评论再追评");
|
||||
}
|
||||
String orderSn = userRecord.getOrderSn();
|
||||
BuyOrderEntity buyOrderEntity =buyOrderService.getBaseMapper().selectOne(new QueryWrapper<BuyOrderEntity>()
|
||||
BuyOrder buyOrder =buyOrderService.getBaseMapper().selectOne(new QueryWrapper<BuyOrder>()
|
||||
.eq("order_sn",orderSn).last("LIMIT 1")
|
||||
);
|
||||
|
||||
Integer orderId = buyOrderEntity.getOrderId();
|
||||
Integer orderId = buyOrder.getOrderId();
|
||||
Integer bookid = userRecord.getBookid();
|
||||
Integer userid = userRecord.getUserid();
|
||||
Integer id1 = userRecord.getId();
|
||||
BuyOrderDetailEntity detailEntity = buyOrderDetailService.getBaseMapper().selectOne(new QueryWrapper<BuyOrderDetailEntity>()
|
||||
BuyOrderDetail detailEntity = buyOrderDetailService.getBaseMapper().selectOne(new QueryWrapper<BuyOrderDetail>()
|
||||
.eq("Order_id", orderId).eq("product_id",bookid));
|
||||
|
||||
UserFollowUpEntity followUpEntity = userFollowUpService.getBaseMapper().selectOne(new QueryWrapper<UserFollowUpEntity>().eq("userid", userid).eq("oid",id1).last("LIMIT 1"));
|
||||
@@ -135,8 +134,8 @@ public class UserFollowUpController {
|
||||
// return R.error("您已评价过");
|
||||
// }
|
||||
|
||||
buyOrderEntity.setRecordId(2);
|
||||
buyOrderService.saveOrUpdate(buyOrderEntity);
|
||||
buyOrder.setRecordId(2);
|
||||
buyOrderService.saveOrUpdate(buyOrder);
|
||||
if (userFollowUpEntity.getImages()!=null) {
|
||||
|
||||
List<Map<String,String>> imageList = (ArrayList<Map<String,String>>)userFollowUpEntity.getImages();
|
||||
|
||||
@@ -164,7 +164,7 @@ public class UserRecordController {
|
||||
public Object commodityComments(Integer userid, String orderSn, Integer bookid, String comment) {
|
||||
|
||||
|
||||
BuyOrderEntity buyOrderEntity = buyOrderService.getBaseMapper().selectOne(new QueryWrapper<BuyOrderEntity>()
|
||||
BuyOrder buyOrder = buyOrderService.getBaseMapper().selectOne(new QueryWrapper<BuyOrder>()
|
||||
.eq("order_sn", orderSn).last("LIMIT 1").eq("order_status", "3")
|
||||
//状态3为已收货
|
||||
// .eq("order_status","3")
|
||||
@@ -172,11 +172,11 @@ public class UserRecordController {
|
||||
UserRecordEntity userRecordEntity = new UserRecordEntity();
|
||||
|
||||
|
||||
if (!ToolObject.isNullOrEmpty(buyOrderEntity)) {
|
||||
if (!ToolObject.isNullOrEmpty(buyOrder)) {
|
||||
return error("您已评价过了,请勿重复评论");
|
||||
//
|
||||
} else {
|
||||
userRecordEntity.setId(buyOrderEntity.getOrderId());
|
||||
userRecordEntity.setId(buyOrder.getOrderId());
|
||||
userRecordEntity.setContent(comment);
|
||||
//商品评价
|
||||
userRecordEntity.setBookid(bookid);
|
||||
@@ -199,12 +199,12 @@ public class UserRecordController {
|
||||
@RequestMapping("/UserRecordcomment")
|
||||
public R commodity(@RequestBody UserRecordEntity recordEntity) {
|
||||
//todo 已收货限制字段,只可评价一次
|
||||
BuyOrderEntity buyOrderEntity = buyOrderService.getBaseMapper().selectOne(new QueryWrapper<BuyOrderEntity>()
|
||||
BuyOrder buyOrder = buyOrderService.getBaseMapper().selectOne(new QueryWrapper<BuyOrder>()
|
||||
.eq("order_sn", recordEntity.getOrderSn())
|
||||
);
|
||||
|
||||
Integer orderId = buyOrderEntity.getOrderId();
|
||||
BuyOrderDetailEntity detailEntity = buyOrderDetailService.getBaseMapper().selectOne(new QueryWrapper<BuyOrderDetailEntity>().eq("Order_id", orderId).eq("product_id", recordEntity.getBookid()));
|
||||
Integer orderId = buyOrder.getOrderId();
|
||||
BuyOrderDetail detailEntity = buyOrderDetailService.getBaseMapper().selectOne(new QueryWrapper<BuyOrderDetail>().eq("Order_id", orderId).eq("product_id", recordEntity.getBookid()));
|
||||
Integer orderId1 = detailEntity.getOrderId();
|
||||
UserRecordEntity userRecordEntity = userRecordService.getBaseMapper().selectOne(new QueryWrapper<UserRecordEntity>().eq("orderSn", recordEntity.getOrderSn()).eq("userid", recordEntity.getUserid()).eq("orderdid", orderId1).last("LIMIT 1"));
|
||||
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
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.ActivityEntity;
|
||||
import com.peanut.modules.book.entity.BuyOrderEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单表
|
||||
*
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
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.BookCategoryEntity;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
|
||||
@@ -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<BookClockinCommentEntity> {
|
||||
}
|
||||
@@ -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<BookClockInEntity> {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -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<BookClockinPunchEntity> {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,16 +1,13 @@
|
||||
package com.peanut.modules.book.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.peanut.modules.book.entity.BookEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 图书表
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
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.BookForumArticlesEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@@ -7,5 +7,4 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface BookListeningDao extends BaseMapper<BookListeningEntity> {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.peanut.modules.book.dao;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.peanut.modules.book.entity.BuyOrderEntity;
|
||||
import com.peanut.modules.book.entity.BuyOrder;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -16,8 +14,8 @@ import java.util.List;
|
||||
* @date 2022-08-29 15:27:44
|
||||
*/
|
||||
@Mapper
|
||||
public interface BuyOrderDao extends BaseMapper<BuyOrderEntity> {
|
||||
public interface BuyOrderDao extends BaseMapper<BuyOrder> {
|
||||
|
||||
public List<BuyOrderEntity> queryListByOrderIds(Integer[] ids);
|
||||
public List<BuyOrder> queryListByOrderIds(Integer[] ids);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.peanut.modules.book.dao;
|
||||
|
||||
import com.peanut.modules.book.entity.BuyOrderDetailEntity;
|
||||
import com.peanut.modules.book.entity.BuyOrderDetail;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@@ -14,8 +14,8 @@ import java.util.List;
|
||||
* @date 2022-08-29 15:27:44
|
||||
*/
|
||||
@Mapper
|
||||
public interface BuyOrderDetailDao extends BaseMapper<BuyOrderDetailEntity> {
|
||||
public interface BuyOrderDetailDao extends BaseMapper<BuyOrderDetail> {
|
||||
|
||||
public List<BuyOrderDetailEntity> queryListByOrderIds(Integer[] ids);
|
||||
public List<BuyOrderDetail> queryListByOrderIds(Integer[] ids);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.peanut.modules.book.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.peanut.modules.book.entity.CityEntity;
|
||||
import com.peanut.modules.book.entity.City;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
@@ -12,6 +12,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
* @date 2022-10-27 16:07:59
|
||||
*/
|
||||
@Mapper
|
||||
public interface CityDao extends BaseMapper<CityEntity> {
|
||||
public interface CityDao extends BaseMapper<City> {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.peanut.modules.book.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.peanut.modules.book.entity.CountyEntity;
|
||||
import com.peanut.modules.book.entity.County;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
@@ -12,6 +12,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
* @date 2022-10-27 16:07:59
|
||||
*/
|
||||
@Mapper
|
||||
public interface CountyDao extends BaseMapper<CountyEntity> {
|
||||
public interface CountyDao extends BaseMapper<County> {
|
||||
|
||||
}
|
||||
|
||||
@@ -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<ExpressCompany> {
|
||||
List<ExpressCompanyVo> getExpressCompanyList();
|
||||
}
|
||||
@@ -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<BookTaskEntity> {
|
||||
public interface ExpressFeeDao extends BaseMapper<ExpressFee> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.peanut.modules.book.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.peanut.modules.book.entity.ExpressOrder;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ExpressOrderDao extends BaseMapper<ExpressOrder> {
|
||||
int insertNewExpressOrder(ExpressOrder expressOrder);
|
||||
}
|
||||
@@ -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<FMSCommodity> {
|
||||
|
||||
/**
|
||||
* 批量保存快递信息
|
||||
*
|
||||
* @param fmsOrderList
|
||||
* @return
|
||||
*/
|
||||
public int batchInsert(List<FMSCommodity> fmsOrderList);
|
||||
|
||||
}
|
||||
@@ -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<FMSOrderEntity> {
|
||||
|
||||
/**
|
||||
* 批量保存快递信息
|
||||
*
|
||||
* @param fmsOrderList
|
||||
* @return
|
||||
*/
|
||||
public int batchInsert(List<FMSOrderEntity> fmsOrderList);
|
||||
|
||||
}
|
||||
@@ -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<FMSOrderDetailEntity> {
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.peanut.modules.book.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.peanut.modules.book.entity.ProvinceEntity;
|
||||
import com.peanut.modules.book.entity.Province;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
@@ -12,6 +12,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
* @date 2022-10-27 16:07:59
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProvinceDao extends BaseMapper<ProvinceEntity> {
|
||||
public interface ProvinceDao extends BaseMapper<Province> {
|
||||
|
||||
}
|
||||
|
||||
@@ -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<ShopProductEntity> {
|
||||
|
||||
List<ShopProductEntity> appGetCategoryList(Integer catId);
|
||||
|
||||
|
||||
int getTotalWeight(List<Integer> productIdList);
|
||||
|
||||
}
|
||||
|
||||
@@ -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<UserAddressEntity> {
|
||||
public interface UserAddressDao extends BaseMapper<UserAddress> {
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -18,7 +18,7 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
@TableName("buy_order")
|
||||
public class BuyOrderEntity implements Serializable {
|
||||
public class BuyOrder implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId
|
||||
@@ -125,7 +125,7 @@ public class BuyOrderEntity implements Serializable {
|
||||
private Integer delFlag;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<BuyOrderDetailEntity> products;
|
||||
private List<BuyOrderDetail> products;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String buyType;
|
||||
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@@ -16,19 +17,19 @@ 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
|
||||
@TableName("buy_order_detail")
|
||||
public class BuyOrderDetailEntity implements Serializable {
|
||||
public class BuyOrderDetail implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 订单详情id
|
||||
*/
|
||||
@TableId
|
||||
private Long allOrderId;
|
||||
private Long id;
|
||||
/**
|
||||
* 订单表id
|
||||
*/
|
||||
@@ -56,15 +57,11 @@ public class BuyOrderDetailEntity implements Serializable {
|
||||
/**
|
||||
* 商品重量
|
||||
*/
|
||||
private Float weight;
|
||||
private BigDecimal weight;
|
||||
/**
|
||||
* 商品类型
|
||||
*/
|
||||
private String productType;
|
||||
/**
|
||||
* 物流单号
|
||||
*/
|
||||
private String shippingSn;
|
||||
/**
|
||||
* 订单状态 0-待支付 1-待发货 2-待收货
|
||||
*/
|
||||
@@ -81,28 +78,12 @@ public class BuyOrderDetailEntity implements Serializable {
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
@TableField(exist = false)
|
||||
private String image;
|
||||
/**
|
||||
* 地址id
|
||||
*/
|
||||
private Integer addressId;
|
||||
/**
|
||||
* 面单html
|
||||
*/
|
||||
private String fmsHtml;
|
||||
/**
|
||||
* 快递公司编码
|
||||
*/
|
||||
private String shipperCode;
|
||||
/**
|
||||
* 快递公司名称
|
||||
*/
|
||||
private String shipperName;
|
||||
/**
|
||||
* 是否已打印 0: 未打印,1:已打印
|
||||
*/
|
||||
private String isPrint;
|
||||
private String expressBillTemplate;
|
||||
/**
|
||||
* 商品图片地址
|
||||
*/
|
||||
@@ -110,10 +91,13 @@ public class BuyOrderDetailEntity implements Serializable {
|
||||
/**
|
||||
* 评价 ID
|
||||
*/
|
||||
@TableField("record_id")
|
||||
private Integer recordId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Long timestamp;
|
||||
|
||||
private Integer recordId;
|
||||
/**
|
||||
* 快递单号
|
||||
*/
|
||||
private String expressBillNo;
|
||||
/**
|
||||
* 快递公司编码
|
||||
*/
|
||||
private String expressCompanyCode;
|
||||
}
|
||||
@@ -20,7 +20,7 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
@TableName("base_city")
|
||||
public class CityEntity implements Serializable {
|
||||
public class City implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
@@ -46,5 +46,5 @@ public class CityEntity implements Serializable {
|
||||
private String regionCode;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<CountyEntity> countyList;
|
||||
private List<County> countyList;
|
||||
}
|
||||
@@ -1,13 +1,11 @@
|
||||
package com.peanut.modules.book.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -20,7 +18,7 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
@TableName("base_county")
|
||||
public class CountyEntity implements Serializable {
|
||||
public class County implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.peanut.modules.book.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description: 货品 Value Object
|
||||
* @Author: Cauchy
|
||||
* @CreateTime: 2023/10/16
|
||||
*/
|
||||
@Data
|
||||
public class ExpressCommodity {
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String GoodsName;
|
||||
/**
|
||||
* 商品编码
|
||||
*/
|
||||
private String GoodsCode;
|
||||
/**
|
||||
* 商品数量
|
||||
*/
|
||||
private Integer Goodsquantity;
|
||||
/**
|
||||
* 商品价格
|
||||
*/
|
||||
private Double GoodsPrice;
|
||||
/**
|
||||
* 商品重量
|
||||
*/
|
||||
private Double GoodsWeight;
|
||||
/**
|
||||
* 商品描述
|
||||
*/
|
||||
private String GoodsDesc;
|
||||
/**
|
||||
* 商品体积
|
||||
*/
|
||||
private Double GoodsVol;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
46
src/main/java/com/peanut/modules/book/entity/ExpressFee.java
Normal file
46
src/main/java/com/peanut/modules/book/entity/ExpressFee.java
Normal file
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.peanut.modules.book.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 快递订单
|
||||
* @Author: Cauchy
|
||||
* @CreateTime: 2023/10/16
|
||||
*/
|
||||
@Data
|
||||
@TableName("express_order")
|
||||
public class ExpressOrder {
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private int id;
|
||||
/**
|
||||
* 用户 ID
|
||||
*/
|
||||
private int userId;
|
||||
/**
|
||||
* 省份
|
||||
*/
|
||||
private String province;
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private String city;
|
||||
/**
|
||||
* 区县
|
||||
*/
|
||||
private String county;
|
||||
/**
|
||||
* 收件人姓名
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 收件人电话
|
||||
*/
|
||||
private String mobile;
|
||||
/**
|
||||
* 收件人详细地址
|
||||
*/
|
||||
private String address;
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
private Integer orderId;
|
||||
/**
|
||||
* 快递公司代码
|
||||
*/
|
||||
private String expressCompanyCode;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 快递费
|
||||
*/
|
||||
private BigDecimal expressFee;
|
||||
/**
|
||||
* 总重量
|
||||
*/
|
||||
private BigDecimal totalWeight;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 删除标识
|
||||
*/
|
||||
private int delFlag;
|
||||
/**
|
||||
* 物品信息
|
||||
*/
|
||||
private List<ExpressCommodity> Commodity;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.peanut.modules.book.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 快递查询返回结果 Value Object
|
||||
* @Author: Cauchy
|
||||
* @CreateTime: 2023/10/17
|
||||
*/
|
||||
@Data
|
||||
public class ExpressQueryResponse implements Serializable {
|
||||
/**
|
||||
* 用户 ID
|
||||
*/
|
||||
private String EBusinessID;
|
||||
/**
|
||||
* 快递公司编码
|
||||
*/
|
||||
private String ShipperCode;
|
||||
/**
|
||||
* 快递单号
|
||||
*/
|
||||
private String LogisticCode;
|
||||
/**
|
||||
* 是否成功
|
||||
*/
|
||||
private boolean Success;
|
||||
/**
|
||||
* 原因
|
||||
*/
|
||||
private String Reason;
|
||||
/**
|
||||
* 状态
|
||||
* 普通物流状态:
|
||||
* 0-暂无轨迹信息
|
||||
* 1-已揽收
|
||||
* 2-在途中
|
||||
* 3-签收
|
||||
* 4-问题件
|
||||
* 5-转寄
|
||||
* 6-清关
|
||||
*/
|
||||
private String State;
|
||||
/**
|
||||
* 轨迹
|
||||
*/
|
||||
private List<Trace> Traces;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
|
||||
}
|
||||
@@ -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<FMSCommodity> commodityList;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 订单详情ID
|
||||
*/
|
||||
private Integer orderId;
|
||||
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
@TableName("base_province")
|
||||
public class ProvinceEntity implements Serializable {
|
||||
public class Province implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
@@ -42,5 +42,5 @@ public class ProvinceEntity implements Serializable {
|
||||
private String regionCode;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<CityEntity> cityList;
|
||||
private List<City> cityList;
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public class ShopProductEntity implements Serializable {
|
||||
/**
|
||||
* 商品重量
|
||||
*/
|
||||
private Float weight;
|
||||
private Integer weight;
|
||||
/**
|
||||
* 上架状态
|
||||
*/
|
||||
|
||||
17
src/main/java/com/peanut/modules/book/entity/Trace.java
Normal file
17
src/main/java/com/peanut/modules/book/entity/Trace.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.peanut.modules.book.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class Trace {
|
||||
/**
|
||||
* 轨迹时间
|
||||
*/
|
||||
private Date AcceptTime;
|
||||
/**
|
||||
* 轨迹描述
|
||||
*/
|
||||
private String AcceptStation;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -1,13 +1,9 @@
|
||||
package com.peanut.modules.book.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.modules.book.entity.ActivityEntity;
|
||||
import com.peanut.modules.book.entity.BuyOrderEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
||||
@@ -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<BookClockInEntity> {
|
||||
PageUtils queryPage(Map<String, Object> params);
|
||||
|
||||
PageUtils queryPagemylist(Map<String, Object> params);
|
||||
}
|
||||
@@ -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<BookClockinCommentEntity> {
|
||||
PageUtils queryPage(Map<String, Object> params);
|
||||
}
|
||||
@@ -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<BookClockinPunchEntity> {
|
||||
|
||||
|
||||
PageUtils queryPage(Map<String, Object> params);
|
||||
}
|
||||
@@ -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<BookTaskEntity> {
|
||||
PageUtils queryPage(Map<String, Object> params);
|
||||
|
||||
PageUtils queryPageServi(Map<String, Object> params);
|
||||
}
|
||||
@@ -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.BuyOrderDetailEntity;
|
||||
import com.peanut.modules.book.entity.BuyOrderDetail;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.Map;
|
||||
* @email yl328572838@163.com
|
||||
* @date 2022-08-29 15:27:44
|
||||
*/
|
||||
public interface BuyOrderDetailService extends IService<BuyOrderDetailEntity> {
|
||||
public interface BuyOrderDetailService extends IService<BuyOrderDetail> {
|
||||
|
||||
PageUtils queryPage(Map<String, Object> params);
|
||||
|
||||
@@ -21,7 +21,5 @@ public interface BuyOrderDetailService extends IService<BuyOrderDetailEntity> {
|
||||
|
||||
PageUtils querybuy(Map<String,Object>params);
|
||||
|
||||
PageUtils querybuyss(Map<String,Object>params);
|
||||
|
||||
public void batchUpdateByShippingSns(String[] shippingSnList);
|
||||
// void batchUpdateByShippingSns(String[] shippingSnList);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
package com.peanut.modules.book.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.book.entity.BuyOrderEntity;
|
||||
import com.peanut.modules.book.entity.BuyOrder;
|
||||
|
||||
import javax.xml.soap.Text;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -18,43 +15,28 @@ import java.util.Map;
|
||||
* @email yl328572838@163.com
|
||||
* @date 2022-08-29 15:27:44
|
||||
*/
|
||||
public interface BuyOrderService extends IService<BuyOrderEntity> {
|
||||
public interface BuyOrderService extends IService<BuyOrder> {
|
||||
|
||||
PageUtils queryPage(Map<String, Object> params) throws Exception;
|
||||
|
||||
PageUtils queryPage1(Map<String, Object> 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);
|
||||
|
||||
// 及时查询
|
||||
public JSONObject queryFMS(String shipperCode, String expNo);
|
||||
void updateOrderStatus(Integer userId, String orderSn, String type);
|
||||
|
||||
// 查询勾选的订单是否有可合并
|
||||
public List checkOrder(Integer[] orderIds);
|
||||
List checkOrder(Integer[] orderIds);
|
||||
|
||||
// 查询所有订单是否有可合并
|
||||
public Page checkOrder(Map<String, Object> params);
|
||||
Page checkOrder(Map<String, Object> params);
|
||||
|
||||
// 批量发货功能
|
||||
public void blendSendFMS(Integer[] orderDetailIds, String shipperCode, String shipperName);
|
||||
/**
|
||||
* 订单拆分发货
|
||||
*
|
||||
* @param expressCompanyCode 快递公司代码
|
||||
* @param buyOrderDetailId 订单详情 ID 列表
|
||||
*/
|
||||
void createSplitPackageOrder(String expressCompanyCode, List<Integer> buyOrderDetailId);
|
||||
|
||||
|
||||
public int getProductGoodsType (Map<String, Object> param,Map<String, Object> productMap);
|
||||
|
||||
|
||||
public R randomOrderCode( BuyOrderEntity buyOrder);
|
||||
|
||||
PageUtils querySheet(Map<String, Object> params);
|
||||
|
||||
|
||||
PageUtils queryPages(Map<String, Object> params);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.CityEntity;
|
||||
import com.peanut.modules.book.entity.City;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.Map;
|
||||
* @email yl328572838@163.com
|
||||
* @date 2022-10-27 16:07:59
|
||||
*/
|
||||
public interface CityService extends IService<CityEntity> {
|
||||
public interface CityService extends IService<City> {
|
||||
|
||||
PageUtils queryPage(Map<String, Object> params);
|
||||
}
|
||||
|
||||
@@ -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.CountyEntity;
|
||||
import com.peanut.modules.book.entity.County;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.Map;
|
||||
* @email yl328572838@163.com
|
||||
* @date 2022-10-27 16:07:59
|
||||
*/
|
||||
public interface CountyService extends IService<CountyEntity> {
|
||||
public interface CountyService extends IService<County> {
|
||||
|
||||
PageUtils queryPage(Map<String, Object> params);
|
||||
}
|
||||
|
||||
@@ -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<ExpressCompany> {
|
||||
/**
|
||||
* 获取快递公司列表
|
||||
*
|
||||
* @return List
|
||||
*/
|
||||
List<ExpressCompanyVo> getExpressCompanyList();
|
||||
}
|
||||
@@ -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<ExpressFee> {
|
||||
/**
|
||||
* 计算快递费
|
||||
*
|
||||
* @param expressCompanyCode 快递公司代码
|
||||
* @param weight 重量
|
||||
* @param regionCode 地区代码
|
||||
* @return BigDecimal 费用
|
||||
*/
|
||||
BigDecimal calculateExpressFee(String expressCompanyCode, BigDecimal weight, String regionCode);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.peanut.modules.book.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.book.entity.ExpressOrder;
|
||||
import com.peanut.modules.book.vo.ExpressOrderResponseVo;
|
||||
import com.peanut.modules.book.entity.ExpressQueryResponse;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public interface ExpressOrderService extends IService<ExpressOrder> {
|
||||
/**
|
||||
* 下单生成面单
|
||||
*
|
||||
* @param expressOrder
|
||||
* @throws Exception
|
||||
*/
|
||||
ExpressOrderResponseVo placeExpressOrder(ExpressOrder expressOrder);
|
||||
|
||||
ExpressQueryResponse queryExpressOrder(String ShipperCode, String LogisticCode);
|
||||
}
|
||||
@@ -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<FMSOrderDetailEntity> {
|
||||
|
||||
PageUtils queryPage(Map<String, Object> params);
|
||||
}
|
||||
|
||||
@@ -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.ProvinceEntity;
|
||||
import com.peanut.modules.book.entity.Province;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -14,10 +14,10 @@ import java.util.Map;
|
||||
* @email yl328572838@163.com
|
||||
* @date 2022-10-27 16:07:59
|
||||
*/
|
||||
public interface ProvinceService extends IService<ProvinceEntity> {
|
||||
public interface ProvinceService extends IService<Province> {
|
||||
|
||||
PageUtils queryPage(Map<String, Object> params);
|
||||
|
||||
List<ProvinceEntity> getCity();
|
||||
List<Province> getCity();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,19 +2,22 @@ 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 com.peanut.modules.book.vo.UserAddressVo;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author yl
|
||||
* @email yl328572838@163.com
|
||||
* @date 2022-10-31 11:20:32
|
||||
*/
|
||||
public interface UserAddressService extends IService<UserAddressEntity> {
|
||||
public interface UserAddressService extends IService<UserAddress> {
|
||||
|
||||
PageUtils queryPage(Map<String, Object> params);
|
||||
|
||||
UserAddressVo getAddressName(UserAddressVo vo, String regionCode);
|
||||
|
||||
int getUserDefaultAddressCount(Integer userId);
|
||||
}
|
||||
|
||||
|
||||
@@ -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<BookClockinDao, BookClockInEntity> implements BookClockInService {
|
||||
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
Object book = params.get("bookid");
|
||||
Object taskid = params.get("taskid");
|
||||
IPage<BookClockInEntity> page = this.page(
|
||||
new Query<BookClockInEntity>().getPage(params),
|
||||
new QueryWrapper<BookClockInEntity>()
|
||||
.eq("book_id", book)
|
||||
.eq("task_id", taskid)
|
||||
.orderByDesc("create_time")
|
||||
|
||||
);
|
||||
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageUtils queryPagemylist(Map<String, Object> params) {
|
||||
IPage<BookClockInEntity> page = this.page(
|
||||
new Query<BookClockInEntity>().getPage(params),
|
||||
new QueryWrapper<BookClockInEntity>()
|
||||
|
||||
);
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<BookClockinCommentDao,BookClockinCommentEntity> implements BookClockinCommentService{
|
||||
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
IPage<BookClockinCommentEntity> page = this.page(
|
||||
new Query<BookClockinCommentEntity>().getPage(params),
|
||||
new QueryWrapper<BookClockinCommentEntity>().orderByDesc("create_time")
|
||||
|
||||
);
|
||||
|
||||
return new PageUtils(page);
|
||||
}
|
||||
}
|
||||
@@ -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<BookClockinPunchDao, BookClockinPunchEntity> implements BookClockinPunchService {
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
|
||||
Object book =params.get("bookid");
|
||||
Object days = params.get("days");
|
||||
IPage<BookClockinPunchEntity> page = this.page(
|
||||
new Query<BookClockinPunchEntity>().getPage(params),
|
||||
new QueryWrapper<BookClockinPunchEntity>()
|
||||
.eq("book_id",book)
|
||||
.eq("days",days)
|
||||
.orderByDesc("create_time")
|
||||
|
||||
);
|
||||
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -51,10 +51,6 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
|
||||
private BookChapterService bookChapterService;
|
||||
@Autowired
|
||||
ConstantPropertiesUtils constantPropertiesUtils;
|
||||
@Autowired
|
||||
private BookForumArticlesService bookForumArticlesService;
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@@ -62,10 +58,6 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
|
||||
//出版社
|
||||
String publisherName1 = (String) params.get("publisherName");
|
||||
String state = (String) params.get("state");
|
||||
// String[] publisherName1split1 = publisherName1.split(",");
|
||||
// String join = StringUtils.join(publisherName1split1, "','");
|
||||
// 多查询语句
|
||||
// String sql = "IN_SET(publisher_id, (SELECT GROUP_CONCAT(id) FROM publisher WHERE publisher_name in ('\"+ join +\"'))) = 1";
|
||||
//类型
|
||||
String typeC = (String) params.get("type");
|
||||
//作者
|
||||
@@ -102,15 +94,9 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
|
||||
.eq("dict_type", voicesStatus).eq("dict_label", "processing_results"));
|
||||
|
||||
String chapterStatusName = chapter.getDictValue();
|
||||
|
||||
String contentStatusName = content.getDictValue();
|
||||
|
||||
String voicesStatusName = voices.getDictValue();
|
||||
|
||||
|
||||
String[] split = type.split(",");
|
||||
|
||||
|
||||
for (String tp : split) {
|
||||
SysDictDataEntity dict = sysDictDataService.getBaseMapper().selectOne(new QueryWrapper<SysDictDataEntity>()
|
||||
.eq("dict_type", tp).eq("dict_label", "book_type"));
|
||||
@@ -120,13 +106,10 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
|
||||
}
|
||||
String authorId = book.getAuthorId();
|
||||
String publisherId = book.getPublisherId();
|
||||
|
||||
String[] authorIds = authorId.split(",");
|
||||
String[] publisherIds = publisherId.split(",");
|
||||
|
||||
List<String> authorList = Arrays.asList(authorIds);
|
||||
List<String> publisherList = Arrays.asList(publisherIds);
|
||||
|
||||
List<PublisherEntity> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<PublisherEntity>().in("id", publisherList));
|
||||
List<AuthorEntity> authorEntities = authorService.getBaseMapper().selectList(new QueryWrapper<AuthorEntity>().in("id", authorList));
|
||||
for (AuthorEntity authorEntity : authorEntities) {
|
||||
@@ -165,77 +148,40 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
|
||||
public void getChapter(Integer id) {
|
||||
|
||||
BookEntity bookEntity = this.baseMapper.selectById(id);
|
||||
|
||||
String novel = bookEntity.getNovel();
|
||||
|
||||
Integer bookEntityId = bookEntity.getId();
|
||||
|
||||
// String fileName = novel.split("/")[novel.split("/").length - 1];
|
||||
|
||||
String fileName = novel.replace("https://ehh-private-01.oss-cn-beijing.aliyuncs.com/", "");
|
||||
|
||||
Long count = (long) 0;
|
||||
boolean bflag = false;
|
||||
int n = 0;
|
||||
String newStr = null;
|
||||
String titleName = null; //旧章节
|
||||
String titleName; //旧章节
|
||||
String newChapterName = null;//新章节名称
|
||||
String substring = null;
|
||||
int indexOf = 0;
|
||||
int indexOf1 = 0;
|
||||
int linecount = 0;
|
||||
|
||||
// ArrayList<Object> chapterList = new ArrayList<>();
|
||||
// ArrayList<Object> contentList = new ArrayList<>();
|
||||
|
||||
|
||||
// 创建OSSClient实例。
|
||||
OSS ossClient = new OSSClientBuilder().build(constantPropertiesUtils.END_POIND, constantPropertiesUtils.ACCESS_KEY_ID, constantPropertiesUtils.ACCESS_KEY_SECRET);
|
||||
try {
|
||||
// ossObject包含文件所在的存储空间名称、文件名称、文件元信息以及一个输入流。
|
||||
OSSObject ossObject = ossClient.getObject(constantPropertiesUtils.BUCKET_NAME, fileName);
|
||||
|
||||
// 读取文件内容。
|
||||
// System.out.println("Object content:");
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(ossObject.getObjectContent(), "UTF-8"));
|
||||
while (true) {
|
||||
String line = reader.readLine();
|
||||
|
||||
if (line == null) break;
|
||||
|
||||
|
||||
BookChapterEntity content = new BookChapterEntity();
|
||||
|
||||
count++;
|
||||
// 正则表达式
|
||||
Pattern p = Pattern.compile("(^\\s*第)(.{1,9})[章节卷集部篇回讲](\\s{1})(.*)($\\s*)");
|
||||
|
||||
Matcher matcher = p.matcher(line);
|
||||
Matcher matcher1 = p.matcher(line);
|
||||
|
||||
newStr = newStr + line;
|
||||
|
||||
|
||||
while (matcher.find()) {
|
||||
|
||||
if (StringUtils.isNotBlank(newChapterName)) {
|
||||
content.setChapter(newChapterName.trim());
|
||||
}
|
||||
titleName = matcher.group();
|
||||
//章节去空
|
||||
newChapterName = titleName.trim();
|
||||
|
||||
//获取章节
|
||||
// System.out.println(newChapterName);
|
||||
// content.setChapter(newChapterName);
|
||||
// content.setNumber(++linecount);
|
||||
// chapterList.add(newChapterName);
|
||||
indexOf1 = indexOf;
|
||||
// System.out.println("indexOf" + indexOf);
|
||||
indexOf = newStr.indexOf(newChapterName);
|
||||
|
||||
|
||||
// System.out.println(newChapterName + ":" + "第" + count + "行"); // 得到返回的章
|
||||
if (bflag) {
|
||||
bflag = false;
|
||||
break;
|
||||
@@ -246,7 +192,6 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
|
||||
}
|
||||
n = 1;
|
||||
bflag = true;
|
||||
//System.out.println(chapter);
|
||||
}
|
||||
|
||||
|
||||
@@ -258,14 +203,10 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
|
||||
content.setBookId(bookEntityId);
|
||||
content.setNumber(++linecount);
|
||||
System.out.println(substring);
|
||||
// contentList.add(substring);
|
||||
System.out.println(content.toString());
|
||||
bookChapterService.save(content);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// 数据读取完成后,获取的流必须关闭,否则会造成连接泄漏,导致请求无连接可用,程序无法正常工作。
|
||||
reader.close();
|
||||
@@ -273,11 +214,6 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
|
||||
// 致请求无连接可用,程序无法正常工作。
|
||||
ossObject.close();
|
||||
bookEntity.setChapterStatus("2");
|
||||
//
|
||||
// System.out.println(chapterList);
|
||||
// System.out.println(contentList);
|
||||
|
||||
|
||||
} catch (OSSException oe) {
|
||||
bookEntity.setChapterStatus("3");
|
||||
System.out.println("Caught an OSSException, which means your request made it to OSS, "
|
||||
@@ -310,7 +246,6 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
|
||||
);
|
||||
|
||||
List<BookEntity> newBookList = page.getRecords();
|
||||
|
||||
for (BookEntity book : newBookList) {
|
||||
String authorName = "";
|
||||
String publisherName = "";
|
||||
@@ -325,13 +260,10 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
|
||||
}
|
||||
|
||||
authorName = authorName.startsWith(",") ? authorName.substring(1) : authorName;
|
||||
|
||||
|
||||
String publisherId = book.getPublisherId();
|
||||
String[] publisherIds = publisherId.split(",");
|
||||
List<String> publisherList = Arrays.asList(publisherIds);
|
||||
List<PublisherEntity> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<PublisherEntity>().in("id", publisherList));
|
||||
|
||||
for (PublisherEntity publisherEntity : publisherEntities) {
|
||||
publisherName += "," + publisherEntity.getPublisherName();
|
||||
}
|
||||
@@ -339,8 +271,6 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
|
||||
book.setPublisherName(publisherName);
|
||||
book.setAuthorName(authorName);
|
||||
}
|
||||
|
||||
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
@@ -349,11 +279,12 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
|
||||
Object id = params.get("id");
|
||||
IPage<BookEntity> page = this.page(
|
||||
new Query<BookEntity>().getPage(params),
|
||||
new QueryWrapper<BookEntity>().eq("id",id)
|
||||
new QueryWrapper<BookEntity>().eq("id", id)
|
||||
);
|
||||
return new PageUtils(page);
|
||||
}
|
||||
@Override
|
||||
|
||||
@Override
|
||||
public PageUtils getNewBook(Map<String, Object> params) {
|
||||
|
||||
IPage<BookEntity> page = this.page(
|
||||
@@ -371,19 +302,14 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
|
||||
String[] authorIds = authorId.split(",");
|
||||
List<String> authorList = Arrays.asList(authorIds);
|
||||
List<AuthorEntity> authorEntities = authorService.getBaseMapper().selectList(new QueryWrapper<AuthorEntity>().in("id", authorList));
|
||||
|
||||
for (AuthorEntity authorEntity : authorEntities) {
|
||||
authorName += "," + authorEntity.getAuthorName();
|
||||
}
|
||||
|
||||
authorName = authorName.startsWith(",") ? authorName.substring(1) : authorName;
|
||||
|
||||
|
||||
String publisherId = book.getPublisherId();
|
||||
String[] publisherIds = publisherId.split(",");
|
||||
List<String> publisherList = Arrays.asList(publisherIds);
|
||||
List<PublisherEntity> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<PublisherEntity>().in("id", publisherList));
|
||||
|
||||
for (PublisherEntity publisherEntity : publisherEntities) {
|
||||
publisherName += "," + publisherEntity.getPublisherName();
|
||||
}
|
||||
@@ -391,8 +317,6 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
|
||||
book.setPublisherName(publisherName);
|
||||
book.setAuthorName(authorName);
|
||||
}
|
||||
|
||||
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
@@ -454,7 +378,6 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
|
||||
System.out.println(StringUtils.isNotBlank(paragraph.getText().trim()));
|
||||
//获取标题
|
||||
if (paragraph.getStyleName().equals("Heading1") && StringUtils.isNotBlank(paragraph.getText().trim()))//段落样式为“标题1”的内容
|
||||
// if (paragraph.getStyleName().equals("Normal") && StringUtils.isNotBlank(paragraph.getText().trim()))//段落样式为“标题1”的内容
|
||||
{
|
||||
num++;
|
||||
|
||||
@@ -472,7 +395,6 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
|
||||
return false;
|
||||
}
|
||||
|
||||
//todo 章节拆分 按照章节保存
|
||||
@Override
|
||||
public boolean getWord(Integer bookId) {
|
||||
BookEntity bookEntity = this.getBaseMapper().selectById(bookId);
|
||||
@@ -484,35 +406,8 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
|
||||
Section section = doc.getSections().get(i);
|
||||
//遍历Paragraph,每个小节下有若干段落
|
||||
for (int j = 0; j < section.getParagraphs().getCount() - 1; j++) {
|
||||
|
||||
//插入分页符到小节下若干段落
|
||||
Paragraph paragraph = section.getParagraphs().get(j);
|
||||
|
||||
//插入分页符到第五个段落
|
||||
// Paragraph paragraph = section.getParagraphs().get(4);
|
||||
|
||||
//获取标题
|
||||
|
||||
|
||||
// int cj = 0;
|
||||
// if (section.getParagraphs().get(j).getStyleName().equals("Heading2")) {
|
||||
// cj = 2;
|
||||
// }
|
||||
// if (section.getParagraphs().get(j).getStyleName().equals("Heading3")) {
|
||||
// cj = 3;
|
||||
// }
|
||||
// if (section.getParagraphs().get(j).getStyleName().equals("Heading4")) {
|
||||
// cj = 4;
|
||||
// }
|
||||
// int cj= 0;
|
||||
// if (section.getParagraphs().get(j).getStyleName().equals("Heading2")) {
|
||||
//// cj = 2;
|
||||
// }
|
||||
// if(section.getParagraphs().get(j).getStyleName().equals(""))
|
||||
|
||||
if (paragraph.getStyleName().equals("Heading1") && StringUtils.isNotBlank(paragraph.getText().trim())) {
|
||||
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
do {
|
||||
builder.append(section.getParagraphs().get(j).getText());
|
||||
@@ -543,11 +438,11 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
|
||||
|
||||
|
||||
/**
|
||||
* number章节号变小节号
|
||||
* 如果上传文档为只有heading1标题,则按照标题1进行拆分
|
||||
* 如果上传文档的heading1标题下有heading2标题,则按照标题2进行拆分
|
||||
* @param bookId 图书ID
|
||||
* number章节号变小节号
|
||||
* 如果上传文档为只有heading1标题,则按照标题1进行拆分
|
||||
* 如果上传文档的heading1标题下有heading2标题,则按照标题2进行拆分
|
||||
*
|
||||
* @param bookId 图书ID
|
||||
* @return0
|
||||
*/
|
||||
@Override
|
||||
@@ -556,29 +451,26 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
|
||||
String novel = bookEntity.getNovel();
|
||||
InputStream inputStream = FileDownloadUtil.getInputStream(novel);
|
||||
Document doc = new Document(inputStream);
|
||||
int nums = 0;
|
||||
String title2Text = "";
|
||||
int num1=0;
|
||||
|
||||
Map<String,List<String[]>> paraMap = new HashMap<>();
|
||||
Map<String,String> headMap = new HashMap<>();
|
||||
Map<String, List<String[]>> paraMap = new HashMap<>();
|
||||
Map<String, String> headMap = new HashMap<>();
|
||||
List<String> title_list = new ArrayList<>();
|
||||
for (int i = 0; i < doc.getSections().getCount(); i++) {
|
||||
String currentTitle = "";
|
||||
Section section = doc.getSections().get(i);
|
||||
for (int j = 0; j < section.getParagraphs().getCount() - 1; j++) {
|
||||
Paragraph paragraph = section.getParagraphs().get(j);
|
||||
if (paragraph.getStyleName().equals("Heading1") ) {
|
||||
if (paragraph.getStyleName().equals("Heading1")) {
|
||||
String textq = paragraph.getText();
|
||||
currentTitle = textq;
|
||||
title_list.add(currentTitle);
|
||||
List<String[]> secondTitleList = new ArrayList<>();
|
||||
paraMap.put(currentTitle,secondTitleList);
|
||||
if(!section.getParagraphs().get(j+1).getStyleName().matches("Heading2")){
|
||||
int head_index = j ;
|
||||
paraMap.put(currentTitle, secondTitleList);
|
||||
if (!section.getParagraphs().get(j + 1).getStyleName().matches("Heading2")) {
|
||||
int head_index = j;
|
||||
StringBuilder builder = new StringBuilder();
|
||||
do {
|
||||
builder.append(section.getParagraphs().get(head_index).getText());
|
||||
builder.append(section.getParagraphs().get(head_index).getText());
|
||||
head_index++;
|
||||
//防止index超出异常发生
|
||||
if (head_index >= section.getParagraphs().getCount()) {
|
||||
@@ -586,14 +478,14 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
|
||||
}
|
||||
} while (!section.getParagraphs().get(head_index).getStyleName().equals("Heading2"));
|
||||
String head_text = builder.toString();
|
||||
headMap.put(currentTitle,head_text);
|
||||
headMap.put(currentTitle, head_text);
|
||||
|
||||
}
|
||||
} else if (paragraph.getStyleName().equals("Heading2") && StringUtils.isNotBlank(paragraph.getText().trim())) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
boolean isRun = false;
|
||||
do {
|
||||
if(isRun){
|
||||
if (isRun) {
|
||||
builder.append(section.getParagraphs().get(j).getText());
|
||||
}
|
||||
isRun = true;
|
||||
@@ -602,57 +494,44 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
|
||||
if (j >= section.getParagraphs().getCount()) {
|
||||
break;
|
||||
}
|
||||
} while (!section.getParagraphs().get(j).getStyleName().equals("Heading2")&&!section.getParagraphs().get(j).getStyleName().equals("Heading1"));
|
||||
j --;
|
||||
} while (!section.getParagraphs().get(j).getStyleName().equals("Heading2") && !section.getParagraphs().get(j).getStyleName().equals("Heading1"));
|
||||
j--;
|
||||
String text = builder.toString();
|
||||
nums++;
|
||||
title2Text = paragraph.getText(); // 获取标题二的文本内容
|
||||
if(null != title2Text && !"".equals(title2Text)){
|
||||
String [] s = new String[]{title2Text,text};
|
||||
|
||||
if (null != title2Text && !"".equals(title2Text)) {
|
||||
String[] s = new String[]{title2Text, text};
|
||||
paraMap.get(currentTitle).add(s);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
int index = 0;
|
||||
for(String title: title_list){
|
||||
if(null == paraMap.get(title) || paraMap.get(title).size() == 0){
|
||||
index ++ ;
|
||||
for (String title : title_list) {
|
||||
if (null == paraMap.get(title) || paraMap.get(title).size() == 0) {
|
||||
index++;
|
||||
BookChapterEntity bookChapterEntity = new BookChapterEntity();
|
||||
|
||||
bookChapterEntity.setBookId(bookId);
|
||||
bookChapterEntity.setNumber(index);
|
||||
bookChapterEntity.setChapter(title);
|
||||
bookChapterEntity.setSort(1);
|
||||
if(null != headMap.get(title)){
|
||||
|
||||
if (null != headMap.get(title)) {
|
||||
bookChapterEntity.setContent(headMap.get(title));
|
||||
}else {
|
||||
} else {
|
||||
bookChapterEntity.setContent("");
|
||||
|
||||
}
|
||||
|
||||
bookChapterService.save(bookChapterEntity);
|
||||
|
||||
|
||||
}else {
|
||||
for(String[] t : paraMap.get(title)){
|
||||
index ++;
|
||||
} else {
|
||||
for (String[] t : paraMap.get(title)) {
|
||||
index++;
|
||||
BookChapterEntity bookChapterEntity = new BookChapterEntity();
|
||||
bookChapterEntity.setBookId(bookId);
|
||||
bookChapterEntity.setSort(2);
|
||||
bookChapterEntity.setNumber(index);
|
||||
bookChapterEntity.setChapter(title+","+t[0]);
|
||||
bookChapterEntity.setContent(t[1]);
|
||||
|
||||
bookChapterEntity.setChapter(title + "," + t[0]);
|
||||
bookChapterEntity.setContent(t[1]);
|
||||
bookChapterService.save(bookChapterEntity);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -702,18 +581,16 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
|
||||
if (!StringUtils.isEmpty(publisherName)) {
|
||||
book.setPublisherName(publisherName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<BookEntity> getUserClockBooks(Integer userId, Integer limit, Integer page) {
|
||||
String exist_sql = "select 1 from user_ebook_buy where book_id = book.id and user_id = "+userId;
|
||||
String exist_sql = "select 1 from user_ebook_buy where book_id = book.id and user_id = " + userId;
|
||||
LambdaQueryWrapper<BookEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(BookEntity::getClockIn,1);
|
||||
wrapper.eq(BookEntity::getDelFlag,0);
|
||||
wrapper.eq(BookEntity::getClockIn, 1);
|
||||
wrapper.eq(BookEntity::getDelFlag, 0);
|
||||
wrapper.exists(exist_sql);
|
||||
Page<BookEntity> bookEntityPage = this.getBaseMapper().selectPage(new Page<BookEntity>(page, limit), wrapper);
|
||||
return bookEntityPage;
|
||||
@@ -722,15 +599,12 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
|
||||
|
||||
@Override
|
||||
public Page<BookEntity> getUserClockBestBooks(Integer userId, Integer limit, Integer page) {
|
||||
String exist_sql = "select 1 from user_ebook_buy where book_id = book.id and user_id = "+userId;
|
||||
String exist_sql = "select 1 from user_ebook_buy where book_id = book.id and user_id = " + userId;
|
||||
LambdaQueryWrapper<BookEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(BookEntity::getClockIn,1);
|
||||
wrapper.eq(BookEntity::getDelFlag,0);
|
||||
wrapper.eq(BookEntity::getClockIn, 1);
|
||||
wrapper.eq(BookEntity::getDelFlag, 0);
|
||||
wrapper.notExists(exist_sql);
|
||||
Page<BookEntity> bookEntityPage = this.getBaseMapper().selectPage(new Page<BookEntity>(page, limit), wrapper);
|
||||
return bookEntityPage;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -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<BookTaskDao, BookTaskEntity> implements BookTaskService {
|
||||
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
Object bookid = params.get("bookid");
|
||||
IPage<BookTaskEntity> page = this.page(
|
||||
new Query<BookTaskEntity>().getPage(params),
|
||||
new QueryWrapper<BookTaskEntity>().eq("book_id",bookid).orderByAsc("days")
|
||||
|
||||
);
|
||||
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageUtils queryPageServi(Map<String, Object> params) {
|
||||
Object bookid = params.get("bookid");
|
||||
Object days = params.get("days");
|
||||
IPage<BookTaskEntity> page = this.page(
|
||||
new Query<BookTaskEntity>().getPage(params),
|
||||
new QueryWrapper<BookTaskEntity>().eq("book_id",bookid).orderByDesc("create_time").eq("days",days)
|
||||
);
|
||||
|
||||
return new PageUtils(page);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +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 com.peanut.modules.book.entity.BuyOrderDetail;
|
||||
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;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -19,33 +11,24 @@ import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.Query;
|
||||
|
||||
import com.peanut.modules.book.dao.BuyOrderDetailDao;
|
||||
import com.peanut.modules.book.entity.BuyOrderDetailEntity;
|
||||
import com.peanut.modules.book.service.BuyOrderDetailService;
|
||||
|
||||
|
||||
@Service("buyOrderDetailService")
|
||||
public class BuyOrderDetailServiceImpl extends ServiceImpl<BuyOrderDetailDao, BuyOrderDetailEntity> implements BuyOrderDetailService {
|
||||
public class BuyOrderDetailServiceImpl extends ServiceImpl<BuyOrderDetailDao, BuyOrderDetail> implements BuyOrderDetailService {
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
Integer orderId = Integer.valueOf((String) params.get("orderId"));
|
||||
IPage<BuyOrderDetailEntity> page = this.page(
|
||||
new Query<BuyOrderDetailEntity>().getPage(params),
|
||||
new QueryWrapper<BuyOrderDetailEntity>()
|
||||
IPage<BuyOrderDetail> page = this.page(
|
||||
new Query<BuyOrderDetail>().getPage(params),
|
||||
new QueryWrapper<BuyOrderDetail>()
|
||||
.eq("order_id",orderId)
|
||||
);
|
||||
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 去重查询未打印的面单信息
|
||||
* @param params
|
||||
@@ -53,9 +36,9 @@ public class BuyOrderDetailServiceImpl extends ServiceImpl<BuyOrderDetailDao, Bu
|
||||
*/
|
||||
@Override
|
||||
public PageUtils querySheet(Map<String, Object> params) {
|
||||
IPage<BuyOrderDetailEntity> page = this.page(
|
||||
new Query<BuyOrderDetailEntity>().getPage(params),
|
||||
new QueryWrapper<BuyOrderDetailEntity>().eq("is_print","0")
|
||||
IPage<BuyOrderDetail> page = this.page(
|
||||
new Query<BuyOrderDetail>().getPage(params),
|
||||
new QueryWrapper<BuyOrderDetail>().eq("is_print","0")
|
||||
.groupBy("shipping_sn")
|
||||
);
|
||||
return new PageUtils(page);
|
||||
@@ -64,9 +47,9 @@ public class BuyOrderDetailServiceImpl extends ServiceImpl<BuyOrderDetailDao, Bu
|
||||
@Override
|
||||
public PageUtils querybuy(Map<String, Object> params) {
|
||||
Integer userid = Integer.valueOf((String) params.get("id"));
|
||||
IPage<BuyOrderDetailEntity> page = this.page(
|
||||
new Query<BuyOrderDetailEntity>().getPage(params),
|
||||
new QueryWrapper<BuyOrderDetailEntity>()
|
||||
IPage<BuyOrderDetail> page = this.page(
|
||||
new Query<BuyOrderDetail>().getPage(params),
|
||||
new QueryWrapper<BuyOrderDetail>()
|
||||
.eq("user_id",userid)
|
||||
|
||||
);
|
||||
@@ -74,25 +57,18 @@ public class BuyOrderDetailServiceImpl extends ServiceImpl<BuyOrderDetailDao, Bu
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageUtils querybuyss(Map<String, Object> params) {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void batchUpdateByShippingSns(String[] shippingSnList) {
|
||||
List<BuyOrderDetailEntity> buyOrderDetailEntityList = this.list(new QueryWrapper<BuyOrderDetailEntity>());
|
||||
for(String sn : shippingSnList){
|
||||
for(BuyOrderDetailEntity buyOrderDetailEntity : buyOrderDetailEntityList){
|
||||
if(StringUtil.isNotEmpty(buyOrderDetailEntity.getShippingSn()) && buyOrderDetailEntity.getShippingSn().equals(sn)){
|
||||
buyOrderDetailEntity.setIsPrint("1");
|
||||
}
|
||||
}
|
||||
}
|
||||
this.updateBatchById(buyOrderDetailEntityList);
|
||||
}
|
||||
// @Override
|
||||
// public void batchUpdateByShippingSns(String[] shippingSnList) {
|
||||
// List<BuyOrderDetailEntity> buyOrderDetailEntityList = this.list(new QueryWrapper<>());
|
||||
// for(String sn : shippingSnList){
|
||||
// for(BuyOrderDetailEntity buyOrderDetailEntity : buyOrderDetailEntityList){
|
||||
// if(StringUtil.isNotEmpty(buyOrderDetailEntity.getShippingSn()) && buyOrderDetailEntity.getShippingSn().equals(sn)){
|
||||
// buyOrderDetailEntity.setIsPrint("1");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// this.updateBatchById(buyOrderDetailEntityList);
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -1,25 +1,18 @@
|
||||
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;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
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.entity.*;
|
||||
import com.peanut.modules.book.service.*;
|
||||
import com.peanut.modules.book.vo.ProductVo;
|
||||
import com.peanut.modules.book.entity.ExpressCommodity;
|
||||
import com.peanut.modules.book.vo.ExpressOrderResponseVo;
|
||||
import com.peanut.modules.book.vo.UserOrderVo;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
@@ -28,38 +21,42 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
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;
|
||||
|
||||
|
||||
@Service("buyOrderService")
|
||||
public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrderEntity> implements BuyOrderService {
|
||||
public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> implements BuyOrderService {
|
||||
|
||||
@Autowired
|
||||
private BuyOrderDetailService buyOrderDetailService;
|
||||
@Autowired
|
||||
private ShopProductService shopProductService;
|
||||
@Autowired
|
||||
private MyUserService myUserService;
|
||||
|
||||
//todo 6.2 buyOrderDao buyOrderDetailDao因为报红把 @Autowired 换成JDK注解 @Resource它不检查,所以也就不会报红。
|
||||
@Resource
|
||||
private BuyOrderDao buyOrderDao;
|
||||
@Resource
|
||||
private BuyOrderDetailDao buyOrderDetailDao;
|
||||
@Autowired
|
||||
private FMSOrderDetailService fmsOrderDetailService;
|
||||
private ExpressFeeService expressFeeService;
|
||||
|
||||
@Autowired
|
||||
private ExpressOrderService expressOrderService;
|
||||
|
||||
@Autowired
|
||||
CountyService countyService;
|
||||
|
||||
@Autowired
|
||||
ShopProductService shopProductService;
|
||||
|
||||
|
||||
protected Logger logger = LoggerFactory.getLogger(BuyOrderServiceImpl.class);
|
||||
private MockConnection connection;
|
||||
|
||||
public BuyOrderServiceImpl() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) throws Exception {
|
||||
|
||||
IPage<BuyOrderEntity> page = null;
|
||||
IPage<BuyOrder> page;
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String startTime = null;
|
||||
String endTime = null;
|
||||
@@ -69,8 +66,8 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrderEntity
|
||||
}
|
||||
if (ObjectUtils.isEmpty(params.get("orderStatus"))) {
|
||||
page = this.page(
|
||||
new Query<BuyOrderEntity>().getPage(params),
|
||||
new ExcludeEmptyQueryWrapper<BuyOrderEntity>().eq("user_phone", params.get("key")).
|
||||
new Query<BuyOrder>().getPage(params),
|
||||
new ExcludeEmptyQueryWrapper<BuyOrder>().eq("user_phone", params.get("key")).
|
||||
or().like("order_sn", params.get("key")).or().like("shipping_user", params.get("key"))
|
||||
.apply(startTime != null, "date_format (create_time,'%Y-%m-%d') >= date_format ({0},'%Y-%m-%d')", startTime)
|
||||
.apply(endTime != null, "date_format (create_time,'%Y-%m-%d') <= date_format ({0},'%Y-%m-%d')", endTime).orderByDesc("create_time")
|
||||
@@ -78,8 +75,8 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrderEntity
|
||||
);
|
||||
} else {
|
||||
page = this.page(
|
||||
new Query<BuyOrderEntity>().getPage(params),
|
||||
new ExcludeEmptyQueryWrapper<BuyOrderEntity>().eq("order_status", params.get("orderStatus")).eq("user_phone", params.get("key"))
|
||||
new Query<BuyOrder>().getPage(params),
|
||||
new ExcludeEmptyQueryWrapper<BuyOrder>().eq("order_status", params.get("orderStatus")).eq("user_phone", params.get("key"))
|
||||
.or().like("order_sn", params.get("key")).or().like("shipping_user", params.get("key"))
|
||||
.apply(startTime != null, "date_format (create_time,'%Y-%m-%d') >= date_format ({0},'%Y-%m-%d')", startTime)
|
||||
.apply(endTime != null, "date_format (create_time,'%Y-%m-%d') <= date_format ({0},'%Y-%m-%d')", endTime).orderByDesc("create_time")
|
||||
@@ -87,13 +84,13 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrderEntity
|
||||
}
|
||||
|
||||
|
||||
List<BuyOrderEntity> records = page.getRecords();
|
||||
for (BuyOrderEntity record : records) {
|
||||
List<BuyOrder> records = page.getRecords();
|
||||
for (BuyOrder record : records) {
|
||||
Integer userId = record.getUserId();
|
||||
MyUserEntity myUserEntity = myUserService.getById(userId);
|
||||
if (!ObjectUtils.isEmpty(myUserEntity)) {
|
||||
record.setUserName(myUserEntity.getName());
|
||||
record.setProducts(buyOrderDetailService.list(new QueryWrapper<BuyOrderDetailEntity>()
|
||||
record.setProducts(buyOrderDetailService.list(new QueryWrapper<BuyOrderDetail>()
|
||||
.eq("order_id", record.getOrderId())));
|
||||
}
|
||||
|
||||
@@ -103,7 +100,6 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrderEntity
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage1(Map<String, Object> params) {
|
||||
|
||||
@@ -114,21 +110,21 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrderEntity
|
||||
|
||||
String userId = (String) params.get("userId");
|
||||
|
||||
IPage<BuyOrderEntity> page = this.page(
|
||||
new Query<BuyOrderEntity>().getPage(params),
|
||||
new QueryWrapper<BuyOrderEntity>()
|
||||
IPage<BuyOrder> page = this.page(
|
||||
new Query<BuyOrder>().getPage(params),
|
||||
new QueryWrapper<BuyOrder>()
|
||||
.eq("user_id", userId)
|
||||
.eq(StringUtils.isNotBlank(orderStatus), "order_status", orderStatus)
|
||||
.orderByDesc("create_time")
|
||||
);
|
||||
List<BuyOrderEntity> records = page.getRecords();
|
||||
for (BuyOrderEntity buyOrderEntity : records) {
|
||||
List<BuyOrder> records = page.getRecords();
|
||||
for (BuyOrder buyOrderEntity : records) {
|
||||
Integer orderId = buyOrderEntity.getOrderId();
|
||||
buyOrderEntity.setTimestamp(buyOrderEntity.getCreateTime().getTime()/1000);
|
||||
List<BuyOrderDetailEntity> entities = buyOrderDetailService.getBaseMapper().selectList(new QueryWrapper<BuyOrderDetailEntity>()
|
||||
buyOrderEntity.setTimestamp(buyOrderEntity.getCreateTime().getTime() / 1000);
|
||||
List<BuyOrderDetail> entities = buyOrderDetailService.getBaseMapper().selectList(new QueryWrapper<BuyOrderDetail>()
|
||||
.eq("order_id", orderId));
|
||||
if (entities != null) {
|
||||
for (BuyOrderDetailEntity entity : entities) {
|
||||
for (BuyOrderDetail entity : entities) {
|
||||
Integer productId = entity.getProductId();
|
||||
ShopProductEntity shopPro = shopProductService.getById(productId);
|
||||
if (shopPro != null) {
|
||||
@@ -157,7 +153,7 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrderEntity
|
||||
// 交易成功 2
|
||||
|
||||
// 交易失败 9
|
||||
BuyOrderEntity orderEntity = this.getOne(new QueryWrapper<BuyOrderEntity>().eq("user_id", userId)
|
||||
BuyOrder orderEntity = this.getOne(new QueryWrapper<BuyOrder>().eq("user_id", userId)
|
||||
.eq("order_sn", orderSn));
|
||||
if (type.equals("0")) {
|
||||
orderEntity.setOrderStatus("1");
|
||||
@@ -171,175 +167,6 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrderEntity
|
||||
updateById(orderEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Param shipperCode 快递公司编码
|
||||
* @Param sendType 0:订单列表发货 1:商品列表发货
|
||||
* @Param type 合并发货/拆分发货
|
||||
* @Param ids 订单or商品id串
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void sendFMS(Integer[] orderIds, String shipperCode, String shipperName) {
|
||||
|
||||
logger.info("##########################开始批量发货!时间:" + new Date());
|
||||
try {
|
||||
String timeId = IdWorker.getTimeId();
|
||||
List<FMSOrderEntity> fmsOrderList = new ArrayList<>();
|
||||
// 查询订单详情
|
||||
List<BuyOrderEntity> orderList = this.buyOrderDao.queryListByOrderIds(orderIds);
|
||||
Map<Integer, Object> userMap = new HashMap<>();
|
||||
// 清洗出有哪些用户
|
||||
for (BuyOrderEntity order : orderList) {
|
||||
order.setOrderCode(timeId + order.getUserId());
|
||||
userMap.put(order.getUserId(), order);
|
||||
}
|
||||
this.saveOrUpdateBatch(orderList);
|
||||
List<Integer> keys = userMap.keySet().stream().collect(Collectors.toList());
|
||||
List<BuyOrderDetailEntity> 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<FMSCommodity> 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<Integer, Object> objMap = new HashMap<>();
|
||||
List<BuyOrderEntity> list = this.list(new QueryWrapper<BuyOrderEntity>().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<Integer> orderIdList = objMap.keySet().stream().collect(Collectors.toList());
|
||||
Integer[] oIds = orderIdList.toArray(new Integer[orderIdList.size()]);
|
||||
List<BuyOrderDetailEntity> 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<String, Object> param = new HashMap<>();
|
||||
param.put("orderSn", orderSn);
|
||||
param.put("ShipperCode", shipperCode);
|
||||
param.put("ExpNo", expNo);
|
||||
try {
|
||||
KdApiEOrder.cancelOrderByJson(param);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 及时查询快递信息
|
||||
*
|
||||
* @param shipperCode 快递公司编码
|
||||
* @param expNo 快递单号
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public JSONObject queryFMS(String shipperCode, String expNo) {
|
||||
Map<String, Object> 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);
|
||||
if ("true".equals(jsonObject.getString("Success"))) {
|
||||
return jsonObject;
|
||||
}
|
||||
} else {
|
||||
String rntStr = KdApiEOrder.queryOrderOnlineByJson(param);
|
||||
JSONObject jsonObject = JSONObject.parseObject(rntStr);
|
||||
if ("true".equals(jsonObject.getString("Success"))) {
|
||||
return jsonObject;
|
||||
}
|
||||
}
|
||||
|
||||
String rntStr = KdApiEOrder.queryOrderOnlineByJson(param);
|
||||
JSONObject jsonObject = JSONObject.parseObject(rntStr);
|
||||
if ("true".equals(jsonObject.getString("Success"))) {
|
||||
return jsonObject;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询勾选的订单是否有可合并
|
||||
*
|
||||
@@ -351,18 +178,18 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrderEntity
|
||||
public List checkOrder(Integer[] orderIds) {
|
||||
|
||||
// 查询出所有的订单信息(携带订单商品)
|
||||
List<BuyOrderEntity> orderList = new ArrayList<>();
|
||||
List<BuyOrderEntity> buyOrderList = this.list(
|
||||
new QueryWrapper<BuyOrderEntity>().eq("del_flag", "0").eq("order_status", "1")
|
||||
List<BuyOrder> orderList = new ArrayList<>();
|
||||
List<BuyOrder> buyOrderList = this.list(
|
||||
new QueryWrapper<BuyOrder>().eq("del_flag", "0").eq("order_status", "1")
|
||||
);
|
||||
for (BuyOrderEntity order : buyOrderList) {
|
||||
order.setProducts(buyOrderDetailService.list(new QueryWrapper<BuyOrderDetailEntity>()
|
||||
for (BuyOrder order : buyOrderList) {
|
||||
order.setProducts(buyOrderDetailService.list(new QueryWrapper<BuyOrderDetail>()
|
||||
.eq("order_id", order.getOrderId())));
|
||||
orderList.add(order);
|
||||
}
|
||||
// 清洗数据 (与前端传来的id对比后)
|
||||
List<BuyOrderEntity> washOrderList = new ArrayList<>();
|
||||
for (BuyOrderEntity order : orderList) {
|
||||
List<BuyOrder> washOrderList = new ArrayList<>();
|
||||
for (BuyOrder order : orderList) {
|
||||
for (int o : orderIds) {
|
||||
if (o == order.getOrderId()) {
|
||||
washOrderList.add(order);
|
||||
@@ -372,7 +199,7 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrderEntity
|
||||
|
||||
Map<Integer, Object> map = new HashMap<>();
|
||||
// 使用清洗后的List获得其中有多少个用户
|
||||
for (BuyOrderEntity o : washOrderList) {
|
||||
for (BuyOrder o : washOrderList) {
|
||||
map.put(o.getUserId(), o);
|
||||
}
|
||||
//获取map的所有key转为list
|
||||
@@ -380,8 +207,8 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrderEntity
|
||||
List<UserOrderVo> userOrderVoList = new ArrayList<>();
|
||||
for (int key : keys) {
|
||||
UserOrderVo userOrderVo = new UserOrderVo();
|
||||
List<BuyOrderEntity> orderEntityList = new ArrayList<>();
|
||||
for (BuyOrderEntity o : buyOrderList) {
|
||||
List<BuyOrder> orderEntityList = new ArrayList<>();
|
||||
for (BuyOrder o : buyOrderList) {
|
||||
if (o.getUserId().equals(key)) {
|
||||
userOrderVo.setTel(o.getUserPhone());
|
||||
userOrderVo.setUserName(o.getShippingUser());
|
||||
@@ -416,24 +243,24 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrderEntity
|
||||
public Page checkOrder(Map<String, Object> params) {
|
||||
|
||||
// 查询所有订单信息
|
||||
List<BuyOrderEntity> orderList = new ArrayList<>();
|
||||
List<BuyOrder> orderList = new ArrayList<>();
|
||||
List<UserOrderVo> userOrderVoList = new ArrayList<>();
|
||||
// 返回的list
|
||||
List<UserOrderVo> rntList = new ArrayList<>();
|
||||
Page<UserOrderVo> rntPage = new Page<>();
|
||||
IPage<BuyOrderEntity> buyOrderList = this.page(
|
||||
new Query<BuyOrderEntity>().getPage(params),
|
||||
new QueryWrapper<BuyOrderEntity>().eq("del_flag", "0").eq("order_status", "1").eq("is_send", "0")
|
||||
IPage<BuyOrder> buyOrderList = this.page(
|
||||
new Query<BuyOrder>().getPage(params),
|
||||
new QueryWrapper<BuyOrder>().eq("del_flag", "0").eq("order_status", "1").eq("is_send", "0")
|
||||
);
|
||||
for (BuyOrderEntity order : buyOrderList.getRecords()) {
|
||||
order.setProducts(buyOrderDetailService.list(new QueryWrapper<BuyOrderDetailEntity>()
|
||||
for (BuyOrder order : buyOrderList.getRecords()) {
|
||||
order.setProducts(buyOrderDetailService.list(new QueryWrapper<BuyOrderDetail>()
|
||||
.eq("order_id", order.getOrderId())));
|
||||
orderList.add(order);
|
||||
}
|
||||
// 获取有订单的所有用户
|
||||
Map<Integer, Object> map = new HashMap<>();
|
||||
|
||||
for (BuyOrderEntity order : orderList) {
|
||||
for (BuyOrder order : orderList) {
|
||||
map.put(order.getUserId(), order);
|
||||
}
|
||||
//获取map的所有key转为list
|
||||
@@ -441,8 +268,8 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrderEntity
|
||||
|
||||
for (int key : keys) {
|
||||
UserOrderVo userOrderVo = new UserOrderVo();
|
||||
List<BuyOrderEntity> orderEntityList = new ArrayList<>();
|
||||
for (BuyOrderEntity o : buyOrderList.getRecords()) {
|
||||
List<BuyOrder> orderEntityList = new ArrayList<>();
|
||||
for (BuyOrder o : buyOrderList.getRecords()) {
|
||||
if (o.getUserId().equals(key)) {
|
||||
userOrderVo.setUserName(o.getShippingUser());
|
||||
userOrderVo.setTel(o.getUserPhone());
|
||||
@@ -464,391 +291,54 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrderEntity
|
||||
return rntPage;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 混合发货
|
||||
*
|
||||
* @param orderDetailIds
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void blendSendFMS(Integer[] orderDetailIds, String shipperCode, String shipperName) {
|
||||
logger.info("##########################开始混合发货!:" + new Date());
|
||||
try {
|
||||
// 生成订单号
|
||||
String timeId = IdWorker.getTimeId();
|
||||
List<FMSOrderDetailEntity> fmsList = new ArrayList<>();
|
||||
List<BuyOrderDetailEntity> washDetailList = new ArrayList<>();
|
||||
List<BuyOrderDetailEntity> detailList = this.buyOrderDetailService.list(new QueryWrapper<BuyOrderDetailEntity>());
|
||||
|
||||
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<FMSOrderEntity> fmsOrderList = new ArrayList<>();
|
||||
// 初始化快递商品信息
|
||||
List<FMSCommodity> 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<FMSOrderDetailEntity> fmsOrderDetailList = this.fmsOrderDetailService.list(new QueryWrapper<FMSOrderDetailEntity>().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<BuyOrderDetailEntity> list = this.buyOrderDetailService.list(new QueryWrapper<BuyOrderDetailEntity>().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<String, Object> map = new HashMap<>();
|
||||
buyOrderDetailService.querySheet(map);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
logger.info("##########################结束混合发货!时间:" + new Date());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
public void createSplitPackageOrder(String expressCompanyCode, List<Integer> buyOrderDetailId) {
|
||||
QueryWrapper<BuyOrderDetail> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in("id", buyOrderDetailId);
|
||||
List<BuyOrderDetail> buyOrderDetailList = buyOrderDetailService.list(queryWrapper);
|
||||
BigDecimal totalWeight = new BigDecimal(0);
|
||||
List<ExpressCommodity> commodityList = new ArrayList<>();
|
||||
for (BuyOrderDetail buyOrderDetail : buyOrderDetailList) {
|
||||
ExpressCommodity commodity = new ExpressCommodity();
|
||||
commodity.setGoodsName(buyOrderDetail.getProductName());
|
||||
commodity.setGoodsquantity(buyOrderDetail.getQuantity());
|
||||
commodity.setGoodsWeight(buyOrderDetail.getWeight().doubleValue());
|
||||
totalWeight = totalWeight.add(
|
||||
BigDecimal.valueOf(buyOrderDetail.getWeight().doubleValue()).multiply(new BigDecimal(buyOrderDetail.getQuantity()))
|
||||
);
|
||||
commodityList.add(commodity);
|
||||
}
|
||||
|
||||
// 获取用户地址
|
||||
Integer orderId = buyOrderDetailList.get(0).getOrderId();
|
||||
BuyOrder buyOrder = getById(orderId);
|
||||
QueryWrapper<County> countyQueryWrapper = new QueryWrapper<>();
|
||||
countyQueryWrapper.eq("county_name", buyOrder.getDistrict());
|
||||
County county = countyService.getOne(countyQueryWrapper);
|
||||
// 计算快递费用
|
||||
BigDecimal expressFee = expressFeeService.calculateExpressFee(expressCompanyCode, totalWeight, county.getRegionCode());
|
||||
ExpressOrder expressOrder = new ExpressOrder();
|
||||
expressOrder.setOrderId(buyOrderDetailList.get(0).getOrderId());
|
||||
expressOrder.setExpressFee(expressFee);
|
||||
expressOrder.setCreateTime(new Date());
|
||||
expressOrder.setTotalWeight(totalWeight);
|
||||
expressOrder.setCommodity(commodityList);
|
||||
expressOrder.setExpressCompanyCode(expressCompanyCode);
|
||||
expressOrder.setName(buyOrder.getShippingUser());
|
||||
expressOrder.setMobile(buyOrder.getUserPhone());
|
||||
expressOrder.setProvince(buyOrder.getProvince());
|
||||
expressOrder.setCity(buyOrder.getCity());
|
||||
expressOrder.setCounty(buyOrder.getDistrict());
|
||||
expressOrder.setAddress(buyOrder.getAddress());
|
||||
// 生成快递面单
|
||||
ExpressOrderResponseVo response = expressOrderService.placeExpressOrder(expressOrder);
|
||||
String expressBillNo = response.getOrder().getLogisticCode();
|
||||
String expressBillTemplate = response.getPrintTemplate();
|
||||
for (BuyOrderDetail buyOrderDetail : buyOrderDetailList) {
|
||||
buyOrderDetail.setExpressBillNo(expressBillNo);
|
||||
buyOrderDetail.setExpressBillTemplate(expressBillTemplate);
|
||||
buyOrderDetail.setExpressCompanyCode(expressCompanyCode);
|
||||
}
|
||||
buyOrderDetailService.saveBatch(buyOrderDetailList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据商品类型计算快递费
|
||||
*
|
||||
* @param param
|
||||
* @param productMap
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
public int getProductGoodsType(Map<String, Object> param, Map<String, Object> productMap) {
|
||||
// param : key商品Id,value商品数量
|
||||
// 定义不同种类的数组
|
||||
Map<String, Object> pictureMap = new HashMap<>();
|
||||
Map<String, Object> bookMap = new HashMap<>();
|
||||
List<ProductVo> advanceBookingList = new ArrayList<>();
|
||||
List<ProductVo> 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;
|
||||
}
|
||||
|
||||
|
||||
public static String getRandom(int len) {
|
||||
Random r = new Random();
|
||||
StringBuilder rs = new StringBuilder();
|
||||
for (int i = 0; i < len; i++) {
|
||||
rs.append(r.nextInt(10));
|
||||
}
|
||||
return rs.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public R randomOrderCode(BuyOrderEntity buyOrder) {
|
||||
SimpleDateFormat dmDate = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
String randata = getRandom(6);
|
||||
Date date = new Date();
|
||||
String dateran = dmDate.format(date);
|
||||
String Xsode = "XS" + dateran + randata;
|
||||
if (Xsode.length() < 24) {
|
||||
Xsode = Xsode + 0;
|
||||
}
|
||||
return R.ok(Xsode);
|
||||
}
|
||||
|
||||
/*
|
||||
打印时查重
|
||||
*/
|
||||
@Override
|
||||
public PageUtils querySheet(Map<String, Object> params) {
|
||||
IPage<BuyOrderEntity> page = this.page(
|
||||
new Query<BuyOrderEntity>().getPage(params),
|
||||
new QueryWrapper<BuyOrderEntity>().eq("is_print", "0")
|
||||
.groupBy("shipping_sn")
|
||||
);
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageUtils queryPages(Map<String, Object> params) {
|
||||
|
||||
String orderStatus = (String) params.get("orderStatus");
|
||||
if (orderStatus.equals("9")) {
|
||||
orderStatus = null;
|
||||
}
|
||||
|
||||
String userId = (String) params.get("userId");
|
||||
|
||||
IPage<BuyOrderEntity> page = this.page(
|
||||
new Query<BuyOrderEntity>().getPage(params),
|
||||
new QueryWrapper<BuyOrderEntity>()
|
||||
.eq("user_id", userId)
|
||||
.eq(StringUtils.isNotBlank(orderStatus), "order_status", orderStatus)
|
||||
.orderByDesc("create_time")
|
||||
);
|
||||
List<BuyOrderEntity> records = page.getRecords();
|
||||
for (BuyOrderEntity buyOrderEntity : records) {
|
||||
Integer orderId = buyOrderEntity.getOrderId();
|
||||
List<BuyOrderDetailEntity> entities = buyOrderDetailService.getBaseMapper().selectList(new QueryWrapper<BuyOrderDetailEntity>()
|
||||
.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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 计算仪器,预售快递费用
|
||||
*
|
||||
* @param productList
|
||||
* @return
|
||||
*/
|
||||
public int getTransPrice(List<ProductVo> productList) {
|
||||
|
||||
// 首重
|
||||
int amount = 0;
|
||||
// 续重
|
||||
int continuousWeight = 0;
|
||||
// 费用
|
||||
int fare = 0;
|
||||
for (ProductVo p : productList) {
|
||||
String prov = p.getArea().substring(0, p.getArea().indexOf("_"));
|
||||
float weight = p.getNum() * p.getWeight();
|
||||
// 韵达计费规则
|
||||
if ("YD".equals(p.getKdCode())) {
|
||||
// 如果ID等于71 说明是天津发天津
|
||||
if ("71".equals(prov)) {
|
||||
amount = 6;
|
||||
continuousWeight = 3;
|
||||
}
|
||||
// 首重十元 续重四元
|
||||
String tenStr[] = {"70", "73", "75", "76", "77", "79", "81", "82", "83", "84", "85", "86", "87", "88", "91", "92", "96", "80", "78"};
|
||||
boolean tenBoolean = Arrays.asList(tenStr).contains(prov);
|
||||
if (tenBoolean) {
|
||||
amount = 10;
|
||||
continuousWeight = 4;
|
||||
}
|
||||
// 首重十二元
|
||||
String twelveStr[] = {"74", "89", "90", "93", "94", "97", "98", "99"};
|
||||
boolean twelveBoolean = Arrays.asList(twelveStr).contains(prov);
|
||||
if (twelveBoolean) {
|
||||
amount = 12;
|
||||
continuousWeight = 5;
|
||||
// 甘肃 97,青海 98,内蒙古 74 ,海南90 续重 6元
|
||||
if (prov.equals("97") || prov.equals("98") || prov.equals("74") || prov.equals("90")) {
|
||||
continuousWeight = 6;
|
||||
}
|
||||
}
|
||||
// 首重二十元,续重二十元
|
||||
if ("100".equals(prov)) {
|
||||
amount = 20;
|
||||
continuousWeight = 20;
|
||||
}
|
||||
|
||||
if (weight <= 1000) {
|
||||
fare += amount;
|
||||
} else {
|
||||
fare += (int) (amount + (continuousWeight * Math.floor(weight / 1000)));
|
||||
}
|
||||
}
|
||||
}
|
||||
return fare;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 计算快递费用
|
||||
*
|
||||
* @param param
|
||||
*/
|
||||
public int getTransPrice(Map<String, Object> param) {
|
||||
|
||||
int fare = 0;
|
||||
String KDCode = param.get("kdCode").toString();
|
||||
String area = param.get("area").toString();
|
||||
String prov = area.substring(0, area.indexOf("_"));
|
||||
float weight = (float) param.get("weight");
|
||||
// 韵达计费规则
|
||||
if ("YD".equals(KDCode)) {
|
||||
// 如果ID等于71 说明是天津发天津
|
||||
int amount = 0;
|
||||
int continuousWeight = 0;
|
||||
if ("71".equals(prov)) {
|
||||
amount = 6;
|
||||
continuousWeight = 3;
|
||||
}
|
||||
// 首重十元 续重四元
|
||||
String tenStr[] = {"70", "73", "75", "76", "77", "79", "81", "82", "83", "84", "85", "86", "87", "88", "91", "92", "96", "80", "78"};
|
||||
boolean tenBoolean = Arrays.asList(tenStr).contains(prov);
|
||||
if (tenBoolean) {
|
||||
amount = 10;
|
||||
continuousWeight = 4;
|
||||
}
|
||||
// 首重十二元
|
||||
String twelveStr[] = {"74", "89", "90", "93", "94", "97", "98", "99"};
|
||||
boolean twelveBoolean = Arrays.asList(twelveStr).contains(prov);
|
||||
if (twelveBoolean) {
|
||||
amount = 12;
|
||||
continuousWeight = 5;
|
||||
// 甘肃 97,青海 98,内蒙古 74 ,海南90 续重 6元
|
||||
if (prov.equals("97") || prov.equals("98") || prov.equals("74") || prov.equals("90")) {
|
||||
continuousWeight = 6;
|
||||
}
|
||||
}
|
||||
// 首重二十元,续重二十元
|
||||
if ("100".equals(prov)) {
|
||||
amount = 20;
|
||||
continuousWeight = 20;
|
||||
}
|
||||
// 如果重量等于0 说明是包邮
|
||||
if (weight == 0) {
|
||||
return 0;
|
||||
} else if (weight <= 1000) {
|
||||
return amount;
|
||||
} else {
|
||||
return (int) (amount + (continuousWeight * Math.floor(weight / 1000)));
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.peanut.modules.book.service.impl;
|
||||
|
||||
import com.peanut.modules.book.entity.CityEntity;
|
||||
import com.peanut.modules.book.entity.City;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.Map;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -14,13 +14,13 @@ import com.peanut.modules.book.service.CityService;
|
||||
|
||||
|
||||
@Service("cityService")
|
||||
public class CityServiceImpl extends ServiceImpl<CityDao, CityEntity> implements CityService {
|
||||
public class CityServiceImpl extends ServiceImpl<CityDao, City> implements CityService {
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
IPage<CityEntity> page = this.page(
|
||||
new Query<CityEntity>().getPage(params),
|
||||
new QueryWrapper<CityEntity>()
|
||||
IPage<City> page = this.page(
|
||||
new Query<City>().getPage(params),
|
||||
new QueryWrapper<City>()
|
||||
);
|
||||
|
||||
return new PageUtils(page);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.peanut.modules.book.service.impl;
|
||||
|
||||
import com.peanut.modules.book.entity.CountyEntity;
|
||||
import com.peanut.modules.book.entity.County;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.Map;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -14,13 +14,13 @@ import com.peanut.modules.book.service.CountyService;
|
||||
|
||||
|
||||
@Service("countyService")
|
||||
public class CountyServiceImpl extends ServiceImpl<CountyDao, CountyEntity> implements CountyService {
|
||||
public class CountyServiceImpl extends ServiceImpl<CountyDao, County> implements CountyService {
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
IPage<CountyEntity> page = this.page(
|
||||
new Query<CountyEntity>().getPage(params),
|
||||
new QueryWrapper<CountyEntity>()
|
||||
IPage<County> page = this.page(
|
||||
new Query<County>().getPage(params),
|
||||
new QueryWrapper<County>()
|
||||
);
|
||||
|
||||
return new PageUtils(page);
|
||||
|
||||
@@ -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<ExpressCompanyDao, ExpressCompany> implements ExpressCompanyService {
|
||||
@Autowired
|
||||
ExpressCompanyDao expressCompanyDao;
|
||||
|
||||
@Override
|
||||
public List<ExpressCompanyVo> getExpressCompanyList() {
|
||||
return expressCompanyDao.getExpressCompanyList();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
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 org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Description: 快递费用服务接口实现类
|
||||
* @Author: Cauchy
|
||||
* @CreateTime: 2023/10/16
|
||||
*/
|
||||
@Service
|
||||
public class ExpressFeeServiceImpl extends ServiceImpl<ExpressFeeDao, ExpressFee> implements ExpressFeeService {
|
||||
@Override
|
||||
public BigDecimal calculateExpressFee(String expressCompanyCode, BigDecimal weight, String regionCode) {
|
||||
BigDecimal fee = null;
|
||||
switch (expressCompanyCode) {
|
||||
case "SF":
|
||||
fee = calculateSFExpressFee(weight, regionCode);
|
||||
break;
|
||||
case "YD":
|
||||
fee = calculateYDExpressFee(weight, regionCode);
|
||||
break;
|
||||
}
|
||||
return fee;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算顺丰快递运费
|
||||
*
|
||||
* @param weight 重量
|
||||
* @param regionCode 地区编码
|
||||
* @return 费用
|
||||
*/
|
||||
private BigDecimal calculateSFExpressFee(BigDecimal weight, String regionCode) {
|
||||
// 判断运费计算区间
|
||||
int weightInterval;
|
||||
BigDecimal additionalWeight;
|
||||
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<ExpressFee> queryWrapper = new QueryWrapper<>();
|
||||
if(!regionCode.startsWith("11") && !regionCode.startsWith("12") && !regionCode.startsWith("31") && !regionCode.startsWith("50")){
|
||||
regionCode = regionCode.substring(0, 4).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, 4).concat("00");
|
||||
QueryWrapper<ExpressFee> 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()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.peanut.modules.book.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.common.utils.HttpClientUtils;
|
||||
import com.peanut.common.utils.KdUtils;
|
||||
import com.peanut.config.Constants;
|
||||
import com.peanut.modules.book.dao.ExpressOrderDao;
|
||||
import com.peanut.modules.book.entity.ExpressOrder;
|
||||
import com.peanut.modules.book.entity.ExpressQueryResponse;
|
||||
import com.peanut.modules.book.service.ExpressOrderService;
|
||||
import com.peanut.modules.book.vo.*;
|
||||
import com.peanut.modules.book.vo.request.ExpressOrderRequestVo;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 快递订单 Service 实现
|
||||
* @Author: Cauchy
|
||||
* @CreateTime: 2023/10/16
|
||||
*/
|
||||
@Service
|
||||
public class ExpressOrderServiceImpl extends ServiceImpl<ExpressOrderDao, ExpressOrder> implements ExpressOrderService {
|
||||
|
||||
@Value("${express.sender.senderName}")
|
||||
private String senderName;
|
||||
@Value("${express.sender.mobile}")
|
||||
private String senderMobile;
|
||||
@Value("${express.sender.provinceName}")
|
||||
private String senderProvinceName;
|
||||
@Value("${express.sender.cityName}")
|
||||
private String senderCityName;
|
||||
@Value("${express.sender.expAreaName}")
|
||||
private String senderExpAreaName;
|
||||
@Value("${express.sender.address}")
|
||||
private String senderAddress;
|
||||
|
||||
|
||||
@Override
|
||||
public ExpressOrderResponseVo placeExpressOrder(ExpressOrder expressOrder) {
|
||||
ExpressOrderRequestVo orderRequestVo = new ExpressOrderRequestVo();
|
||||
// 订单号
|
||||
orderRequestVo.setOrderCode(expressOrder.getOrderId().toString());
|
||||
orderRequestVo.setIsReturnPrintTemplate(1);
|
||||
orderRequestVo.setShipperCode(expressOrder.getExpressCompanyCode());
|
||||
orderRequestVo.setPayType(3);
|
||||
if (expressOrder.getExpressCompanyCode().equals("SF")) {
|
||||
orderRequestVo.setMonthCode(Constants.EXPRESS_SF_MONTH_CODE);
|
||||
}
|
||||
|
||||
orderRequestVo.setExpType(1);
|
||||
orderRequestVo.setCost(expressOrder.getExpressFee().doubleValue());
|
||||
// 发货人
|
||||
ExpressUserInfoVo sender = new ExpressUserInfoVo();
|
||||
sender.setName(senderName);
|
||||
sender.setMobile(senderMobile);
|
||||
sender.setProvinceName(senderProvinceName);
|
||||
sender.setCityName(senderCityName);
|
||||
sender.setExpAreaName(senderExpAreaName);
|
||||
sender.setAddress(senderAddress);
|
||||
// 收货人
|
||||
ExpressUserInfoVo receiver = new ExpressUserInfoVo();
|
||||
receiver.setName(expressOrder.getName());
|
||||
receiver.setMobile(expressOrder.getMobile());
|
||||
receiver.setProvinceName(expressOrder.getProvince());
|
||||
receiver.setCityName(expressOrder.getCity());
|
||||
receiver.setAddress(expressOrder.getAddress());
|
||||
orderRequestVo.setSender(sender);
|
||||
orderRequestVo.setReceiver(receiver);
|
||||
orderRequestVo.setCommodity(expressOrder.getCommodity());
|
||||
orderRequestVo.setWeight(expressOrder.getTotalWeight().doubleValue());
|
||||
orderRequestVo.setRemark(expressOrder.getRemark());
|
||||
String requestData = JSONObject.toJSONString(orderRequestVo);
|
||||
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("RequestData", requestData);
|
||||
params.put("EBusinessID", Constants.EXPRESS_BUSINESS_ID);
|
||||
params.put("RequestType", Constants.EXPRESS_REQUEST_TYPE_PLACE_ORDER);
|
||||
try {
|
||||
String dataSign = KdUtils.encrypt(requestData, Constants.EXPRESS_API_KEY, "UTF-8");
|
||||
params.put("DataSign", KdUtils.urlEncoder(dataSign, "UTF-8"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
params.put("DataType", "2");
|
||||
String response = HttpClientUtils.kdSendPost(Constants.EXPRESS_PLACE_ORDER_URL, params);
|
||||
ExpressOrderResponseVo responseVo = JSONObject.parseObject(response, ExpressOrderResponseVo.class);
|
||||
return responseVo;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressQueryResponse queryExpressOrder(String shipperCode, String logisticCode) {
|
||||
ExpressQueryRequestVo requestVo = new ExpressQueryRequestVo();
|
||||
requestVo.setLogisticCode(logisticCode);
|
||||
requestVo.setShipperCode(shipperCode);
|
||||
String requestData = JSONObject.toJSONString(requestVo);
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("RequestData", requestData);
|
||||
params.put("EBusinessID", Constants.EXPRESS_BUSINESS_ID);
|
||||
params.put("RequestType", Constants.EXPRESS_REQUEST_TYPE_QUERY);
|
||||
try {
|
||||
String dataSign = KdUtils.encrypt(requestData, Constants.EXPRESS_API_KEY, "UTF-8");
|
||||
params.put("DataSign", KdUtils.urlEncoder(dataSign, "UTF-8"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
params.put("DateType", "2");
|
||||
String response = HttpClientUtils.kdSendPost(Constants.EXPRESS_QUERY_URL, params);
|
||||
return JSONObject.parseObject(response, ExpressQueryResponse.class);
|
||||
}
|
||||
}
|
||||
@@ -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<FMSOrderDetailDao, FMSOrderDetailEntity>
|
||||
implements FMSOrderDetailService {
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ 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.PayWechatOrderDao;
|
||||
import com.peanut.modules.book.entity.BuyOrderEntity;
|
||||
import com.peanut.modules.book.entity.BuyOrder;
|
||||
import com.peanut.modules.book.entity.PayWechatOrderEntity;
|
||||
import com.peanut.modules.book.service.BuyOrderService;
|
||||
import com.peanut.modules.book.service.PayWechatOrderService;
|
||||
@@ -35,9 +35,9 @@ public class PayWechatOrderServiceImpl extends ServiceImpl<PayWechatOrderDao, Pa
|
||||
|
||||
@Override
|
||||
public void add(String orderSn, String prepayId) {
|
||||
QueryWrapper<BuyOrderEntity> wrapper = new QueryWrapper<>();
|
||||
QueryWrapper<BuyOrder> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("order_sn", orderSn);
|
||||
BuyOrderEntity buyOrder = buyOrderService.getOne(wrapper);
|
||||
BuyOrder buyOrder = buyOrderService.getOne(wrapper);
|
||||
PayWechatOrderEntity entity = new PayWechatOrderEntity();
|
||||
entity.setCustomerId(buyOrder.getUserId());
|
||||
entity.setCreateTime(new Date());
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.peanut.modules.book.service.impl;
|
||||
|
||||
import com.peanut.modules.book.entity.CityEntity;
|
||||
import com.peanut.modules.book.entity.CountyEntity;
|
||||
import com.peanut.modules.book.entity.ProvinceEntity;
|
||||
import com.peanut.modules.book.entity.City;
|
||||
import com.peanut.modules.book.entity.County;
|
||||
import com.peanut.modules.book.entity.Province;
|
||||
import com.peanut.modules.book.service.CityService;
|
||||
import com.peanut.modules.book.service.CountyService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -21,7 +21,7 @@ import com.peanut.modules.book.service.ProvinceService;
|
||||
|
||||
|
||||
@Service("provinceService")
|
||||
public class ProvinceServiceImpl extends ServiceImpl<ProvinceDao, ProvinceEntity> implements ProvinceService {
|
||||
public class ProvinceServiceImpl extends ServiceImpl<ProvinceDao, Province> implements ProvinceService {
|
||||
|
||||
@Autowired
|
||||
private CityService cityService;
|
||||
@@ -30,26 +30,26 @@ public class ProvinceServiceImpl extends ServiceImpl<ProvinceDao, ProvinceEntity
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
IPage<ProvinceEntity> page = this.page(
|
||||
new Query<ProvinceEntity>().getPage(params),
|
||||
new QueryWrapper<ProvinceEntity>()
|
||||
IPage<Province> page = this.page(
|
||||
new Query<Province>().getPage(params),
|
||||
new QueryWrapper<Province>()
|
||||
);
|
||||
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProvinceEntity> getCity() {
|
||||
List<ProvinceEntity> provinceList = this.baseMapper.selectList(new QueryWrapper<ProvinceEntity>());
|
||||
for (ProvinceEntity province:provinceList){
|
||||
List<CityEntity> prov = cityService.getBaseMapper().selectList(new QueryWrapper<CityEntity>()
|
||||
public List<Province> getCity() {
|
||||
List<Province> provinceList = this.baseMapper.selectList(new QueryWrapper<Province>());
|
||||
for (Province province:provinceList){
|
||||
List<City> prov = cityService.getBaseMapper().selectList(new QueryWrapper<City>()
|
||||
.eq("prov_id", province.getProvId()));
|
||||
|
||||
if (prov.size() > 0) {
|
||||
for (CityEntity cityEntity : prov) {
|
||||
List<CountyEntity> countyList = countyService.getBaseMapper().selectList(new QueryWrapper<CountyEntity>().eq("city_id", cityEntity.getCityId()));
|
||||
for (City city : prov) {
|
||||
List<County> countyList = countyService.getBaseMapper().selectList(new QueryWrapper<County>().eq("city_id", city.getCityId()));
|
||||
if (countyList != null) {
|
||||
cityEntity.setCountyList(countyList);
|
||||
city.setCountyList(countyList);
|
||||
}
|
||||
}
|
||||
province.setCityList(prov);
|
||||
|
||||
@@ -1,7 +1,17 @@
|
||||
package com.peanut.modules.book.service.impl;
|
||||
|
||||
import com.peanut.modules.book.entity.City;
|
||||
import com.peanut.modules.book.entity.County;
|
||||
import com.peanut.modules.book.entity.Province;
|
||||
import com.peanut.modules.book.service.CityService;
|
||||
import com.peanut.modules.book.service.CountyService;
|
||||
import com.peanut.modules.book.service.ProvinceService;
|
||||
import com.peanut.modules.book.vo.UserAddressVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -9,21 +19,57 @@ 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<UserAddressDao, UserAddressEntity> implements UserAddressService {
|
||||
public class UserAddressServiceImpl extends ServiceImpl<UserAddressDao, UserAddress> implements UserAddressService {
|
||||
@Autowired
|
||||
private CountyService countyService;
|
||||
|
||||
@Autowired
|
||||
private CityService cityService;
|
||||
|
||||
@Autowired
|
||||
private ProvinceService provinceService;
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
IPage<UserAddressEntity> page = this.page(
|
||||
new Query<UserAddressEntity>().getPage(params),
|
||||
new QueryWrapper<UserAddressEntity>()
|
||||
IPage<UserAddress> page = this.page(
|
||||
new Query<UserAddress>().getPage(params),
|
||||
new QueryWrapper<>()
|
||||
);
|
||||
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
public UserAddressVo getAddressName(UserAddressVo vo, String regionCode) {
|
||||
QueryWrapper<County> countyQueryWrapper = new QueryWrapper<>();
|
||||
countyQueryWrapper.eq("region_code", regionCode);
|
||||
County county = countyService.getOne(countyQueryWrapper);
|
||||
vo.setCounty(county.getCountyName());
|
||||
String cityRegionCode;
|
||||
if (regionCode.startsWith("11") || regionCode.startsWith("12") || regionCode.startsWith("31") || regionCode.startsWith("50")) {
|
||||
cityRegionCode = regionCode.substring(0, 2).concat("0000");
|
||||
} else {
|
||||
cityRegionCode = regionCode.substring(0, 4).concat("00");
|
||||
}
|
||||
QueryWrapper<City> cityQueryWrapper = new QueryWrapper<>();
|
||||
cityQueryWrapper.eq("region_code", cityRegionCode);
|
||||
City city = cityService.getOne(cityQueryWrapper);
|
||||
vo.setCity(city.getCityName());
|
||||
String provinceRegionCode = regionCode.substring(0, 2).concat("0000");
|
||||
QueryWrapper<Province> provinceQueryWrapper = new QueryWrapper<>();
|
||||
provinceQueryWrapper.eq("region_code", provinceRegionCode);
|
||||
Province province = provinceService.getOne(provinceQueryWrapper);
|
||||
vo.setProvince(province.getProvName());
|
||||
return vo;
|
||||
}
|
||||
|
||||
public int getUserDefaultAddressCount(Integer userId) {
|
||||
QueryWrapper<UserAddress> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("user_id", userId);
|
||||
queryWrapper.eq("is_default", 1);
|
||||
return this.count(queryWrapper);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.peanut.modules.book.vo;
|
||||
|
||||
import com.peanut.modules.book.vo.response.ExpressResponseOrderVo;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description: 快递下单响应 Value Object
|
||||
* @Author: Cauchy
|
||||
* @CreateTime: 2023/10/17
|
||||
*/
|
||||
@Data
|
||||
public class ExpressOrderResponseVo {
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private String EBusinessID;
|
||||
/**
|
||||
* 返回模板
|
||||
*/
|
||||
private String PrintTemplate;
|
||||
/**
|
||||
* 是否成功
|
||||
*/
|
||||
private boolean Success;
|
||||
/**
|
||||
* 结果响应编码
|
||||
*/
|
||||
private String ResultCode;
|
||||
/**
|
||||
* 原因
|
||||
*/
|
||||
private String Reason;
|
||||
/**
|
||||
* 订单
|
||||
*/
|
||||
private ExpressResponseOrderVo Order;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.peanut.modules.book.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description: 快递查询请求 Value Object
|
||||
* @Author: Cauchy
|
||||
* @CreateTime: 2023/10/17
|
||||
*/
|
||||
@Data
|
||||
public class ExpressQueryRequestVo {
|
||||
/**
|
||||
* 快递编码
|
||||
*/
|
||||
private String ShipperCode;
|
||||
/**
|
||||
* 快递单号
|
||||
*/
|
||||
private String LogisticCode;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user