|
|
@@ -1,20 +1,33 @@
|
|
|
package com.fs.app.controller;
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.fs.app.socket.QwImSocket;
|
|
|
import com.fs.app.util.AudioUtils;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.core.redis.RedisCache;
|
|
|
+import com.fs.common.utils.CloudHostUtils;
|
|
|
import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.common.utils.uuid.IdUtils;
|
|
|
+import com.fs.erp.domain.ErpDeliverys;
|
|
|
+import com.fs.erp.dto.ErpDeliverysResponse;
|
|
|
+import com.fs.erp.dto.ErpDeliverysRequest;
|
|
|
+import com.fs.erp.dto.df.DFApiResponse;
|
|
|
+import com.fs.erp.service.IErpOrderService;
|
|
|
+import com.fs.erp.dto.sdk.df.DfClient;
|
|
|
+import com.fs.erp.dto.sdk.df.enums.RequestUrlEnum;
|
|
|
import com.fs.fastGpt.domain.FastGptRole;
|
|
|
import com.fs.fastGpt.service.AiHookService;
|
|
|
import com.fs.fastGpt.service.IFastGptRoleService;
|
|
|
+import com.fs.his.domain.FsDfAccount;
|
|
|
import com.fs.his.domain.FsStoreOrder;
|
|
|
+import com.fs.his.domain.FsStoreOrderDf;
|
|
|
import com.fs.his.dto.ExpressInfoDTO;
|
|
|
import com.fs.his.dto.TracesDTO;
|
|
|
import com.fs.his.enums.ShipperCodeEnum;
|
|
|
+import com.fs.his.mapper.FsDfAccountMapper;
|
|
|
+import com.fs.his.mapper.FsStoreOrderDfMapper;
|
|
|
import com.fs.his.service.IFsExpressService;
|
|
|
import com.fs.his.service.IFsStoreOrderService;
|
|
|
import com.fs.qw.domain.QwExternalContact;
|
|
|
@@ -40,6 +53,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.Executor;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
@@ -88,8 +102,16 @@ public class QwMsgController {
|
|
|
@Qualifier("threadPoolTaskExecutor")
|
|
|
private Executor executor;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ FsDfAccountMapper fsDfAccountMapper;
|
|
|
+ @Autowired
|
|
|
+ private FsStoreOrderDfMapper fsStoreOrderDfMapper;
|
|
|
+ @Autowired
|
|
|
+ @Qualifier("dfOrderServiceImpl")
|
|
|
+ private IErpOrderService dfOrderService;
|
|
|
+
|
|
|
@GetMapping("/sendExpressInfo/{orderId}")
|
|
|
- public R sendExpressInfo(@PathVariable Long orderId){
|
|
|
+ public R sendExpressInfo(@PathVariable Long orderId) throws IOException {
|
|
|
String isSend = redisCache.getCacheObject("fs:express:info:send:" +orderId);
|
|
|
if(isSend == null){
|
|
|
redisCache.setCacheObject("fs:express:info:send:" +orderId, "1",2, TimeUnit.MINUTES);
|
|
|
@@ -129,20 +151,41 @@ public class QwMsgController {
|
|
|
sBuilder.append("\uD83C\uDF39\uD83C\uDF39\uD83C\uDF39");
|
|
|
break;
|
|
|
case 3:
|
|
|
- ExpressInfoDTO express = getExpress(order.getOrderId());
|
|
|
- if("211".equals(express.getStateEx())){
|
|
|
- //你好,这边查询到您购买的XXX(购买套餐)在XXX(时间)已经送到了,送货员电话为XXX(送货员信息)
|
|
|
- sBuilder.append("这边查询到您有一个包裹 ");
|
|
|
- if(express != null && express.getTraces() != null && !express.getTraces().isEmpty()){
|
|
|
- List<TracesDTO> traces = express.getTraces();
|
|
|
- TracesDTO tracesDTO = traces.get(traces.size() - 1);
|
|
|
- sBuilder.append(" 在").append(tracesDTO.getAcceptTime()).append("已经送到了\n");
|
|
|
- sBuilder.append(" 物流单号为:").append(order.getDeliverySn()).append("\n");
|
|
|
- sBuilder.append("物流信息:").append(tracesDTO.getAcceptStation()).append("\n");
|
|
|
- }else{
|
|
|
- sBuilder.append(" 已经送到了\n");
|
|
|
+ if (CloudHostUtils.hasCloudHostName("金牛明医")) {
|
|
|
+ ErpDeliverysRequest erpDeliverysRequest = new ErpDeliverysRequest();
|
|
|
+ erpDeliverysRequest.setCode(order.getOrderCode());
|
|
|
+ ErpDeliverysResponse express = dfOrderService.getDeliver(erpDeliverysRequest);
|
|
|
+
|
|
|
+ if (express != null && express.getDeliverys() != null && !express.getDeliverys().isEmpty()) {
|
|
|
+ List<ErpDeliverys> deliverys = express.getDeliverys();
|
|
|
+ ErpDeliverys latestDelivery = deliverys.get(deliverys.size() - 1);
|
|
|
+
|
|
|
+ sBuilder.append("这边查询到您有一个包裹 ");
|
|
|
+ if (latestDelivery != null) {
|
|
|
+ sBuilder.append(" 在").append(latestDelivery.getAcceptTime()).append("已经送到了\n");
|
|
|
+ sBuilder.append(" 物流单号为:").append(order.getDeliverySn()).append("\n");
|
|
|
+ sBuilder.append("物流信息:").append(latestDelivery.getRemark()).append("\n");
|
|
|
+ } else {
|
|
|
+ sBuilder.append(" 已经送到了\n");
|
|
|
+ }
|
|
|
+ sBuilder.append("\uD83C\uDF39\uD83C\uDF39\uD83C\uDF39");
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ ExpressInfoDTO express = getExpress(order.getOrderId());
|
|
|
+ if("211".equals(express.getStateEx())){
|
|
|
+ //你好,这边查询到您购买的XXX(购买套餐)在XXX(时间)已经送到了,送货员电话为XXX(送货员信息)
|
|
|
+ sBuilder.append("这边查询到您有一个包裹 ");
|
|
|
+ if(express != null && express.getTraces() != null && !express.getTraces().isEmpty()){
|
|
|
+ List<TracesDTO> traces = express.getTraces();
|
|
|
+ TracesDTO tracesDTO = traces.get(traces.size() - 1);
|
|
|
+ sBuilder.append(" 在").append(tracesDTO.getAcceptTime()).append("已经送到了\n");
|
|
|
+ sBuilder.append(" 物流单号为:").append(order.getDeliverySn()).append("\n");
|
|
|
+ sBuilder.append("物流信息:").append(tracesDTO.getAcceptStation()).append("\n");
|
|
|
+ }else{
|
|
|
+ sBuilder.append(" 已经送到了\n");
|
|
|
+ }
|
|
|
+ sBuilder.append("\uD83C\uDF39\uD83C\uDF39\uD83C\uDF39");
|
|
|
}
|
|
|
- sBuilder.append("\uD83C\uDF39\uD83C\uDF39\uD83C\uDF39");
|
|
|
}
|
|
|
break;
|
|
|
case 4:
|
|
|
@@ -809,4 +852,32 @@ public class QwMsgController {
|
|
|
QwImSocket.broadcast(message);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取账户索引 后续添加规则
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private Long getSFAccountIndex(Long orderId) {
|
|
|
+ List<FsDfAccount> fsDfAccounts = fsDfAccountMapper.selectFsDfAccountList(null);
|
|
|
+ if (orderId != null) {
|
|
|
+ //查询是否选择erp账户
|
|
|
+ FsStoreOrderDf temp = fsStoreOrderDfMapper.selectFsStoreOrderDfByOrderId(orderId);
|
|
|
+ if (temp != null) {
|
|
|
+ if (fsDfAccounts != null && !fsDfAccounts.isEmpty()) {
|
|
|
+ for (FsDfAccount fsDfAccount : fsDfAccounts) {
|
|
|
+ if (temp.getLoginAccount().equals(fsDfAccount.getLoginAccount())) {
|
|
|
+ return fsDfAccount.getId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (fsDfAccounts != null && !fsDfAccounts.isEmpty()) {
|
|
|
+ return fsDfAccounts.get(0).getId();
|
|
|
+ } else {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|