|
@@ -1,7 +1,14 @@
|
|
|
package com.dgtly.wxportal.service.impl;
|
|
|
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+import java.util.stream.Stream;
|
|
|
+
|
|
|
import com.dgtly.common.utils.DateUtils;
|
|
|
+import com.dgtly.system.mapper.SysBatchSignForMapper;
|
|
|
+import com.dgtly.system.mapper.SysUserMapper;
|
|
|
+import com.dgtly.system.service.ISysConfigService;
|
|
|
+import com.dgtly.wxportal.utils.qywxutils.QyWxSendMessageUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.dgtly.wxportal.mapper.WxSendMessageMapper;
|
|
@@ -16,11 +23,18 @@ import com.dgtly.common.core.text.Convert;
|
|
|
* @date 2020-09-02
|
|
|
*/
|
|
|
@Service
|
|
|
-public class WxSendMessageServiceImpl implements IWxSendMessageService
|
|
|
+public class WxSendMessageServiceImpl implements IWxSendMessageService
|
|
|
{
|
|
|
@Autowired
|
|
|
private WxSendMessageMapper wxSendMessageMapper;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private QyWxSendMessageUtil qyWxSendMessageUtil;
|
|
|
+ @Autowired
|
|
|
+ private SysUserMapper userMapper;
|
|
|
+ @Autowired
|
|
|
+ private ISysConfigService configService;
|
|
|
+ @Autowired
|
|
|
+ private SysBatchSignForMapper batchSignForMapper;
|
|
|
/**
|
|
|
* 查询企业微信发送消息历史记录
|
|
|
*
|
|
@@ -94,4 +108,52 @@ public class WxSendMessageServiceImpl implements IWxSendMessageService
|
|
|
{
|
|
|
return wxSendMessageMapper.deleteWxSendMessageById(id);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: 自提未提货企微消息通知
|
|
|
+ * @param:
|
|
|
+ * @return:
|
|
|
+ * @author: njs
|
|
|
+ * @date: 2023/5/15 11:27
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void sendWxTmsMessage() {
|
|
|
+ Map<String, Map<String, Object>> tmsMap = batchSignForMapper.selectDeliverySelf();
|
|
|
+ if(tmsMap !=null && tmsMap.size()>0){
|
|
|
+ //自提提货通知
|
|
|
+ String temple = configService.selectConfigByKey("wx.notification.self.factory");
|
|
|
+ for (String customerId:tmsMap.keySet()
|
|
|
+ ) {
|
|
|
+ String user =null;
|
|
|
+ String deliverNumber =null;
|
|
|
+ String orderFormat =null;
|
|
|
+ String customerName = userMapper.getCustomNameByCode(customerId);
|
|
|
+ Map<String, Map<String,Object>> maps = userMapper.selectLoginNamesByOrgCodeSelf(customerId);
|
|
|
+ Iterator<Map.Entry<String, Object>> iterator = tmsMap.get(customerId).entrySet().iterator();
|
|
|
+ while (iterator.hasNext()){
|
|
|
+ Map.Entry<String, Object> next = iterator.next();
|
|
|
+ if(next.getKey().equals("deliveryNumber")){
|
|
|
+ if(deliverNumber !=null){
|
|
|
+ deliverNumber = deliverNumber+","+next.getValue().toString();
|
|
|
+ }else{
|
|
|
+ deliverNumber=next.getValue().toString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String empName=userMapper.selectLoginNameByCustomerCode(customerId);
|
|
|
+ if(empName !=null){
|
|
|
+ user=maps.get(customerId).get("touser").toString()+"|"+empName;
|
|
|
+ }else{
|
|
|
+ user=maps.get(customerId).get("touser").toString();
|
|
|
+ }
|
|
|
+ String CustomerName=customerName+"("+customerId+")";
|
|
|
+ String messageDetail = String.format(temple, CustomerName,deliverNumber);
|
|
|
+ //消息
|
|
|
+ if(user !=null){
|
|
|
+ qyWxSendMessageUtil.sendMsgSelfToCustomer(user,messageDetail, "48");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|