1.调整
This commit is contained in:
		
							parent
							
								
									42442ec8ff
								
							
						
					
					
						commit
						ff31dd24f7
					
				| 
						 | 
					@ -141,8 +141,13 @@ aliyun:
 | 
				
			||||||
  accessKeyId: LTAI5tS7bUhRvjcTy4yJkagK
 | 
					  accessKeyId: LTAI5tS7bUhRvjcTy4yJkagK
 | 
				
			||||||
  accessKeySecret: eQJsruUAvFfJblHZJ50QyiALCSZeRK
 | 
					  accessKeySecret: eQJsruUAvFfJblHZJ50QyiALCSZeRK
 | 
				
			||||||
  signName: 创享电动车
 | 
					  signName: 创享电动车
 | 
				
			||||||
  # 验证码模版id
 | 
					  # 验证码模版id  您名下有一笔租车订单已归还,订单金额:"+ amount +"元。
 | 
				
			||||||
  templateCode: SMS_470225045
 | 
					  templateCode: SMS_470225045
 | 
				
			||||||
 | 
					  # 您有一笔订单:${orderNo},用户已付款,可在小程序管理端查看。
 | 
				
			||||||
 | 
					  templateCode2: SMS_470490072
 | 
				
			||||||
 | 
					  templateCode3: SMS_470490072
 | 
				
			||||||
 | 
					  # 提现申请时,发送的手机号 13376970966
 | 
				
			||||||
 | 
					  phone: 18650502300
 | 
				
			||||||
# 七牛云配置
 | 
					# 七牛云配置
 | 
				
			||||||
