Commit fb9d9800 authored by hezhen's avatar hezhen

添加短信

parent 6a9a354f
...@@ -6,10 +6,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -6,10 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.admin.dto.CompanyApplyFindDTO; import com.github.wxiaoqi.security.admin.dto.CompanyApplyFindDTO;
import com.github.wxiaoqi.security.admin.entity.BranchCompany; import com.github.wxiaoqi.security.admin.entity.*;
import com.github.wxiaoqi.security.admin.entity.CompanyInfo;
import com.github.wxiaoqi.security.admin.entity.CompanyInfoApply;
import com.github.wxiaoqi.security.admin.entity.CompanyInfoOrder;
import com.github.wxiaoqi.security.admin.mapper.CompanyInfoApplyMapper; import com.github.wxiaoqi.security.admin.mapper.CompanyInfoApplyMapper;
import com.github.wxiaoqi.security.admin.vo.CompanyApplyVo; import com.github.wxiaoqi.security.admin.vo.CompanyApplyVo;
import com.github.wxiaoqi.security.admin.vo.CompanyInfoVo; import com.github.wxiaoqi.security.admin.vo.CompanyInfoVo;
...@@ -21,6 +18,8 @@ import com.github.wxiaoqi.security.common.util.process.ResultCode; ...@@ -21,6 +18,8 @@ import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.app.entity.Cofig; import com.xxfc.platform.app.entity.Cofig;
import com.xxfc.platform.app.feign.ConfigFeign; import com.xxfc.platform.app.feign.ConfigFeign;
import com.xxfc.platform.universal.dto.SmsTemplateDTO;
import com.xxfc.platform.universal.feign.ThirdFeign;
import io.swagger.models.auth.In; import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -29,6 +28,7 @@ import org.springframework.stereotype.Service; ...@@ -29,6 +28,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -46,6 +46,12 @@ public class CompanyInfoApplyBiz extends BaseBiz<CompanyInfoApplyMapper, Company ...@@ -46,6 +46,12 @@ public class CompanyInfoApplyBiz extends BaseBiz<CompanyInfoApplyMapper, Company
@Autowired @Autowired
CompanyInfoOrderBiz companyInfoOrderBiz; CompanyInfoOrderBiz companyInfoOrderBiz;
@Autowired
ThirdFeign thirdFeign;
@Autowired
AppUserLoginBiz appUserLoginBiz;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public CompanyInfoApply saveApply(CompanyInfo companyInfo){ public CompanyInfoApply saveApply(CompanyInfo companyInfo){
...@@ -109,6 +115,8 @@ public class CompanyInfoApplyBiz extends BaseBiz<CompanyInfoApplyMapper, Company ...@@ -109,6 +115,8 @@ public class CompanyInfoApplyBiz extends BaseBiz<CompanyInfoApplyMapper, Company
return companyInfoApply; return companyInfoApply;
} }
public Long checkStatus(Long branchId){ public Long checkStatus(Long branchId){
CompanyInfoApply companyInfoApply=new CompanyInfoApply(); CompanyInfoApply companyInfoApply=new CompanyInfoApply();
companyInfoApply.setBranchId(branchId); companyInfoApply.setBranchId(branchId);
...@@ -189,12 +197,36 @@ public class CompanyInfoApplyBiz extends BaseBiz<CompanyInfoApplyMapper, Company ...@@ -189,12 +197,36 @@ public class CompanyInfoApplyBiz extends BaseBiz<CompanyInfoApplyMapper, Company
companyInfoApply1.setBranchId(id); companyInfoApply1.setBranchId(id);
updateSelectiveById(companyInfoApply1); updateSelectiveById(companyInfoApply1);
} }
} }
sendSms(companyInfoApply);
} }
public void sendSms(CompanyInfoApply companyInfoApply){
try {
//发送短信通知用户
List<String> smsParams = new ArrayList<>();
String name = StringUtils.isBlank(companyInfoApply.getName()) ? "" : companyInfoApply.getName();
smsParams.add(name);
Integer userId = companyInfoApply.getAppUserId() == null ? 0 : companyInfoApply.getAppUserId();
AppUserLogin userLogin = appUserLoginBiz.selectById(userId);
if (userLogin == null){
return;
}
Integer type=companyInfoApply.getStatus() == 1 ? SmsTemplateDTO.COMPANY_S : SmsTemplateDTO.COMPANY_F;
thirdFeign.sendTemplate(new SmsTemplateDTO(){{
setPhoneNumbers(userLogin.getUsername());
setType(type);
setParams(smsParams.toArray(new String[smsParams.size()]));
}});
}catch (Exception e){
log.error(e.getMessage(), e);
return;
}
}
public CompanyInfoVo getCompanyInfo(CompanyInfo companyInfo){ public CompanyInfoVo getCompanyInfo(CompanyInfo companyInfo){
Long branchId = companyInfo.getId() == null ? 0L : companyInfo.getId(); Long branchId = companyInfo.getId() == null ? 0L : companyInfo.getId();
......
...@@ -73,7 +73,14 @@ public class SmsTemplateDTO { ...@@ -73,7 +73,14 @@ public class SmsTemplateDTO {
public static final int PAY_J= 27; public static final int PAY_J= 27;
//小程序密码通知 //小程序密码通知
public static final int PWD= 28; public static final int PWD= 28;
//商家审核(通过)
public static final int COMPANY_S= 29;
//商家审核(不通过)
public static final int COMPANY_F= 30;
//商品审核(通过)
public static final int GOODS_S= 31;
//商品审核(不通过)
public static final int GOODS_F= 32;
//类型:1-租车订单通知(普通用户),2-租车订单短信(会员权益),3-旅游订单短信,4-加入会员通知 //类型:1-租车订单通知(普通用户),2-租车订单短信(会员权益),3-旅游订单短信,4-加入会员通知
......
...@@ -81,9 +81,16 @@ public class AliYunSmsBiz { ...@@ -81,9 +81,16 @@ public class AliYunSmsBiz {
public static final String TEMPLATE_ID_PAY_I= "SMS_205435086"; public static final String TEMPLATE_ID_PAY_I= "SMS_205435086";
//旅游(上车通知)27 //旅游(上车通知)27
public static final String TEMPLATE_ID_PAY_J= "SMS_173345606"; public static final String TEMPLATE_ID_PAY_J= "SMS_173345606";
//旅游(上车通知)28
//旅游(上车通知)27
public static final String PWD= "SMS_174990497"; public static final String PWD= "SMS_174990497";
//商家审核(通过)29
public static final String COMPANY_SUCESS= "SMS_205439814";
//商家审核(不通过)30
public static final String COMPANY_FAIL= "SMS_205449712";
//商品审核(通过)31
public static final String GOODS_SUCESS= "SMS_205439817";
//商品审核(不通过)32
public static final String GOODS_FAIL= "SMS_205439818";
...@@ -172,6 +179,18 @@ public class AliYunSmsBiz { ...@@ -172,6 +179,18 @@ public class AliYunSmsBiz {
case 28 : case 28 :
SmsService.sendTemplateToJson(phoneNumbers,params,PWD); SmsService.sendTemplateToJson(phoneNumbers,params,PWD);
break; break;
case 29 :
SmsService.sendTemplateToJson(phoneNumbers,params,COMPANY_SUCESS);
break;
case 30 :
SmsService.sendTemplateToJson(phoneNumbers,params,COMPANY_FAIL);
break;
case 31 :
SmsService.sendTemplateToJson(phoneNumbers,params,GOODS_SUCESS);
break;
case 32 :
SmsService.sendTemplateToJson(phoneNumbers,params,GOODS_FAIL);
break;
} }
......
...@@ -10,4 +10,6 @@ public class CompanySearchVO extends BranchCompany { ...@@ -10,4 +10,6 @@ public class CompanySearchVO extends BranchCompany {
BigDecimal distance; BigDecimal distance;
String companyName; String companyName;
Integer appUserId;
} }
...@@ -4,15 +4,22 @@ package com.xxfc.platform.vehicle.biz; ...@@ -4,15 +4,22 @@ package com.xxfc.platform.vehicle.biz;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.BeanUtils; import com.github.wxiaoqi.security.common.util.BeanUtils;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.universal.dto.SmsTemplateDTO;
import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.entity.Vehicle; import com.xxfc.platform.vehicle.entity.Vehicle;
import com.xxfc.platform.vehicle.entity.VehicleApply; import com.xxfc.platform.vehicle.entity.VehicleApply;
import com.xxfc.platform.vehicle.mapper.VehicleApplyMapper; import com.xxfc.platform.vehicle.mapper.VehicleApplyMapper;
import com.xxfc.platform.vehicle.pojo.CompanySearchDTO;
import com.xxfc.platform.vehicle.pojo.CompanySearchVO;
import com.xxfc.platform.vehicle.pojo.dto.VehicleApplyFindDTO; import com.xxfc.platform.vehicle.pojo.dto.VehicleApplyFindDTO;
import com.xxfc.platform.vehicle.pojo.vo.VehicleApplyVo; import com.xxfc.platform.vehicle.pojo.vo.VehicleApplyVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -21,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -21,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -36,6 +44,15 @@ public class VehicleApplyBiz extends BaseBiz<VehicleApplyMapper, VehicleApply>{ ...@@ -36,6 +44,15 @@ public class VehicleApplyBiz extends BaseBiz<VehicleApplyMapper, VehicleApply>{
@Autowired @Autowired
VehicleExtensionBiz extensionBiz; VehicleExtensionBiz extensionBiz;
@Autowired
ThirdFeign thirdFeign;
@Autowired
UserFeign userFeign;
@Autowired
BranchCompanyBiz branchCompanyBiz;
...@@ -147,6 +164,41 @@ public class VehicleApplyBiz extends BaseBiz<VehicleApplyMapper, VehicleApply>{ ...@@ -147,6 +164,41 @@ public class VehicleApplyBiz extends BaseBiz<VehicleApplyMapper, VehicleApply>{
} }
} }
sendSms(vehicleApply);
}
public void sendSms(VehicleApply vehicleApply){
try {
//发送短信通知用户
List<String> smsParams = new ArrayList<>();
String name = StringUtils.isBlank(vehicleApply.getName()) ? "" : vehicleApply.getName();
smsParams.add(name);
Integer companyId = vehicleApply.getSubordinateBranch() == null ? 0 : vehicleApply.getSubordinateBranch();
if (companyId == 0){
return;
}
CompanySearchDTO companySearchDTO = new CompanySearchDTO();
companySearchDTO.setId(companyId);
List<CompanySearchVO> list = branchCompanyBiz.getList(companySearchDTO);
if (list.size() == 0){
return;
}
CompanySearchVO companySearchVO = list.get(0);
ObjectRestResponse<AppUserDTO> restResponse = userFeign.userDetailById(companySearchVO.getAppUserId());
if (restResponse.getData() == null){
return;
}
AppUserDTO appUserDTO = restResponse.getData();
Integer type=vehicleApply.getApplyStatus() == 1 ? SmsTemplateDTO.GOODS_S : SmsTemplateDTO.GOODS_S;
thirdFeign.sendTemplate(new SmsTemplateDTO(){{
setPhoneNumbers(appUserDTO.getUsername());
setType(type);
setParams(smsParams.toArray(new String[smsParams.size()]));
}});
}catch (Exception e){
log.error(e.getMessage(), e);
return;
}
} }
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
</select> </select>
<select id="search" parameterType="com.xxfc.platform.vehicle.pojo.CompanySearchDTO" resultType="com.xxfc.platform.vehicle.pojo.CompanySearchVO"> <select id="search" parameterType="com.xxfc.platform.vehicle.pojo.CompanySearchDTO" resultType="com.xxfc.platform.vehicle.pojo.CompanySearchVO">
select c.*,i.name as companyName select c.*,i.name as companyName,i.app_user_id as appUserId
<if test="lon != null and lat != null"> <if test="lon != null and lat != null">
, st_distance_sphere(point(#{lon}, #{lat}), point(c.longitude, c.latitude)) as distance , st_distance_sphere(point(#{lon}, #{lat}), point(c.longitude, c.latitude)) as distance
</if> </if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment