From 7ee466ebc953bb5640bcf42f2b8e2a87aa471c21 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期三, 15 四月 2026 20:12:21 +0800
Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/gtzxinglijicun
---
server/services/src/main/java/com/doumee/service/business/AliSmsService.java | 96 ++----------------------------------------------
1 files changed, 4 insertions(+), 92 deletions(-)
diff --git a/server/services/src/main/java/com/doumee/service/business/AliSmsService.java b/server/services/src/main/java/com/doumee/service/business/AliSmsService.java
index b9b3174..43f915d 100644
--- a/server/services/src/main/java/com/doumee/service/business/AliSmsService.java
+++ b/server/services/src/main/java/com/doumee/service/business/AliSmsService.java
@@ -1,7 +1,6 @@
package com.doumee.service.business;
import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
@@ -10,24 +9,10 @@
import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;
-import com.doumee.core.constants.Constants;
-import com.doumee.core.utils.DateUtil;
-import com.doumee.dao.business.CategoryMapper;
-import com.doumee.dao.business.model.Category;
-import com.doumee.dao.business.model.IdentityInfo;
-import com.doumee.dao.business.model.Orders;
-import com.doumee.dao.dto.CateringDTO;
-import com.github.pagehelper.Constant;
-import com.github.xiaoymin.knife4j.core.util.CollectionUtils;
import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import java.math.BigDecimal;
-import java.util.*;
+import java.util.Map;
/**
* Created by IntelliJ IDEA.
@@ -39,86 +24,13 @@
@Slf4j
public class AliSmsService {
- protected Logger logger = LogManager.getLogger("sms");
-
private final static String ACCESS_KEY_ID = "LTAI5tMkg7wwV74a8H6Bm3Ej";
private final static String ACCESS_KEY_SECRET = "FcHKST36sfwfo706L6bvrweGFIbp3n";
private final static String SING_NAME = "姗欐澶╀笅绉戞妧";
- public void businessSendSms(int type, String phone, Orders orders, BigDecimal distance,
- IdentityInfo identityInfo,CategoryMapper categoryMapper){
- try{
- Constants.smsContent smsContent = Constants.smsContent.getSmsContent(type);
- Map<String,Object> tempParam = new HashMap<>();
- if(smsContent.getName().indexOf("time1")>=Constants.ZERO){
- tempParam.put("time1", DateUtil.formatDate(orders.getStartDate(),"yyyy-MM-dd")+" ");
- }
- if(smsContent.getName().indexOf("time2")>=Constants.ZERO){
- tempParam.put("time2", " "+DateUtil.formatDate(orders.getEndDate(),"yyyy-MM-dd"));
- }
- if(smsContent.getName().indexOf("money")>=Constants.ZERO){
- tempParam.put("money", new BigDecimal(orders.getReceiveAccount().toString()).divide(new BigDecimal("100"),2,BigDecimal.ROUND_HALF_UP)+"鍏�");
- }
- if(smsContent.getName().indexOf("distance")>=Constants.ZERO){
- tempParam.put("distance", distance +"km");
- }
- //璁よ瘉鐭俊 鐗规畩澶勭悊
- if(Constants.equalsInteger(smsContent.getKey(),Constants.smsContent.authentication.getKey())){
- //璁よ瘉绫诲瀷
- if(smsContent.getName().indexOf("authentication")>=Constants.ZERO){
- tempParam.put("authentication", Constants.equalsInteger(identityInfo.getAuthType(),Constants.ZERO)?"涓汉":identityInfo.getCompanyName());
- }
- if(smsContent.getName().indexOf("order")>=Constants.ZERO){
- tempParam.put("oeder", Constants.orderType.getName(identityInfo.getType()).replace("鍗�",""));
- }
- if(smsContent.getName().indexOf("status")>=Constants.ZERO){
- tempParam.put("status", Constants.equalsInteger(identityInfo.getAuditStatus(),Constants.TWO)?"宸查�氳繃":"鏈�氳繃");
- }
- }else{
- if(smsContent.getName().indexOf("order")>=Constants.ZERO){
- String order = "";
- //鏌ヨ璁㈠崟鐨勭被鍨嬩俊鎭�
- if(Constants.equalsInteger(orders.getType(),Constants.ZERO)){
- order = Constants.workType.getName(orders.getWorkType());
- Category category = categoryMapper.selectById(orders.getCategoryId());
- if(Objects.nonNull(category)){
- order = category.getName() + order;
- }
- }else if(Constants.equalsInteger(orders.getType(),Constants.ZERO)){
- order = "杩愯緭";
- Category category = categoryMapper.selectById(orders.getTransportTypeId());
- if(Objects.nonNull(category)){
- order = category.getName() + order;
- }
- }else{
- List<CateringDTO> cateringDTOList = JSONArray.parseArray(orders.getWayInfo(),CateringDTO.class);
- if(CollectionUtils.isNotEmpty(cateringDTOList)){
- for (CateringDTO cateringDTO:cateringDTOList) {
- if(StringUtils.isBlank(order)){
- order = cateringDTO.getName();
- }else{
- order = order + "/" +cateringDTO.getName();
- }
- }
- }
- }
- tempParam.put("order",order);
- }
- }
- if(smsContent.getName().indexOf("distance")>=Constants.ZERO){
- tempParam.put("distance", distance +"km");
- }
- AliSmsService.sendSms(phone,smsContent.getCode(), JSONObject.toJSONString(tempParam));
- }catch (Exception e){
- log.error("鐭俊鍙戦�佸け璐");
- }
-
- }
-
-
public static void main(String[] args) {
- Map<String,Object> tempParam = new HashMap<>();
+ Map<String,Object> tempParam = new java.util.HashMap<>();
tempParam.put("order","钁¤悇閲囨憳宸�");
tempParam.put("time1","07-23");
tempParam.put("time2","07-24");
@@ -158,8 +70,8 @@
request.setSignName(SING_NAME);
//蹇呭~:鐭俊妯℃澘-鍙湪鐭俊鎺у埗鍙颁腑鎵惧埌
request.setTemplateCode(templateCode);
- //鍙��:妯℃澘涓殑鍙橀噺鏇挎崲JSON涓�,濡傛ā鏉垮唴瀹逛负"浜茬埍鐨�${name},鎮ㄧ殑楠岃瘉鐮佷负${code}"鏃�,姝ゅ鐨勫�间负
- //鍙嬫儏鎻愮ず:濡傛灉JSON涓渶瑕佸甫鎹㈣绗�,璇峰弬鐓ф爣鍑嗙殑JSON鍗忚瀵规崲琛岀鐨勮姹�,姣斿鐭俊鍐呭涓寘鍚玕r\n鐨勬儏鍐靛湪JSON涓渶瑕佽〃绀烘垚\\r\\n,鍚﹀垯浼氬鑷碕SON鍦ㄦ湇鍔$瑙f瀽澶辫触
+ //鍙��:妯℃澘涓殑鍙橀噺鏇挎崲JSON涓�,濡傛ā鏉垮唴瀹逛负"浜茬埍鐨�${name},鎮ㄧ殑楠岃瘉鐮佷负${code}"鏃讹紝姝ゅ鐨勫�间负
+ //鍙嬫儏鎻愮ず:濡傛灉JSON涓渶瑕佸甫鎹㈣绗�,璇峰弬鐓ф爣鍑嗙殑JSON鍗忚瀵规崲琛岀鐨勮姹�,姣斿鐭俊鍐呭涓寘鍚玕r\n鐨勬儏鍐靛湪JSON涓渶瑕佽〃绀烘垚\\r\n,鍚﹀垯浼氬鑷碕SON鍦ㄦ湇鍔$瑙f瀽澶辫触
request.setTemplateParam(templateParam);
//鍙��-涓婅鐭俊鎵╁睍鐮�(鎵╁睍鐮佸瓧娈垫帶鍒跺湪7浣嶆垨浠ヤ笅锛屾棤鐗规畩闇�姹傜敤鎴疯蹇界暐姝ゅ瓧娈�)
//dto.setSmsUpExtendCode("90997");
--
Gitblit v1.9.3