qiniu:
 | 
					qiniu:
 | 
				
			||||||
  # 七牛云key
 | 
					  # 七牛云key
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -639,4 +639,34 @@ public class ServiceConstants {
 | 
				
			||||||
    public static final String FLOW_STATUS_COMPLETE = "8";
 | 
					    public static final String FLOW_STATUS_COMPLETE = "8";
 | 
				
			||||||
    /**----------------------------资金流水状态end----------------------------*/
 | 
					    /**----------------------------资金流水状态end----------------------------*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**----------------------------资金流水状态start----------------------------*/
 | 
				
			||||||
 | 
					    /** 短信类型:1-还车审核通知;2-用户付款通知;3-提现申请通知 */
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 1-还车审核通知
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public static final String MSG_TYPE_VEHICLE_RETURN_AUDIT_NOTIFY = "1";
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 2-用户付款通知
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public static final String MSG_TYPE_USER_PAYMENT_NOTIFY = "2";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 3-提现申请通知
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public static final String MSG_TYPE_WITHDRAWAL_NOTIFY = "3";
 | 
				
			||||||
 | 
					    /**----------------------------资金流水状态end----------------------------*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**----------------------------提现手续费类型start----------------------------*/
 | 
				
			||||||
 | 
					    /** 提现手续费类型:1-按比例;2-按每笔 */
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 1-按比例
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public static final String HANDLING_CHARGE_TYPE_PERCENT = "1";
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 2-按每笔
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public static final String HANDLING_CHARGE_TYPE_PER_STROKE = "2";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**----------------------------提现手续费类型end----------------------------*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -115,6 +115,16 @@ public class SysDept extends BaseEntity
 | 
				
			||||||
    /** 区域名称 */
 | 
					    /** 区域名称 */
 | 
				
			||||||
    private String areaName;
 | 
					    private String areaName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String handlingChargeType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getHandlingChargeType() {
 | 
				
			||||||
 | 
					        return handlingChargeType;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setHandlingChargeType(String handlingChargeType) {
 | 
				
			||||||
 | 
					        this.handlingChargeType = handlingChargeType;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public String getAreaName() {
 | 
					    public String getAreaName() {
 | 
				
			||||||
        return areaName;
 | 
					        return areaName;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -320,7 +330,7 @@ public class SysDept extends BaseEntity
 | 
				
			||||||
        this.deptName = deptName;
 | 
					        this.deptName = deptName;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @NotNull(message = "显示顺序不能为空")
 | 
					//    @NotNull(message = "显示顺序不能为空")
 | 
				
			||||||
    public Integer getOrderNum()
 | 
					    public Integer getOrderNum()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return orderNum;
 | 
					        return orderNum;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,7 +18,7 @@ public class EtMsgLog extends BaseEntity
 | 
				
			||||||
    /** 主键 */
 | 
					    /** 主键 */
 | 
				
			||||||
    private Long id;
 | 
					    private Long id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /** 短信类型 */
 | 
					    /** 短信类型:1-还车审核通知;2-用户付款通知;3-提现申请通知 */
 | 
				
			||||||
    @Excel(name = "短信类型")
 | 
					    @Excel(name = "短信类型")
 | 
				
			||||||
    private String type;
 | 
					    private String type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -136,6 +136,10 @@ public class CallbackServiceImpl implements CallbackService {
 | 
				
			||||||
    @Value("${aliyun.templateCode}")
 | 
					    @Value("${aliyun.templateCode}")
 | 
				
			||||||
    private String templateCode;
 | 
					    private String templateCode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Value("${aliyun.templateCode2}")
 | 
				
			||||||
 | 
					    private String templateCode2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Resource
 | 
					    @Resource
 | 
				
			||||||
    private EtMsgLogMapper etMsgLogMapper;
 | 
					    private EtMsgLogMapper etMsgLogMapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -213,6 +217,10 @@ public class CallbackServiceImpl implements CallbackService {
 | 
				
			||||||
                        // 退还押金处理
 | 
					                        // 退还押金处理
 | 
				
			||||||
                        refundDeposit(area.getDeposit(), order, asUser);
 | 
					                        refundDeposit(area.getDeposit(), order, asUser);
 | 
				
			||||||
                        logger.info("=================【微信支付回调】33333333==================");
 | 
					                        logger.info("=================【微信支付回调】33333333==================");
 | 
				
			||||||
 | 
					                        // 用户付款通知
 | 
				
			||||||
 | 
					                        if("1".equals(area.getMsgSwitch())){
 | 
				
			||||||
 | 
					                            asynchronousMsg2(order);
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);//还车后车辆正常运营
 | 
					                    asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);//还车后车辆正常运营
 | 
				
			||||||
                    asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_CLOSE);
 | 
					                    asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_CLOSE);
 | 
				
			||||||
| 
						 | 
					@ -313,7 +321,7 @@ public class CallbackServiceImpl implements CallbackService {
 | 
				
			||||||
            EtMsgLog etMsgLog = new EtMsgLog();
 | 
					            EtMsgLog etMsgLog = new EtMsgLog();
 | 
				
			||||||
            etMsgLog.setPhone(phone);
 | 
					            etMsgLog.setPhone(phone);
 | 
				
			||||||
            etMsgLog.setContent("您名下有一笔租车订单已归还,订单金额:"+ amount +"元。");
 | 
					            etMsgLog.setContent("您名下有一笔租车订单已归还,订单金额:"+ amount +"元。");
 | 
				
			||||||
            etMsgLog.setType("1");
 | 
					            etMsgLog.setType(ServiceConstants.MSG_TYPE_VEHICLE_RETURN_AUDIT_NOTIFY);
 | 
				
			||||||
            etMsgLog.setSignName(signName);
 | 
					            etMsgLog.setSignName(signName);
 | 
				
			||||||
            etMsgLog.setTemplateCode(templateCode);
 | 
					            etMsgLog.setTemplateCode(templateCode);
 | 
				
			||||||
            int i = etMsgLogMapper.insertEtMsgLog(etMsgLog);
 | 
					            int i = etMsgLogMapper.insertEtMsgLog(etMsgLog);
 | 
				
			||||||
| 
						 | 
					@ -325,6 +333,54 @@ public class CallbackServiceImpl implements CallbackService {
 | 
				
			||||||
        }, 0 , TimeUnit.HOURS);
 | 
					        }, 0 , TimeUnit.HOURS);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private void asynchronousMsg2(EtOrder order) {
 | 
				
			||||||
 | 
					        scheduledExecutorService.schedule(() -> {
 | 
				
			||||||
 | 
					            /** 发送一个短信给运营商*/
 | 
				
			||||||
 | 
					            SysDept sysDept = wxPayService.getDeptObjByAreaId(order.getAreaId());
 | 
				
			||||||
 | 
					            logger.info("【用户付款通知】用户付款通知,获取到运营商:【{}】",JSON.toJSON(sysDept));
 | 
				
			||||||
 | 
					            if(ObjectUtil.isNull(sysDept.getAppUserId())){
 | 
				
			||||||
 | 
					                throw new ServiceException("该运营商【"+sysDept.getDeptName()+"】未绑定微信用户");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            AsUser asUser1 = asUserMapper.selectUserById(sysDept.getAppUserId());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            JSONObject jsonObject = new JSONObject();
 | 
				
			||||||
 | 
					            jsonObject.put("orderNo", order.getOrderNo());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            String phone = asUser1.getPhonenumber();
 | 
				
			||||||
 | 
					            SendSmsVo sendSmsVo = new SendSmsVo();
 | 
				
			||||||
 | 
					            sendSmsVo.setMobile(phone);
 | 
				
			||||||
 | 
					            sendSmsVo.setTemplateCode(templateCode2);
 | 
				
			||||||
 | 
					            sendSmsVo.setParam(jsonObject.toJSONString());
 | 
				
			||||||
 | 
					            sendSmsVo.setSignName(signName);
 | 
				
			||||||
 | 
					            SendSmsResponse response = null;
 | 
				
			||||||
 | 
					            logger.info("【用户付款通知】向阿里云发送短信,请求,----------【{}】", JSON.toJSONString(sendSmsVo));
 | 
				
			||||||
 | 
					            try {
 | 
				
			||||||
 | 
					                response = SendAliSmsUtil.sendVerifyCode(accessKeyId,accessKeySecret,sendSmsVo);
 | 
				
			||||||
 | 
					            } catch (ClientException e) {
 | 
				
			||||||
 | 
					                e.printStackTrace();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            logger.info("【用户付款通知】发送阿里云短信成功,返回----------【{}】",JSON.toJSONString(response));
 | 
				
			||||||
 | 
					            //记录资金流水
 | 
				
			||||||
 | 
					            order.setPayFee(new BigDecimal(0.1));
 | 
				
			||||||
 | 
					            callbackService.capitalFlowRecords(order,ServiceConstants.FLOW_TYPE_DISBURSE,
 | 
				
			||||||
 | 
					                    ServiceConstants.ORDER_TYPE_MSG,ServiceConstants.OWNER_TYPE_OPERATOR,null,ServiceConstants.PAY_TYPE_YE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // 短信日志
 | 
				
			||||||
 | 
					            EtMsgLog etMsgLog = new EtMsgLog();
 | 
				
			||||||
 | 
					            etMsgLog.setPhone(phone);
 | 
				
			||||||
 | 
					            etMsgLog.setContent("您有一笔订单:"+order.getOrderNo()+",用户已付款,可在小程序管理端查看。");
 | 
				
			||||||
 | 
					            etMsgLog.setType(ServiceConstants.MSG_TYPE_USER_PAYMENT_NOTIFY);
 | 
				
			||||||
 | 
					            etMsgLog.setSignName(signName);
 | 
				
			||||||
 | 
					            etMsgLog.setTemplateCode(templateCode);
 | 
				
			||||||
 | 
					            int i = etMsgLogMapper.insertEtMsgLog(etMsgLog);
 | 
				
			||||||
 | 
					            if(i>0){
 | 
				
			||||||
 | 
					                logger.info("【用户付款通知】短信日志记录成功");
 | 
				
			||||||
 | 
					            }else{
 | 
				
			||||||
 | 
					                logger.info("【用户付款通知】短信日志记录失败");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }, 0 , TimeUnit.HOURS);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private void asynchronousSaveCallbackLog(EtCallbackLog etCallbackLog) {
 | 
					    private void asynchronousSaveCallbackLog(EtCallbackLog etCallbackLog) {
 | 
				
			||||||
        //开异步线程保存回调参数
 | 
					        //开异步线程保存回调参数
 | 
				
			||||||
        scheduledExecutorService.schedule(() -> {
 | 
					        scheduledExecutorService.schedule(() -> {
 | 
				
			||||||
| 
						 | 
					@ -739,12 +795,19 @@ public class CallbackServiceImpl implements CallbackService {
 | 
				
			||||||
        capitalFlow.setOwnerId(sysDept.getDeptId());
 | 
					        capitalFlow.setOwnerId(sysDept.getDeptId());
 | 
				
			||||||
        capitalFlow.setOwner(sysDept.getDeptName());
 | 
					        capitalFlow.setOwner(sysDept.getDeptName());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        String handlingChargeType = sysDept.getHandlingChargeType();
 | 
				
			||||||
        String handlingCharge1 = sysDept.getHandlingCharge();
 | 
					        String handlingCharge1 = sysDept.getHandlingCharge();
 | 
				
			||||||
 | 
					        BigDecimal handlingCharge;
 | 
				
			||||||
        logger.info("【保存资金流水记录】 获取到配置手续费==============handlingCharge=====================:"+handlingCharge1);
 | 
					        logger.info("【保存资金流水记录】 获取到配置手续费==============handlingCharge=====================:"+handlingCharge1);
 | 
				
			||||||
 | 
					        if(handlingChargeType.equals(ServiceConstants.HANDLING_CHARGE_TYPE_PERCENT)){
 | 
				
			||||||
            BigDecimal bigDecimal = new BigDecimal(handlingCharge1).divide(new BigDecimal(1000), 6, BigDecimal.ROUND_HALF_UP);
 | 
					            BigDecimal bigDecimal = new BigDecimal(handlingCharge1).divide(new BigDecimal(1000), 6, BigDecimal.ROUND_HALF_UP);
 | 
				
			||||||
        logger.info("【保存资金流水记录】 转换后手续费==============bigDecimal=====================:"+bigDecimal);
 | 
					            logger.info("【保存资金流水记录】 按千分比--转换后手续费==============bigDecimal=====================:"+bigDecimal);
 | 
				
			||||||
        BigDecimal handlingCharge = bigDecimal.multiply(order.getPayFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
 | 
					            handlingCharge = bigDecimal.multiply(order.getPayFee()).setScale(2, BigDecimal.ROUND_HALF_UP);
 | 
				
			||||||
        logger.info("【保存资金流水记录】 计算出的手续费==============handlingCharge=====================:"+handlingCharge);
 | 
					            logger.info("【保存资金流水记录】 按千分比--计算出的手续费==============handlingCharge=====================:"+handlingCharge);
 | 
				
			||||||
 | 
					        }else{
 | 
				
			||||||
 | 
					            handlingCharge = new BigDecimal(handlingCharge1);
 | 
				
			||||||
 | 
					            logger.info("【保存资金流水记录】 按每笔--计算出的手续费==============handlingCharge=====================:"+handlingCharge);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        BigDecimal serviceFeeScale = new BigDecimal(sysDept.getPlatformServiceFee()).divide(new BigDecimal(100), 6, BigDecimal.ROUND_HALF_UP);
 | 
					        BigDecimal serviceFeeScale = new BigDecimal(sysDept.getPlatformServiceFee()).divide(new BigDecimal(100), 6, BigDecimal.ROUND_HALF_UP);
 | 
				
			||||||
        BigDecimal platformServiceFee = serviceFeeScale.multiply(order.getPayFee());
 | 
					        BigDecimal platformServiceFee = serviceFeeScale.multiply(order.getPayFee());
 | 
				
			||||||
        logger.info("【保存资金流水记录】 计算出的平台服务费==============platformServiceFee=====================:"+platformServiceFee);
 | 
					        logger.info("【保存资金流水记录】 计算出的平台服务费==============platformServiceFee=====================:"+platformServiceFee);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1490,7 +1490,7 @@ public class EtOrderServiceImpl implements IEtOrderService
 | 
				
			||||||
        etRefund.setRefundNo(outRefundNo);
 | 
					        etRefund.setRefundNo(outRefundNo);
 | 
				
			||||||
        etRefund.setType(type);
 | 
					        etRefund.setType(type);
 | 
				
			||||||
        if(type.equals(ServiceConstants.REFUND_TYPE_DEPOSIT)){
 | 
					        if(type.equals(ServiceConstants.REFUND_TYPE_DEPOSIT)){
 | 
				
			||||||
            etRefund.setItemDesc("押金自动退款");
 | 
					            etRefund.setItemDesc("押金退款");
 | 
				
			||||||
        }else{
 | 
					        }else{
 | 
				
			||||||
            StringBuilder itemDesc = new StringBuilder();
 | 
					            StringBuilder itemDesc = new StringBuilder();
 | 
				
			||||||
            if(ObjectUtil.isNotNull(appointmentFee) && !appointmentFee.equals(BigDecimal.ZERO)){
 | 
					            if(ObjectUtil.isNotNull(appointmentFee) && !appointmentFee.equals(BigDecimal.ZERO)){
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,6 +3,9 @@ package com.ruoyi.system.service.impl;
 | 
				
			||||||
import cn.hutool.core.util.ObjectUtil;
 | 
					import cn.hutool.core.util.ObjectUtil;
 | 
				
			||||||
import cn.hutool.core.util.StrUtil;
 | 
					import cn.hutool.core.util.StrUtil;
 | 
				
			||||||
import com.alibaba.fastjson2.JSON;
 | 
					import com.alibaba.fastjson2.JSON;
 | 
				
			||||||
 | 
					import com.alibaba.fastjson2.JSONObject;
 | 
				
			||||||
 | 
					import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
 | 
				
			||||||
 | 
					import com.aliyuncs.exceptions.ClientException;
 | 
				
			||||||
import com.ruoyi.common.annotation.DataScope;
 | 
					import com.ruoyi.common.annotation.DataScope;
 | 
				
			||||||
import com.ruoyi.common.constant.ServiceConstants;
 | 
					import com.ruoyi.common.constant.ServiceConstants;
 | 
				
			||||||
import com.ruoyi.common.constant.UserConstants;
 | 
					import com.ruoyi.common.constant.UserConstants;
 | 
				
			||||||
| 
						 | 
					@ -13,15 +16,10 @@ import com.ruoyi.common.core.domain.entity.SysRole;
 | 
				
			||||||
import com.ruoyi.common.core.domain.entity.SysUser;
 | 
					import com.ruoyi.common.core.domain.entity.SysUser;
 | 
				
			||||||
import com.ruoyi.common.core.text.Convert;
 | 
					import com.ruoyi.common.core.text.Convert;
 | 
				
			||||||
import com.ruoyi.common.exception.ServiceException;
 | 
					import com.ruoyi.common.exception.ServiceException;
 | 
				
			||||||
import com.ruoyi.common.utils.DateUtils;
 | 
					import com.ruoyi.common.utils.*;
 | 
				
			||||||
import com.ruoyi.common.utils.SecurityUtils;
 | 
					 | 
				
			||||||
import com.ruoyi.common.utils.StringUtils;
 | 
					 | 
				
			||||||
import com.ruoyi.common.utils.spring.SpringUtils;
 | 
					import com.ruoyi.common.utils.spring.SpringUtils;
 | 
				
			||||||
import com.ruoyi.common.utils.uuid.IdUtils;
 | 
					import com.ruoyi.common.utils.uuid.IdUtils;
 | 
				
			||||||
import com.ruoyi.system.domain.EtAreaDept;
 | 
					import com.ruoyi.system.domain.*;
 | 
				
			||||||
import com.ruoyi.system.domain.EtCapitalFlow;
 | 
					 | 
				
			||||||
import com.ruoyi.system.domain.EtOrder;
 | 
					 | 
				
			||||||
import com.ruoyi.system.domain.SysUserRole;
 | 
					 | 
				
			||||||
import com.ruoyi.system.mapper.*;
 | 
					import com.ruoyi.system.mapper.*;
 | 
				
			||||||
import com.ruoyi.system.service.*;
 | 
					import com.ruoyi.system.service.*;
 | 
				
			||||||
import com.wechat.pay.java.service.profitsharing.model.AddReceiverResponse;
 | 
					import com.wechat.pay.java.service.profitsharing.model.AddReceiverResponse;
 | 
				
			||||||
| 
						 | 
					@ -29,6 +27,7 @@ import com.wechat.pay.java.service.profitsharing.model.DeleteReceiverResponse;
 | 
				
			||||||
import com.wechat.pay.java.service.transferbatch.model.TransferDetailInput;
 | 
					import com.wechat.pay.java.service.transferbatch.model.TransferDetailInput;
 | 
				
			||||||
import lombok.extern.slf4j.Slf4j;
 | 
					import lombok.extern.slf4j.Slf4j;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
 | 
					import org.springframework.beans.factory.annotation.Value;
 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
import org.springframework.transaction.annotation.Transactional;
 | 
					import org.springframework.transaction.annotation.Transactional;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,6 +36,8 @@ import java.math.BigDecimal;
 | 
				
			||||||
import java.util.ArrayList;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
import java.util.Iterator;
 | 
					import java.util.Iterator;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.concurrent.ScheduledExecutorService;
 | 
				
			||||||
 | 
					import java.util.concurrent.TimeUnit;
 | 
				
			||||||
import java.util.stream.Collectors;
 | 
					import java.util.stream.Collectors;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
| 
						 | 
					@ -81,6 +82,30 @@ public class SysDeptServiceImpl implements ISysDeptService
 | 
				
			||||||
    @Resource
 | 
					    @Resource
 | 
				
			||||||
    private EtCapitalFlowMapper etCapitalFlowMapper;
 | 
					    private EtCapitalFlowMapper etCapitalFlowMapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Resource
 | 
				
			||||||
 | 
					    private AsUserMapper asUserMapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Autowired
 | 
				
			||||||
 | 
					    private ScheduledExecutorService scheduledExecutorService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Value("${aliyun.accessKeyId}")
 | 
				
			||||||
 | 
					    private String accessKeyId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Value("${aliyun.accessKeySecret}")
 | 
				
			||||||
 | 
					    private String accessKeySecret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Value("${aliyun.signName}")
 | 
				
			||||||
 | 
					    private String signName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Value("${aliyun.templateCode}")
 | 
				
			||||||
 | 
					    private String templateCode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Value("${aliyun.phone}")
 | 
				
			||||||
 | 
					    private String phone;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Resource
 | 
				
			||||||
 | 
					    private EtMsgLogMapper etMsgLogMapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 查询部门管理数据
 | 
					     * 查询部门管理数据
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
| 
						 | 
					@ -500,10 +525,48 @@ public class SysDeptServiceImpl implements ISysDeptService
 | 
				
			||||||
            throw new ServiceException("【提现】提现失败,该运营商id:"+sysDept.getDeptId()+"下未找到该运营区");
 | 
					            throw new ServiceException("【提现】提现失败,该运营商id:"+sysDept.getDeptId()+"下未找到该运营区");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        order.setAreaId(longs.get(0));
 | 
					        order.setAreaId(longs.get(0));
 | 
				
			||||||
 | 
					        // 发短信
 | 
				
			||||||
 | 
					        asynchronousMsg(sysDept.getDeptName());
 | 
				
			||||||
        //记录资金流水
 | 
					        //记录资金流水
 | 
				
			||||||
        return callbackService.capitalFlowRecords2(order,ServiceConstants.FLOW_TYPE_DISBURSE,ServiceConstants.ORDER_TYPE_WITHDRAW,ServiceConstants.OWNER_TYPE_OPERATOR,sysDept);
 | 
					        return callbackService.capitalFlowRecords2(order,ServiceConstants.FLOW_TYPE_DISBURSE,ServiceConstants.ORDER_TYPE_WITHDRAW,ServiceConstants.OWNER_TYPE_OPERATOR,sysDept);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private void asynchronousMsg(String deptName) {
 | 
				
			||||||
 | 
					        scheduledExecutorService.schedule(() -> {
 | 
				
			||||||
 | 
					            /** 提现申请发送一个短信给丁建帮*/
 | 
				
			||||||
 | 
					            JSONObject jsonObject = new JSONObject();
 | 
				
			||||||
 | 
					            jsonObject.put("name", deptName);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            SendSmsVo sendSmsVo = new SendSmsVo();
 | 
				
			||||||
 | 
					            sendSmsVo.setMobile(phone);
 | 
				
			||||||
 | 
					            sendSmsVo.setTemplateCode(templateCode);
 | 
				
			||||||
 | 
					            sendSmsVo.setParam(jsonObject.toJSONString());
 | 
				
			||||||
 | 
					            sendSmsVo.setSignName(signName);
 | 
				
			||||||
 | 
					            SendSmsResponse response = null;
 | 
				
			||||||
 | 
					            log.info("【提现申请】向阿里云发送短信,请求,----------【{}】", JSON.toJSONString(sendSmsVo));
 | 
				
			||||||
 | 
					            try {
 | 
				
			||||||
 | 
					                response = SendAliSmsUtil.sendVerifyCode(accessKeyId,accessKeySecret,sendSmsVo);
 | 
				
			||||||
 | 
					            } catch (ClientException e) {
 | 
				
			||||||
 | 
					                e.printStackTrace();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            log.info("【提现申请】发送阿里云短信成功,返回----------【{}】",JSON.toJSONString(response));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // 短信日志
 | 
				
			||||||
 | 
					            EtMsgLog etMsgLog = new EtMsgLog();
 | 
				
			||||||
 | 
					            etMsgLog.setPhone(phone);
 | 
				
			||||||
 | 
					            etMsgLog.setContent("运营商【"+deptName+"】有一笔提现申请,请注意查收!");
 | 
				
			||||||
 | 
					            etMsgLog.setType("2");
 | 
				
			||||||
 | 
					            etMsgLog.setSignName(signName);
 | 
				
			||||||
 | 
					            etMsgLog.setTemplateCode(templateCode);
 | 
				
			||||||
 | 
					            int i = etMsgLogMapper.insertEtMsgLog(etMsgLog);
 | 
				
			||||||
 | 
					            if(i>0){
 | 
				
			||||||
 | 
					                log.info("【提现申请】短信日志记录成功");
 | 
				
			||||||
 | 
					            }else{
 | 
				
			||||||
 | 
					                log.info("【提现申请】短信日志记录失败");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }, 0 , TimeUnit.HOURS);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 管理员提现失败
 | 
					     * 管理员提现失败
 | 
				
			||||||
     *  1. 生成一条相同的金额
 | 
					     *  1. 生成一条相同的金额
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -445,10 +445,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
				
			||||||
            <if test="sn != null  and sn != ''"> and sn = #{sn}</if>
 | 
					            <if test="sn != null  and sn != ''"> and sn = #{sn}</if>
 | 
				
			||||||
            <if test="areaId != null"> and area_id = #{areaId}</if>
 | 
					            <if test="areaId != null"> and area_id = #{areaId}</if>
 | 
				
			||||||
            <if test="startDateStr != null  and startDateStr != ''">
 | 
					            <if test="startDateStr != null  and startDateStr != ''">
 | 
				
			||||||
              AND date_format(create_time,'%y%m%d') >= date_format(#{startDateStr},'%y%m%d')
 | 
					              AND date_format(pay_time,'%y%m%d') >= date_format(#{startDateStr},'%y%m%d')
 | 
				
			||||||
            </if>
 | 
					            </if>
 | 
				
			||||||
            <if test="endDateStr != null  and endDateStr != ''">
 | 
					            <if test="endDateStr != null  and endDateStr != ''">
 | 
				
			||||||
                AND date_format(create_time,'%y%m%d') <= date_format(#{endDateStr},'%y%m%d')
 | 
					                AND date_format(pay_time,'%y%m%d') <= date_format(#{endDateStr},'%y%m%d')
 | 
				
			||||||
            </if>
 | 
					            </if>
 | 
				
			||||||
            AND status = 4 and type = 1 and paid = 1
 | 
					            AND status = 4 and type = 1 and paid = 1
 | 
				
			||||||
        </where>
 | 
					        </where>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -33,6 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
				
			||||||
		<result property="merchantSerialNumber" column="merchant_serial_number" />
 | 
							<result property="merchantSerialNumber" column="merchant_serial_number" />
 | 
				
			||||||
		<result property="refundNotifyUrl" column="refund_notify_url" />
 | 
							<result property="refundNotifyUrl" column="refund_notify_url" />
 | 
				
			||||||
		<result property="appUserId" column="app_user_id" />
 | 
							<result property="appUserId" column="app_user_id" />
 | 
				
			||||||
 | 
							<result property="handlingChargeType" column="handling_charge_type" />
 | 
				
			||||||
		<result property="createBy"   column="create_by"   />
 | 
							<result property="createBy"   column="create_by"   />
 | 
				
			||||||
		<result property="createTime" column="create_time" />
 | 
							<result property="createTime" column="create_time" />
 | 
				
			||||||
		<result property="updateBy"   column="update_by"   />
 | 
							<result property="updateBy"   column="update_by"   />
 | 
				
			||||||
| 
						 | 
					@ -43,7 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
				
			||||||
        select d.dept_id, d.parent_id, d.ancestors, d.dept_name,
 | 
					        select d.dept_id, d.parent_id, d.ancestors, d.dept_name,
 | 
				
			||||||
               d.order_num, d.leader, d.phone, d.email, d.status,
 | 
					               d.order_num, d.leader, d.phone, d.email, d.status,
 | 
				
			||||||
               d.del_flag,d.platform_service_fee, d.handling_charge, d.is_profit_sharing, d.separate_account, d.domain, d.is_use_platform_app, d.appid, d.app_name, d.balance, d.app_secret,
 | 
					               d.del_flag,d.platform_service_fee, d.handling_charge, d.is_profit_sharing, d.separate_account, d.domain, d.is_use_platform_app, d.appid, d.app_name, d.balance, d.app_secret,
 | 
				
			||||||
               d.merchant_id, d.api_v3_key, d.notify_url, d.private_key_path,d.merchant_serial_number,d.refund_notify_url, d.app_user_id,
 | 
					               d.merchant_id, d.api_v3_key, d.notify_url, d.private_key_path,d.merchant_serial_number,d.refund_notify_url, d.app_user_id, d.handling_charge_type,
 | 
				
			||||||
               d.create_by, d.create_time
 | 
					               d.create_by, d.create_time
 | 
				
			||||||
        from sys_dept d
 | 
					        from sys_dept d
 | 
				
			||||||
    </sql>
 | 
					    </sql>
 | 
				
			||||||
| 
						 | 
					@ -52,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
				
			||||||
		SELECT d.dept_id, d.parent_id, d.ancestors, d.dept_name,
 | 
							SELECT d.dept_id, d.parent_id, d.ancestors, d.dept_name,
 | 
				
			||||||
		d.order_num, d.leader, d.phone, d.email, d.status,
 | 
							d.order_num, d.leader, d.phone, d.email, d.status,
 | 
				
			||||||
		d.del_flag, d.platform_service_fee, d.handling_charge, d.is_profit_sharing, d.separate_account, d.domain, d.is_use_platform_app, d.appid, d.app_name, d.balance, d.app_secret,
 | 
							d.del_flag, d.platform_service_fee, d.handling_charge, d.is_profit_sharing, d.separate_account, d.domain, d.is_use_platform_app, d.appid, d.app_name, d.balance, d.app_secret,
 | 
				
			||||||
		d.merchant_id, d.api_v3_key, d.notify_url, d.private_key_path, d.merchant_serial_number, d.refund_notify_url, d.app_user_id,
 | 
							d.merchant_id, d.api_v3_key, d.notify_url, d.private_key_path, d.merchant_serial_number, d.refund_notify_url, d.app_user_id,d.handling_charge_type,
 | 
				
			||||||
		u.user_name AS userName,
 | 
							u.user_name AS userName,
 | 
				
			||||||
		GROUP_CONCAT(oa.area_name SEPARATOR ' | ') AS areaName,
 | 
							GROUP_CONCAT(oa.area_name SEPARATOR ' | ') AS areaName,
 | 
				
			||||||
		d.create_by, d.create_time
 | 
							d.create_by, d.create_time
 | 
				
			||||||
| 
						 | 
					@ -99,7 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
				
			||||||
    <select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
 | 
					    <select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
 | 
				
			||||||
		select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,d.platform_service_fee, d.handling_charge,
 | 
							select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,d.platform_service_fee, d.handling_charge,
 | 
				
			||||||
		       d.is_profit_sharing,d.domain,d.is_use_platform_app, d.appid, d.app_name, d.balance, d.app_secret,d.balance,d.separate_account,
 | 
							       d.is_profit_sharing,d.domain,d.is_use_platform_app, d.appid, d.app_name, d.balance, d.app_secret,d.balance,d.separate_account,
 | 
				
			||||||
			   d.merchant_id, d.api_v3_key, d.notify_url, d.private_key_path,d.merchant_serial_number,d.refund_notify_url,d.app_user_id,
 | 
								   d.merchant_id, d.api_v3_key, d.notify_url, d.private_key_path,d.merchant_serial_number,d.refund_notify_url,d.app_user_id,d.handling_charge_type,
 | 
				
			||||||
			(select dept_name from sys_dept where dept_id = d.parent_id) parent_name
 | 
								(select dept_name from sys_dept where dept_id = d.parent_id) parent_name
 | 
				
			||||||
		from sys_dept d
 | 
							from sys_dept d
 | 
				
			||||||
		where d.dept_id = #{deptId}
 | 
							where d.dept_id = #{deptId}
 | 
				
			||||||
| 
						 | 
					@ -108,7 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
				
			||||||
	<select id="selectDeptByAppUserId" parameterType="Long" resultMap="SysDeptResult">
 | 
						<select id="selectDeptByAppUserId" parameterType="Long" resultMap="SysDeptResult">
 | 
				
			||||||
		select d.dept_id, d.parent_id, d.app_user_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,d.platform_service_fee, d.handling_charge,
 | 
							select d.dept_id, d.parent_id, d.app_user_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,d.platform_service_fee, d.handling_charge,
 | 
				
			||||||
			   d.is_profit_sharing,d.domain,d.is_use_platform_app, d.appid, d.app_name, d.balance, d.app_secret,d.balance,d.separate_account,
 | 
								   d.is_profit_sharing,d.domain,d.is_use_platform_app, d.appid, d.app_name, d.balance, d.app_secret,d.balance,d.separate_account,
 | 
				
			||||||
			   d.merchant_id, d.api_v3_key, d.notify_url, d.private_key_path,d.merchant_serial_number,d.refund_notify_url,d.app_user_id,
 | 
								   d.merchant_id, d.api_v3_key, d.notify_url, d.private_key_path,d.merchant_serial_number,d.refund_notify_url,d.app_user_id,d.handling_charge_type,
 | 
				
			||||||
			   (select dept_name from sys_dept where dept_id = d.parent_id) parent_name
 | 
								   (select dept_name from sys_dept where dept_id = d.parent_id) parent_name
 | 
				
			||||||
		from sys_dept d
 | 
							from sys_dept d
 | 
				
			||||||
		where d.app_user_id = #{appUserId}
 | 
							where d.app_user_id = #{appUserId}
 | 
				
			||||||
| 
						 | 
					@ -169,6 +170,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
				
			||||||
 			<if test="merchantSerialNumber != null and merchantSerialNumber != ''">merchant_serial_number,</if>
 | 
					 			<if test="merchantSerialNumber != null and merchantSerialNumber != ''">merchant_serial_number,</if>
 | 
				
			||||||
 			<if test="refundNotifyUrl != null and refundNotifyUrl != ''">refund_notify_url,</if>
 | 
					 			<if test="refundNotifyUrl != null and refundNotifyUrl != ''">refund_notify_url,</if>
 | 
				
			||||||
		    <if test="appUserId != null and appUserId != ''">app_user_id,</if>
 | 
							    <if test="appUserId != null and appUserId != ''">app_user_id,</if>
 | 
				
			||||||
 | 
							    <if test="handlingChargeType != null and handlingChargeType != ''">handling_charge_type,,</if>
 | 
				
			||||||
 			create_time
 | 
					 			create_time
 | 
				
			||||||
 		)values(
 | 
					 		)values(
 | 
				
			||||||
 			<if test="deptId != null and deptId != 0">#{deptId},</if>
 | 
					 			<if test="deptId != null and deptId != 0">#{deptId},</if>
 | 
				
			||||||
| 
						 | 
					@ -184,6 +186,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
				
			||||||
 			<if test="platformServiceFee != null and platformServiceFee != ''">#{platformServiceFee},</if>
 | 
					 			<if test="platformServiceFee != null and platformServiceFee != ''">#{platformServiceFee},</if>
 | 
				
			||||||
 			<if test="handlingCharge != null and handlingCharge != ''">#{handlingCharge},</if>
 | 
					 			<if test="handlingCharge != null and handlingCharge != ''">#{handlingCharge},</if>
 | 
				
			||||||
 			<if test="isProfitSharing != null and isProfitSharing != ''">#{isProfitSharing},</if>
 | 
					 			<if test="isProfitSharing != null and isProfitSharing != ''">#{isProfitSharing},</if>
 | 
				
			||||||
 | 
					 			<if test="separateAccount != null and separateAccount != ''">#{separateAccount},</if>
 | 
				
			||||||
 			<if test="isUsePlatformApp != null and isUsePlatformApp != ''">#{isUsePlatformApp},</if>
 | 
					 			<if test="isUsePlatformApp != null and isUsePlatformApp != ''">#{isUsePlatformApp},</if>
 | 
				
			||||||
 			<if test="domain != null and domain != ''">#{domain},</if>
 | 
					 			<if test="domain != null and domain != ''">#{domain},</if>
 | 
				
			||||||
 			<if test="appid != null and appid != ''">#{appid},</if>
 | 
					 			<if test="appid != null and appid != ''">#{appid},</if>
 | 
				
			||||||
| 
						 | 
					@ -196,6 +199,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
				
			||||||
 			<if test="merchantSerialNumber != null and merchantSerialNumber != ''">#{merchantSerialNumber},</if>
 | 
					 			<if test="merchantSerialNumber != null and merchantSerialNumber != ''">#{merchantSerialNumber},</if>
 | 
				
			||||||
 			<if test="refundNotifyUrl != null and refundNotifyUrl != ''">#{refundNotifyUrl},</if>
 | 
					 			<if test="refundNotifyUrl != null and refundNotifyUrl != ''">#{refundNotifyUrl},</if>
 | 
				
			||||||
		    <if test="appUserId != null and appUserId != ''">#{appUserId},</if>
 | 
							    <if test="appUserId != null and appUserId != ''">#{appUserId},</if>
 | 
				
			||||||
 | 
							    <if test="handlingChargeType != null and handlingChargeType != ''">#{handlingChargeType},</if>
 | 
				
			||||||
 			sysdate()
 | 
					 			sysdate()
 | 
				
			||||||
 		)
 | 
					 		)
 | 
				
			||||||
	</insert>
 | 
						</insert>
 | 
				
			||||||
| 
						 | 
					@ -228,6 +232,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
				
			||||||
 			<if test="merchantSerialNumber != null and merchantSerialNumber != ''">merchant_serial_number = #{merchantSerialNumber},</if>
 | 
					 			<if test="merchantSerialNumber != null and merchantSerialNumber != ''">merchant_serial_number = #{merchantSerialNumber},</if>
 | 
				
			||||||
 			<if test="refundNotifyUrl != null and refundNotifyUrl != ''">refund_notify_url = #{refundNotifyUrl},</if>
 | 
					 			<if test="refundNotifyUrl != null and refundNotifyUrl != ''">refund_notify_url = #{refundNotifyUrl},</if>
 | 
				
			||||||
			<if test="appUserId != null">app_user_id = #{appUserId},</if>
 | 
								<if test="appUserId != null">app_user_id = #{appUserId},</if>
 | 
				
			||||||
 | 
								<if test="handlingChargeType != null">handling_charge_type = #{handlingChargeType},</if>
 | 
				
			||||||
 			update_time = sysdate()
 | 
					 			update_time = sysdate()
 | 
				
			||||||
 		</set>
 | 
					 		</set>
 | 
				
			||||||
 		where dept_id = #{deptId}
 | 
					 		where dept_id = #{deptId}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user