| | |
| | | private final static String SING_NAME = "橙桔天下科技"; |
| | | |
| | | |
| | | public void sendSms(int type, String phone, Orders orders, String receiveName, String businessPhone, BigDecimal distance, IdentityInfo identityInfo,CategoryMapper categoryMapper){ |
| | | 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){ |
| | |
| | | } |
| | | if(smsContent.getName().indexOf("time2")>=Constants.ZERO){ |
| | | tempParam.put("time2", DateUtil.formatDate(orders.getEndDate(),"MM-dd")); |
| | | } |
| | | if(smsContent.getName().indexOf("name")>=Constants.ZERO){ |
| | | tempParam.put("name", receiveName); |
| | | } |
| | | if(smsContent.getName().indexOf("money")>=Constants.ZERO){ |
| | | tempParam.put("money", new BigDecimal(orders.getReceiveAccount().toString()).divide(new BigDecimal("100"),2,BigDecimal.ROUND_HALF_UP)+"元"); |
| | |
| | | tempParam.put("authentication", Constants.equalsInteger(identityInfo.getAuthType(),Constants.ZERO)?"个人":identityInfo.getCompanyName()); |
| | | } |
| | | if(smsContent.getName().indexOf("order")>=Constants.ZERO){ |
| | | tempParam.put("order", Constants.orderType.getName(identityInfo.getType()).replace("单","")); |
| | | 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)?"已通过":"未通过"); |
| | |
| | | tempParam.put("order",order); |
| | | } |
| | | } |
| | | |
| | | if(smsContent.getName().indexOf("authentication")>=Constants.ZERO){ |
| | | 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("短信发送失败~"); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | //请求失败这里会抛ClientException异常 |
| | | SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request); |
| | | if (sendSmsResponse.getCode() != null && sendSmsResponse.getCode().equals("OK")) { |
| | | // logger.info(phone + "-" + templateCode + "-" + templateParam + " >>> " + JSON.toJSONString(sendSmsResponse)); |
| | | log.info("短信发送内容:"+phone + "-" + templateCode + "-" + templateParam + " >>> " + JSON.toJSONString(sendSmsResponse)); |
| | | return true; |
| | | } else { |
| | | // logger.error(phone + "-" + templateCode + "-" + templateParam + " >>> " + JSON.toJSONString(sendSmsResponse)); |
| | | log.error("短信发送内容:"+phone + "-" + templateCode + "-" + templateParam + " >>> " + JSON.toJSONString(sendSmsResponse)); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |