diff --git a/framework/pom.xml b/framework/pom.xml
index 9f127491..3003fb45 100644
--- a/framework/pom.xml
+++ b/framework/pom.xml
@@ -457,6 +457,13 @@
sdk
${kuaidi100-api.version}
+
+ com.qiyuesuo.sdk
+ SDK
+ 2.1.7
+ system
+ ${project.basedir}/src/main/resources/maven-repository/SF-CSIM-EXPRESS-SDK-V2.1.7.jar
+
diff --git a/framework/src/main/java/cn/lili/common/enums/ResultCode.java b/framework/src/main/java/cn/lili/common/enums/ResultCode.java
index 40b2df22..13de72db 100644
--- a/framework/src/main/java/cn/lili/common/enums/ResultCode.java
+++ b/framework/src/main/java/cn/lili/common/enums/ResultCode.java
@@ -414,8 +414,10 @@ public enum ResultCode {
STORE_NOT_OPEN(50004, "该会员未开通店铺"),
STORE_NOT_LOGIN_ERROR(50005, "未登录店铺"),
STORE_CLOSE_ERROR(50006, "店铺关闭,请联系管理员"),
+ STORE_DELIVER_GOODS_ADDRESS(50007,"请填写商家发货地址"),
FREIGHT_TEMPLATE_NOT_EXIST(50010, "当前模版不存在"),
STORE_STATUS_ERROR(50011, "店铺状态异常,无法申请"),
+ STORE_DELIVER_ADDRESS_EXIST(50012,"请填写发货地址"),
/**
* 结算单
@@ -492,6 +494,12 @@ public enum ResultCode {
WECHAT_ERROR(80307, "微信接口异常"),
APP_VERSION_EXIST(80307, "APP版本已存在"),
+ /**
+ * IM
+ */
+ IM_MESSAGE_ADD_ERROR(80400,"IM消息发送错误"),
+ IM_MESSAGE_EDIT_ERROR(80400,"IM消息更新错误"),
+
/**
* 其他
*/
diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java
index 29f50414..e56898cb 100644
--- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java
+++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java
@@ -427,6 +427,7 @@ public class GoodsServiceImpl extends ServiceImpl implements
LambdaUpdateWrapper lambdaUpdateWrapper = Wrappers.lambdaUpdate();
lambdaUpdateWrapper.set(Goods::getTemplateId, templateId);
lambdaUpdateWrapper.in(Goods::getId, goodsIds);
+ cache.multiDel(goodsIds);
return this.update(lambdaUpdateWrapper);
}
diff --git a/framework/src/main/java/cn/lili/modules/im/entity/dos/ImTalk.java b/framework/src/main/java/cn/lili/modules/im/entity/dos/ImTalk.java
index 56ffe258..7452756a 100644
--- a/framework/src/main/java/cn/lili/modules/im/entity/dos/ImTalk.java
+++ b/framework/src/main/java/cn/lili/modules/im/entity/dos/ImTalk.java
@@ -2,6 +2,8 @@ package cn.lili.modules.im.entity.dos;
import cn.lili.common.utils.SnowFlake;
+import cn.lili.modules.member.entity.dos.Member;
+import cn.lili.modules.store.entity.dos.Store;
import cn.lili.mybatis.BaseTenantEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
@@ -99,4 +101,71 @@ public class ImTalk extends BaseTenantEntity {
this.name1 = name1;
this.name2 = name2;
}
+
+ public ImTalk(Member member1,Member member2){
+ if(Long.parseLong(member1.getId()) > Long.parseLong(member2.getId())){
+ this.userId1 = member2.getId();
+ this.userId2 = member1.getId();
+ this.top1 = false;
+ this.top2 = false;
+ this.disable1 = false;
+ this.disable2 = false;
+ this.storeFlag1 = false;
+ this.storeFlag2 = false;
+ this.setId(SnowFlake.getIdStr());
+ this.lastTalkTime = new Date();
+ this.face1 = member2.getFace();
+ this.face2 = member1.getFace();
+ this.name1 = member2.getNickName();
+ this.name2 = member1.getNickName();
+ }else{
+ this.userId1 = member1.getId();
+ this.userId2 = member2.getId();
+ this.top1 = false;
+ this.top2 = false;
+ this.disable1 = false;
+ this.disable2 = false;
+ this.storeFlag1 = false;
+ this.storeFlag2 = false;
+ this.setId(SnowFlake.getIdStr());
+ this.lastTalkTime = new Date();
+ this.face1 = member1.getFace();
+ this.face2 = member2.getFace();
+ this.name1 = member1.getNickName();
+ this.name2 = member2.getNickName();
+ }
+ }
+ public ImTalk(Member member, Store store){
+ if(Long.parseLong(member.getId()) > Long.parseLong(store.getId())){
+ this.userId1 = store.getId();
+ this.userId2 = member.getId();
+ this.top1 = false;
+ this.top2 = false;
+ this.disable1 = false;
+ this.disable2 = false;
+ this.storeFlag1 = true;
+ this.storeFlag2 = false;
+ this.setId(SnowFlake.getIdStr());
+ this.lastTalkTime = new Date();
+ this.face1 = store.getStoreLogo();
+ this.face2 = member.getFace();
+ this.name1 = store.getStoreName();
+ this.name2 = member.getNickName();
+ }else{
+ this.userId1 = member.getId();
+ this.userId2 = store.getId();
+ this.top1 = false;
+ this.top2 = false;
+ this.disable1 = false;
+ this.disable2 = false;
+ this.storeFlag1 = false;
+ this.storeFlag2 = true;
+ this.setId(SnowFlake.getIdStr());
+ this.lastTalkTime = new Date();
+ this.face1 = member.getFace();
+ this.face2 = store.getStoreLogo();
+ this.name1 = member.getNickName();
+ this.name2 = store.getStoreName();
+ }
+ }
}
\ No newline at end of file
diff --git a/framework/src/main/java/cn/lili/modules/im/service/ImMessageService.java b/framework/src/main/java/cn/lili/modules/im/service/ImMessageService.java
index 57fee7cc..823369c0 100644
--- a/framework/src/main/java/cn/lili/modules/im/service/ImMessageService.java
+++ b/framework/src/main/java/cn/lili/modules/im/service/ImMessageService.java
@@ -16,29 +16,32 @@ public interface ImMessageService extends IService {
/**
* 阅读消息
*
- * @param talkId
- * @param accessToken
+ * @param talkId 对话Id
+ * @param accessToken 验证token
*/
void read(String talkId, String accessToken);
/**
* 未读消息列表
*
- * @param accessToken
+ * @param accessToken 验证token
+ * @return 未读消息列表
*/
List unReadMessages(String accessToken);
/**
* 历史消息
*
- * @param accessToken
- * @param to
+ * @param accessToken 验证token
+ * @param to 接收人
+ *
+ * @return 历史消息列表
*/
List historyMessage(String accessToken, String to);
/**
* 是否有新消息
- * @param accessToken
+ * @param accessToken 验证token
* @return
*/
Boolean hasNewMessage(String accessToken);
@@ -52,7 +55,7 @@ public interface ImMessageService extends IService {
/**
* 获取所有未读消息
- * @return
+ * @return 未读数量
*/
Long unreadMessageCount();
diff --git a/framework/src/main/java/cn/lili/modules/im/service/ImTalkService.java b/framework/src/main/java/cn/lili/modules/im/service/ImTalkService.java
index 427750fd..3b6f92ea 100644
--- a/framework/src/main/java/cn/lili/modules/im/service/ImTalkService.java
+++ b/framework/src/main/java/cn/lili/modules/im/service/ImTalkService.java
@@ -17,10 +17,9 @@ public interface ImTalkService extends IService {
* 获取与某人的聊天框
*
* @param userId1
- * @param userId2
* @return
*/
- ImTalk getTalkByUser(String userId1, String userId2);
+ ImTalk getTalkByUser(String userId1);
/**
* 置顶消息
@@ -41,7 +40,7 @@ public interface ImTalkService extends IService {
* 获取用户聊天列表
* @return
*/
- List getUserTalkList(String userName);
+ List getUserTalkList();
/**
* 获取商家聊天列表
diff --git a/framework/src/main/java/cn/lili/modules/im/serviceimpl/ImMessageServiceImpl.java b/framework/src/main/java/cn/lili/modules/im/serviceimpl/ImMessageServiceImpl.java
index c216c282..6e75529d 100644
--- a/framework/src/main/java/cn/lili/modules/im/serviceimpl/ImMessageServiceImpl.java
+++ b/framework/src/main/java/cn/lili/modules/im/serviceimpl/ImMessageServiceImpl.java
@@ -4,6 +4,7 @@ import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.security.AuthUser;
import cn.lili.common.security.context.UserContext;
+import cn.lili.common.security.enums.UserEnums;
import cn.lili.modules.im.entity.dos.ImMessage;
import cn.lili.modules.im.entity.dto.MessageQueryParams;
import cn.lili.modules.im.mapper.ImMessageMapper;
@@ -18,9 +19,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
+import java.util.Objects;
/**
* Im消息 业务实现
@@ -130,9 +131,18 @@ public class ImMessageServiceImpl extends ServiceImpl messageList) {
- if (messageList.size() > 0) {
+ if (!messageList.isEmpty()) {
+ //判断用户类型
+ AuthUser authUser = Objects.requireNonNull(UserContext.getCurrentUser());
+ String toUserId = "";
+ if(UserEnums.MEMBER.equals(authUser.getRole())){
+ toUserId = authUser.getId();
+ }else if(UserEnums.STORE.equals(authUser.getRole())){
+ toUserId = authUser.getStoreId();
+ }
+ //发送给自己的未读信息进行已读操作
for (ImMessage imMessage : messageList) {
- if(Boolean.FALSE.equals(imMessage.getIsRead())){
+ if(Boolean.FALSE.equals(imMessage.getIsRead()) && imMessage.getToUser().equals(toUserId)){
imMessage.setIsRead(true);
}
}
diff --git a/framework/src/main/java/cn/lili/modules/im/serviceimpl/ImTalkServiceImpl.java b/framework/src/main/java/cn/lili/modules/im/serviceimpl/ImTalkServiceImpl.java
index 2b24c8bb..bb59c584 100644
--- a/framework/src/main/java/cn/lili/modules/im/serviceimpl/ImTalkServiceImpl.java
+++ b/framework/src/main/java/cn/lili/modules/im/serviceimpl/ImTalkServiceImpl.java
@@ -21,9 +21,9 @@ import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import org.stringtemplate.v4.ST;
import java.util.List;
+import java.util.Objects;
import java.util.stream.Collectors;
/**
@@ -45,47 +45,44 @@ public class ImTalkServiceImpl extends ServiceImpl impleme
@Autowired
private ImMessageService imMessageService;
- @Override
- public ImTalk getTalkByUser(String userId1, String userId2) {
+ public ImTalk getTalkByUser(String userId) {
LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(ImTalk::getUserId2, userId2);
- queryWrapper.eq(ImTalk::getUserId1, userId1);
+ AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
+ //登录用户的Id
+ String selfId = "";
+ //查看当前用户角色对Id进行赋值
+ if(UserEnums.STORE.equals(currentUser.getRole())){
+ selfId = currentUser.getStoreId();
+ }else if(UserEnums.MEMBER.equals(currentUser.getRole())){
+ selfId = currentUser.getId();
+ }
+ //小数在前保证永远是同一个对话
+ String finalSelfId = selfId;
+ queryWrapper.and(wq-> wq.eq(ImTalk::getUserId2, userId).eq(ImTalk::getUserId1, finalSelfId).or().eq(ImTalk::getUserId2, finalSelfId).eq(ImTalk::getUserId1, userId));
ImTalk imTalk = this.getOne(queryWrapper);
- AuthUser currentUser = UserContext.getCurrentUser();
//如果没有聊天,则创建聊天
if (imTalk == null) {
- // 没有登录的这个账户信息
- if (currentUser == null) {
- return null;
- }
//当自己为店铺时
if(UserEnums.STORE.equals(currentUser.getRole())){
- Store selfStore = storeService.getById(userId1);
+ Store selfStore = storeService.getById(selfId);
//没有这个用户信息
- Member other = memberService.getById(userId2);
+ Member other = memberService.getById(userId);
if(other == null){
return null;
}
//自己为店铺其他人必定为用户
- imTalk = new ImTalk(userId1, userId2, selfStore.getStoreLogo(), other.getFace(), selfStore.getStoreName(), other.getNickName());
- imTalk.setStoreFlag1(true);
+ imTalk = new ImTalk(other,selfStore);
}else if(UserEnums.MEMBER.equals(currentUser.getRole())){
//没有这个店铺信息
- Member self = memberService.getById(userId1);
- Member otherMember = memberService.getById(userId2);
- Store otherStore = storeService.getById(userId2);
- if(otherStore != null){
- imTalk = new ImTalk(userId1, userId2, self.getFace(), otherStore.getStoreLogo(), self.getNickName(), otherStore.getStoreName());
- imTalk.setStoreFlag2(true);
- }else if (otherMember != null){
- imTalk = new ImTalk(userId1, userId2, self.getFace(), otherMember.getFace(), self.getNickName(), otherMember.getNickName());
- }else{
- return null;
- }
+ Member self = memberService.getById(selfId);
+ Member otherMember = memberService.getById(userId);
+ Store otherStore = storeService.getById(userId);
+ if(otherStore != null){
+ imTalk = new ImTalk(self, otherStore);
+ }else if (otherMember != null){
+ imTalk = new ImTalk(self, otherMember);
+ }
}
- this.save(imTalk);
- } else {
- imTalk = check(imTalk);
}
return imTalk;
}
@@ -93,7 +90,7 @@ public class ImTalkServiceImpl extends ServiceImpl impleme
/**
* 发起聊天后,如果聊天不可见为true,则需要修正
*
- * @param imTalk
+ * @param imTalk 对话信息
*/
private ImTalk check(ImTalk imTalk) {
if (imTalk.getDisable1() || imTalk.getDisable2()) {
@@ -131,23 +128,16 @@ public class ImTalkServiceImpl extends ServiceImpl impleme
}
@Override
- public List getUserTalkList(String userName) {
+ public List getUserTalkList() {
AuthUser authUser = UserContext.getCurrentUser();
if(authUser == null){
throw new ServiceException(ResultCode.USER_NOT_LOGIN);
}
LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.and(wq->{
- wq.like(ImTalk::getName1, userName).or().like(ImTalk::getName2,userName);
- });
- queryWrapper.and(wq->{
- wq.like(ImTalk::getUserId1, authUser.getId()).or().like(ImTalk::getUserId2,authUser.getId());
- });
+ queryWrapper.and(wq-> wq.eq(ImTalk::getUserId1, authUser.getId()).or().eq(ImTalk::getUserId2,authUser.getId()));
queryWrapper.orderByDesc(ImTalk::getLastTalkTime);
List imTalks = this.list(queryWrapper);
- List imTalkVOList = imTalks.stream().map(imTalk -> {
- return new ImTalkVO(imTalk, authUser.getId());
- }).collect(Collectors.toList());
+ List imTalkVOList = imTalks.stream().map(imTalk -> new ImTalkVO(imTalk, authUser.getId())).collect(Collectors.toList());
getUnread(imTalkVOList);
return imTalkVOList;
}
@@ -160,7 +150,7 @@ public class ImTalkServiceImpl extends ServiceImpl impleme
}
LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.and(wq->{
- wq.like(ImTalk::getUserId1, authUser.getStoreId()).or().like(ImTalk::getUserId2,authUser.getStoreId());
+ wq.eq(ImTalk::getUserId1, authUser.getStoreId()).or().eq(ImTalk::getUserId2,authUser.getStoreId());
});
queryWrapper.orderByDesc(ImTalk::getLastTalkTime);
List imTalks = this.list(queryWrapper);
@@ -174,12 +164,12 @@ public class ImTalkServiceImpl extends ServiceImpl impleme
/**
* 获取未读消息数量
- * @param imTalkVOList
+ * @param imTalkVOList 消息列表
*/
private void getUnread(List imTalkVOList){
- if(imTalkVOList.size() > 0){
+ if(!imTalkVOList.isEmpty()){
for (ImTalkVO imTalkVO : imTalkVOList) {
- long count = imMessageService.count(new LambdaQueryWrapper().eq(ImMessage::getFromUser, imTalkVO.getUserId()).eq(ImMessage::getIsRead, false));
+ long count = imMessageService.count(new LambdaQueryWrapper().eq(ImMessage::getFromUser, imTalkVO.getUserId()).eq(ImMessage::getTalkId,imTalkVO.getId()).eq(ImMessage::getIsRead, false));
imTalkVO.setUnread(count);
}
}
diff --git a/framework/src/main/java/cn/lili/modules/logistics/LogisticsPlugin.java b/framework/src/main/java/cn/lili/modules/logistics/LogisticsPlugin.java
index d77bc8f9..5a0ab4e7 100644
--- a/framework/src/main/java/cn/lili/modules/logistics/LogisticsPlugin.java
+++ b/framework/src/main/java/cn/lili/modules/logistics/LogisticsPlugin.java
@@ -2,9 +2,12 @@ package cn.lili.modules.logistics;
import cn.lili.modules.logistics.entity.dto.LabelOrderDTO;
import cn.lili.modules.logistics.entity.enums.LogisticsEnum;
+import cn.lili.modules.order.order.entity.vo.OrderDetailVO;
import cn.lili.modules.system.entity.dos.Logistics;
import cn.lili.modules.system.entity.vo.Traces;
+import java.util.Map;
+
/**
* 物流插件接口
*
@@ -48,6 +51,8 @@ public interface LogisticsPlugin {
* @param labelOrderDTO 电子面单DTO
* @return
*/
- String labelOrder(LabelOrderDTO labelOrderDTO);
+ Map labelOrder(LabelOrderDTO labelOrderDTO);
+
+ String createOrder(OrderDetailVO orderDetailVO);
}
diff --git a/framework/src/main/java/cn/lili/modules/logistics/LogisticsPluginFactory.java b/framework/src/main/java/cn/lili/modules/logistics/LogisticsPluginFactory.java
index b40c4ebb..4ecc4bfe 100644
--- a/framework/src/main/java/cn/lili/modules/logistics/LogisticsPluginFactory.java
+++ b/framework/src/main/java/cn/lili/modules/logistics/LogisticsPluginFactory.java
@@ -5,6 +5,7 @@ import cn.lili.common.exception.ServiceException;
import cn.lili.modules.logistics.entity.enums.LogisticsEnum;
import cn.lili.modules.logistics.plugin.kdniao.KdniaoPlugin;
import cn.lili.modules.logistics.plugin.kuaidi100.Kuaidi100Plugin;
+import cn.lili.modules.logistics.plugin.shunfeng.ShunfengPlugin;
import cn.lili.modules.system.entity.dos.Setting;
import cn.lili.modules.system.entity.dto.LogisticsSetting;
import cn.lili.modules.system.entity.enums.SettingEnum;
@@ -44,6 +45,8 @@ public class LogisticsPluginFactory {
return new KdniaoPlugin(logisticsSetting);
case KUAIDI100:
return new Kuaidi100Plugin(logisticsSetting);
+ case SHUNFENG:
+ return new ShunfengPlugin(logisticsSetting);
default:
throw new ServiceException();
}
diff --git a/framework/src/main/java/cn/lili/modules/logistics/entity/enums/LogisticsEnum.java b/framework/src/main/java/cn/lili/modules/logistics/entity/enums/LogisticsEnum.java
index 2783c27e..20c9bba8 100644
--- a/framework/src/main/java/cn/lili/modules/logistics/entity/enums/LogisticsEnum.java
+++ b/framework/src/main/java/cn/lili/modules/logistics/entity/enums/LogisticsEnum.java
@@ -11,5 +11,5 @@ public enum LogisticsEnum {
/**
* 快递查询渠道
*/
- KDNIAO, KUAIDI100;
+ KDNIAO, KUAIDI100,SHUNFENG;
}
diff --git a/framework/src/main/java/cn/lili/modules/logistics/plugin/kdniao/KdniaoPlugin.java b/framework/src/main/java/cn/lili/modules/logistics/plugin/kdniao/KdniaoPlugin.java
index a2f13e75..4b567388 100644
--- a/framework/src/main/java/cn/lili/modules/logistics/plugin/kdniao/KdniaoPlugin.java
+++ b/framework/src/main/java/cn/lili/modules/logistics/plugin/kdniao/KdniaoPlugin.java
@@ -8,6 +8,7 @@ import cn.lili.modules.logistics.entity.dto.LabelOrderDTO;
import cn.lili.modules.logistics.entity.enums.LogisticsEnum;
import cn.lili.modules.order.order.entity.dos.Order;
import cn.lili.modules.order.order.entity.dos.OrderItem;
+import cn.lili.modules.order.order.entity.vo.OrderDetailVO;
import cn.lili.modules.store.entity.dos.StoreLogistics;
import cn.lili.modules.store.entity.dto.StoreDeliverGoodsAddressDTO;
import cn.lili.modules.system.entity.dos.Logistics;
@@ -111,8 +112,9 @@ public class KdniaoPlugin implements LogisticsPlugin {
}
@Override
- public String labelOrder(LabelOrderDTO labelOrderDTO) {
+ public Map labelOrder(LabelOrderDTO labelOrderDTO) {
try {
+ Map resultMap = new HashMap();
//订单
Order order = labelOrderDTO.getOrder();
//订单货物
@@ -198,18 +200,24 @@ public class KdniaoPlugin implements LogisticsPlugin {
JSONObject obj = JSONObject.parseObject(result);
log.info("电子面单响应:{}", result);
if (!"100".equals(obj.getString("ResultCode"))) {
- return obj.getString("Reason");
+ resultMap.put("Reason",obj.getString("Reason"));
+ return resultMap;
}
JSONObject orderJson = JSONObject.parseObject(obj.getString("Order"));
-
- return obj.getString("PrintTemplate");
+ resultMap.put("printTemplate",obj.getString("PrintTemplate"));
+ return resultMap;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
+ @Override
+ public String createOrder(OrderDetailVO orderDetailVO) {
+ return null;
+ }
+
/**
* MD5加密
diff --git a/framework/src/main/java/cn/lili/modules/logistics/plugin/kuaidi100/Kuaidi100Plugin.java b/framework/src/main/java/cn/lili/modules/logistics/plugin/kuaidi100/Kuaidi100Plugin.java
index 62e8b633..b66980f8 100644
--- a/framework/src/main/java/cn/lili/modules/logistics/plugin/kuaidi100/Kuaidi100Plugin.java
+++ b/framework/src/main/java/cn/lili/modules/logistics/plugin/kuaidi100/Kuaidi100Plugin.java
@@ -6,6 +6,7 @@ import cn.lili.modules.logistics.entity.enums.LogisticsEnum;
import cn.lili.modules.logistics.plugin.kuaidi100.utils.Kuaidi100SignUtils;
import cn.lili.modules.order.order.entity.dos.Order;
import cn.lili.modules.order.order.entity.dos.OrderItem;
+import cn.lili.modules.order.order.entity.vo.OrderDetailVO;
import cn.lili.modules.store.entity.dos.StoreLogistics;
import cn.lili.modules.store.entity.dto.StoreDeliverGoodsAddressDTO;
import cn.lili.modules.system.entity.dos.Logistics;
@@ -121,7 +122,7 @@ public class Kuaidi100Plugin implements LogisticsPlugin {
}
@Override
- public String labelOrder(LabelOrderDTO labelOrderDTO) {
+ public Map labelOrder(LabelOrderDTO labelOrderDTO) {
try {
//订单
Order order = labelOrderDTO.getOrder();
@@ -181,4 +182,10 @@ public class Kuaidi100Plugin implements LogisticsPlugin {
return null;
}
+ @Override
+ public String createOrder(OrderDetailVO orderDetailVO) {
+ return null;
+ }
+
+
}
diff --git a/framework/src/main/java/cn/lili/modules/logistics/plugin/shunfeng/ShunfengPlugin.java b/framework/src/main/java/cn/lili/modules/logistics/plugin/shunfeng/ShunfengPlugin.java
new file mode 100644
index 00000000..f813baad
--- /dev/null
+++ b/framework/src/main/java/cn/lili/modules/logistics/plugin/shunfeng/ShunfengPlugin.java
@@ -0,0 +1,242 @@
+package cn.lili.modules.logistics.plugin.shunfeng;
+
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONObject;
+import cn.hutool.json.JSONUtil;
+import cn.lili.common.enums.ResultCode;
+import cn.lili.common.exception.ServiceException;
+import cn.lili.common.utils.SpringContextUtil;
+import cn.lili.modules.logistics.LogisticsPlugin;
+import cn.lili.modules.logistics.entity.dto.LabelOrderDTO;
+import cn.lili.modules.logistics.entity.enums.LogisticsEnum;
+import cn.lili.modules.order.order.entity.dos.Order;
+import cn.lili.modules.order.order.entity.dos.OrderItem;
+import cn.lili.modules.order.order.entity.vo.OrderDetailVO;
+import cn.lili.modules.store.entity.dto.StoreDeliverGoodsAddressDTO;
+import cn.lili.modules.store.service.StoreDetailService;
+import cn.lili.modules.system.entity.dos.Logistics;
+import cn.lili.modules.system.entity.dto.LogisticsSetting;
+import cn.lili.modules.system.entity.vo.Traces;
+import com.sf.csim.express.service.CallExpressServiceTools;
+import com.sf.csim.express.service.HttpClientUtil;
+import com.sf.csim.express.service.IServiceCodeStandard;
+import com.sf.csim.express.service.code.ExpressServiceCodeEnum;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import java.io.UnsupportedEncodingException;
+import java.util.*;
+
+/**
+ * 顺丰插件
+ * @author admin
+ */
+@Slf4j
+public class ShunfengPlugin implements LogisticsPlugin {
+
+ /**
+ * ExpressServiceCodeEnum 对应速运类-快递APIs
+ * POSTServiceCodeEnum 对应速运类-驿站APIs
+ * YJTServiceCodeEnum 对应解决方案-医寄通APIs
+ * EPSServiceCodeEnum 对应解决方案-快递管家APIs
+ * 详情见code目录下枚举类,客户可自行修改引用的该类
+ **/
+ private LogisticsSetting logisticsSetting;
+
+ public ShunfengPlugin(){}
+
+ public ShunfengPlugin(LogisticsSetting logisticsSetting) {
+ this.logisticsSetting = logisticsSetting;
+ }
+
+ @Override
+ public LogisticsEnum pluginName() {
+ return LogisticsEnum.SHUNFENG;
+ }
+
+ /**
+ * 文档地址:https://open.sf-express.com/Api/ApiDetails?level3=393&interName=%E4%B8%8B%E8%AE%A2%E5%8D%95%E6%8E%A5%E5%8F%A3-EXP_RECE_CREATE_ORDER
+ *
+ * @param orderDetailVO
+ */
+ public String createOrder(OrderDetailVO orderDetailVO) {
+ StoreDetailService storeService = SpringContextUtil.getBean(StoreDetailService.class);
+ StoreDeliverGoodsAddressDTO storeDeliverGoodsAddressDTO = storeService.getStoreDeliverGoodsAddressDto(orderDetailVO.getOrder().getStoreId());
+ if(storeDeliverGoodsAddressDTO == null){
+ throw new ServiceException(ResultCode.STORE_DELIVER_ADDRESS_EXIST);
+ }
+ try {
+ Order order = orderDetailVO.getOrder();
+ Map msgDataMap = new HashMap();
+ msgDataMap.put("language", "zh-CN");
+ msgDataMap.put("orderId", order.getSn());
+ //托寄物信息
+ List