对账更新
This commit is contained in:
parent
f85f168766
commit
fa9ebdc484
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.common.auth.ali;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
|
@ -10,6 +11,12 @@ import org.springframework.stereotype.Service;
|
|||
@Service
|
||||
public class AliAuthService {
|
||||
|
||||
@Autowired
|
||||
private AliConfig aliConfig;
|
||||
|
||||
|
||||
public String getOpenId(String loginCode) {
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,17 +16,18 @@ import org.springframework.stereotype.Component;
|
|||
@Data
|
||||
public class AliConfig {
|
||||
|
||||
// @Value("${ali.appId}")
|
||||
// private String appId;
|
||||
//
|
||||
// @Value("${ali.privateKey}")
|
||||
// private String privateKey;
|
||||
//
|
||||
// @Bean
|
||||
// public AlipayConfig alipayConfig() {
|
||||
// AlipayConfig config = new AlipayConfig();
|
||||
// config.setAppId(appId);
|
||||
// config.setPrivateKey(privateKey);
|
||||
// return config;
|
||||
// }
|
||||
@Value("${ali.appId}")
|
||||
private String appId;
|
||||
|
||||
@Value("${ali.privateKey}")
|
||||
private String privateKey;
|
||||
|
||||
@Bean
|
||||
public AlipayConfig alipayConfig() {
|
||||
AlipayConfig config = new AlipayConfig();
|
||||
config.setAppId(appId);
|
||||
config.setPrivateKey(privateKey);
|
||||
|
||||
return config;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,18 @@ public class WxAuthService {
|
|||
return JSON.parseObject(body, WxMaJscode2SessionResult.class);
|
||||
}
|
||||
|
||||
public String getOpenId(String loginCode) {
|
||||
if (loginCode == null) {
|
||||
return null;
|
||||
}
|
||||
// 通过登录授权码获取到用户信息
|
||||
WxMaJscode2SessionResult wxMaJscode2SessionResult = this.wxJsCode2Session(loginCode);
|
||||
if (wxMaJscode2SessionResult == null) {
|
||||
return null;
|
||||
}
|
||||
return wxMaJscode2SessionResult.getOpenid();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过微信手机号授权码获取微信手机号
|
||||
* @param mobileCode 微信手机号授权码
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package com.ruoyi.common.core.domain.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 微信登录body
|
||||
* @author 辉
|
||||
* 2024/3/8
|
||||
*/
|
||||
@Data
|
||||
@ApiModel
|
||||
public class AliLoginBody {
|
||||
|
||||
// @ApiModelProperty("用于获取手机号的授权码,首次登录必填")
|
||||
// private String mobileCode;
|
||||
|
||||
@NotBlank(message = "登录授权码不允许为空")
|
||||
@ApiModelProperty("my.getAuthCode获取的登录授权码,用于获取openId,必填")
|
||||
private String loginCode;
|
||||
}
|
|
@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
|
|||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
|
@ -18,7 +19,7 @@ public class WxLoginBody {
|
|||
@ApiModelProperty("用于获取手机号的授权码,首次登录必填")
|
||||
private String mobileCode;
|
||||
|
||||
@NotNull(message = "登录授权码不允许为空")
|
||||
@NotBlank(message = "登录授权码不允许为空")
|
||||
@ApiModelProperty("wx.login获取的登录授权码,用于获取openId,必填")
|
||||
private String loginCode;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import javax.annotation.Resource;
|
|||
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.ruoyi.common.auth.ali.AliAuthService;
|
||||
import com.ruoyi.common.core.domain.entity.SmUser;
|
||||
import com.ruoyi.common.core.domain.model.WxLoginBody;
|
||||
import com.ruoyi.common.enums.UserStatus;
|
||||
|
@ -15,6 +16,7 @@ import com.ruoyi.common.auth.wx.AccessTokenUtil;
|
|||
import com.ruoyi.common.auth.wx.WxAuthService;
|
||||
import com.ruoyi.ss.account.domain.Account;
|
||||
import com.ruoyi.ss.store.service.StoreService;
|
||||
import com.ruoyi.ss.user.domain.SmUserVO;
|
||||
import com.ruoyi.ss.user.service.ISmUserService;
|
||||
import com.ruoyi.ss.account.service.AccountService;
|
||||
import com.ruoyi.ss.account.domain.enums.AccountType;
|
||||
|
@ -91,6 +93,9 @@ public class SysLoginService
|
|||
@Autowired
|
||||
private ISysConfigService sysConfigService;
|
||||
|
||||
@Autowired
|
||||
private AliAuthService aliAuthService;
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
*
|
||||
|
@ -263,7 +268,7 @@ public class SysLoginService
|
|||
public String wxLogin(WxLoginBody body) {
|
||||
|
||||
// 通过openId查询用户
|
||||
String openId = this.getWxOpenId(body.getLoginCode());
|
||||
String openId = wxAuthService.getOpenId(body.getLoginCode());
|
||||
ServiceUtil.assertion(openId == null, "获取微信openId失败");
|
||||
SmUser user = smUserService.selectSmUserByWxOpenId(openId);
|
||||
|
||||
|
@ -307,7 +312,7 @@ public class SysLoginService
|
|||
* 注册微信用户
|
||||
* @param openId 微信OpenId
|
||||
*/
|
||||
private SmUser registerWx(String openId, String mobile) {
|
||||
private SmUserVO registerWx(String openId, String mobile) {
|
||||
if (StringUtils.isBlank(openId)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -315,7 +320,7 @@ public class SysLoginService
|
|||
String name = "微信" + openId.substring(openId.length() - 4);
|
||||
|
||||
// 添加用户
|
||||
SmUser newUser = new SmUser();
|
||||
SmUserVO newUser = new SmUserVO();
|
||||
newUser.setUserName(name);
|
||||
newUser.setWxOpenId(openId);
|
||||
newUser.setPhonenumber(mobile);
|
||||
|
@ -339,15 +344,47 @@ public class SysLoginService
|
|||
return this.appLogin(username, password);
|
||||
}
|
||||
|
||||
public String getWxOpenId(String loginCode) {
|
||||
if (loginCode == null) {
|
||||
return null;
|
||||
public String aliLogin(WxLoginBody body) {
|
||||
// 通过支付宝openId查询用户
|
||||
String openId = aliAuthService.getOpenId(body.getLoginCode());
|
||||
ServiceUtil.assertion(openId == null, "获取支付宝openId失败");
|
||||
|
||||
SmUserVO user = smUserService.selectSmUserByAliOpenId(openId);
|
||||
|
||||
// 若用户不存在,则使用openId进行注册
|
||||
if (user == null || Objects.equals(user.getDelFlag(), UserStatus.DELETED.getCode())) {
|
||||
// 获取手机号
|
||||
boolean loginWithPhone = sysConfigService.getBoolean(ConfigKey.ARRIVAL_DELAY);
|
||||
String mobile = null;
|
||||
if (loginWithPhone && StringUtils.hasText(body.getMobileCode())) {
|
||||
mobile = wxAuthService.getWxPhoneNumber(body.getMobileCode());
|
||||
}
|
||||
// 用户注册
|
||||
user = registerWx(openId, mobile);
|
||||
}
|
||||
// 通过登录授权码获取到用户信息
|
||||
WxMaJscode2SessionResult wxMaJscode2SessionResult = wxAuthService.wxJsCode2Session(loginCode);
|
||||
if (wxMaJscode2SessionResult == null) {
|
||||
return null;
|
||||
ServiceUtil.assertion(user == null, "用户不存在");
|
||||
|
||||
Authentication authentication = null;
|
||||
try {
|
||||
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(user.getUserId(), Constants.CUSTOM_LOGIN_WX);
|
||||
// 用户名和密码等信息保存在一个上下文中,只要是同一线程等会就能拿到用户名和密码,也就是能在loadUserByUsername(String username)方法中进行密码验证等
|
||||
AuthenticationContextHolder.setContext(authenticationToken);
|
||||
// 把用户登录类型放在上下文中的details属性中,在UserDetailsServiceImpl.loadUserByUsername中获取
|
||||
authenticationToken.setDetails(Constants.USER_TYPE_WX);
|
||||
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
|
||||
authentication = authenticationManager.authenticate(authenticationToken);
|
||||
}
|
||||
return wxMaJscode2SessionResult.getOpenid();
|
||||
catch (Exception e) {
|
||||
if (e instanceof BadCredentialsException) {
|
||||
throw new UserPasswordNotMatchException(); //抛出账号或者密码错误的异常
|
||||
} else {
|
||||
throw new ServiceException(e.getMessage()); //抛出其他异常
|
||||
}
|
||||
} finally {
|
||||
AuthenticationContextHolder.clearContext();
|
||||
}
|
||||
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
|
||||
return tokenService.createToken(loginUser);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package com.ruoyi.dashboard.domain.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2024/12/3
|
||||
*/
|
||||
@Data
|
||||
public class BillDailyAmountQuery {
|
||||
|
||||
@ApiModelProperty("日期(起始)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate dateStart;
|
||||
|
||||
@ApiModelProperty("日期(结束)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate dateEnd;
|
||||
}
|
|
@ -2,7 +2,9 @@ package com.ruoyi.ss.payBill.domain;
|
|||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -30,4 +32,12 @@ public class PayBillQuery extends PayBill{
|
|||
|
||||
@ApiModelProperty("支付订单ID列表")
|
||||
private List<Long> payIds;
|
||||
|
||||
@ApiModelProperty("支付日期(开始)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate payDateStart;
|
||||
|
||||
@ApiModelProperty("支付日期(结束)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate payDateEnd;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package com.ruoyi.ss.payBill.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2024/12/2
|
||||
*/
|
||||
@Data
|
||||
public class PayDailyAmountVO {
|
||||
|
||||
@ApiModelProperty("日期")
|
||||
private LocalDate date;
|
||||
|
||||
@ApiModelProperty("总金额")
|
||||
private BigDecimal total;
|
||||
|
||||
@ApiModelProperty("退款总金额")
|
||||
private BigDecimal refund;
|
||||
|
||||
@ApiModelProperty("总实收金额")
|
||||
private BigDecimal received;
|
||||
|
||||
}
|
|
@ -1,8 +1,10 @@
|
|||
package com.ruoyi.ss.payBill.mapper;
|
||||
|
||||
import com.ruoyi.common.domain.vo.LocalDateDecimalVO;
|
||||
import com.ruoyi.ss.payBill.domain.PayBill;
|
||||
import com.ruoyi.ss.payBill.domain.PayBillQuery;
|
||||
import com.ruoyi.ss.payBill.domain.PayBillVO;
|
||||
import com.ruoyi.ss.payBill.domain.vo.PayDailyAmountVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
@ -91,4 +93,9 @@ public interface PayBillMapper
|
|||
* 记录(转移)已退款金额
|
||||
*/
|
||||
int recordRefundAmount(@Param("payId") Long payId, @Param("amount") BigDecimal amount);
|
||||
|
||||
/**
|
||||
* 按日查询支付单金额
|
||||
*/
|
||||
List<LocalDateDecimalVO> selectDailyAmount(@Param("query") PayBillQuery query);
|
||||
}
|
||||
|
|
|
@ -37,6 +37,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="query.status != null and query.status != ''"> and spb.status = #{query.status}</if>
|
||||
<if test="query.startCreateTime != null">and spb.create_time >= #{query.startCreateTime}</if>
|
||||
<if test="query.endCreateTime != null">and spb.create_time <= #{query.endCreateTime}</if>
|
||||
<if test="query.payDateStart != null">and date(spb.pay_time) >= date(#{query.payDateStart})</if>
|
||||
<if test="query.payDateEnd != null">and date(spb.pay_time) <= date(#{query.payDateEnd})</if>
|
||||
<if test="query.statusList != null and query.statusList.size() > 0">
|
||||
and spb.status in
|
||||
<foreach item="item" index="index" collection="query.statusList" open="(" separator="," close=")">
|
||||
|
@ -79,6 +81,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where spb.pay_no = #{payNo}
|
||||
</select>
|
||||
|
||||
|
||||
<resultMap id="LocalDateDecimalVO" type="LocalDateDecimalVO" autoMapping="true">
|
||||
<result property="value" column="value" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler"/>
|
||||
</resultMap>
|
||||
<select id="selectDailyAmount" resultMap="LocalDateDecimalVO">
|
||||
select
|
||||
date(spb.pay_time) as `key`,
|
||||
sum(spb.amount) as `value`
|
||||
from ss_pay_bill spb
|
||||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
group by `key`
|
||||
</select>
|
||||
|
||||
<insert id="insertPayBill" parameterType="PayBill" useGeneratedKeys="true" keyProperty="payId">
|
||||
insert into ss_pay_bill
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.ss.payBill.service;
|
||||
|
||||
import com.ruoyi.common.domain.vo.LocalDateDecimalVO;
|
||||
import com.ruoyi.ss.payBill.domain.PayBill;
|
||||
import com.ruoyi.ss.payBill.domain.PayBillQuery;
|
||||
import com.ruoyi.ss.payBill.domain.PayBillVO;
|
||||
|
@ -139,4 +140,9 @@ public interface PayBillService
|
|||
* 查询支付结果
|
||||
*/
|
||||
PayResultVO getPayResult(String payNo);
|
||||
|
||||
/**
|
||||
* 按日查询支付金额
|
||||
*/
|
||||
List<LocalDateDecimalVO> selectDailyAmount(PayBillQuery query);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.ruoyi.ss.payBill.service.impl;
|
|||
|
||||
import com.ruoyi.common.core.redis.RedisLock;
|
||||
import com.ruoyi.common.core.redis.enums.RedisLockKey;
|
||||
import com.ruoyi.common.domain.vo.LocalDateDecimalVO;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.pay.syb.enums.SybTrxStatus;
|
||||
import com.ruoyi.common.pay.syb.service.SybPayService;
|
||||
|
@ -495,6 +496,11 @@ public class PayBillServiceImpl implements PayBillService
|
|||
return getPayResult(bill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LocalDateDecimalVO> selectDailyAmount(PayBillQuery query) {
|
||||
return payBillMapper.selectDailyAmount(query);
|
||||
}
|
||||
|
||||
private boolean closeById(Long payId) {
|
||||
if (payId == null) {
|
||||
return false;
|
||||
|
|
|
@ -2,6 +2,10 @@ package com.ruoyi.ss.refund.domain;
|
|||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
|
@ -13,4 +17,14 @@ public class RefundQuery extends Refund {
|
|||
@ApiModelProperty("订单收款人ID")
|
||||
private Long billMchId;
|
||||
|
||||
@ApiModelProperty("创建日期(起始)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate createDateStart;
|
||||
|
||||
@ApiModelProperty("创建日期(结束)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate createDateEnd;
|
||||
|
||||
@ApiModelProperty("状态列表")
|
||||
private List<String> statusList;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package com.ruoyi.ss.refund.domain.enums;
|
||||
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2024/7/9
|
||||
|
@ -18,4 +21,12 @@ public enum RefundStatus {
|
|||
private final String status;
|
||||
private final String desc;
|
||||
|
||||
public static List<String> asList(RefundStatus ...statuses) {
|
||||
return CollectionUtils.map( RefundStatus::getStatus, statuses);
|
||||
}
|
||||
|
||||
public static List<String> successList() {
|
||||
return asList(REFUND_SUCCESS, REFUNDING);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.ss.refund.mapper;
|
||||
|
||||
import com.ruoyi.common.domain.vo.LocalDateDecimalVO;
|
||||
import com.ruoyi.ss.refund.domain.Refund;
|
||||
import com.ruoyi.ss.refund.domain.RefundQuery;
|
||||
import com.ruoyi.ss.refund.domain.RefundVO;
|
||||
|
@ -69,4 +70,9 @@ public interface RefundMapper
|
|||
* 条件更新
|
||||
*/
|
||||
int updateByQuery(@Param("data") Refund data, @Param("query") RefundQuery query);
|
||||
|
||||
/**
|
||||
* 按日查询退款金额
|
||||
*/
|
||||
List<LocalDateDecimalVO> selectDailyAmount(@Param("query") RefundQuery query);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="query.userName != null and query.userName != ''"> and sr.user_name like concat('%', #{query.userName}, '%')</if>
|
||||
<if test="query.bstType != null and query.bstType != ''"> and sr.bst_type = #{query.bstType}</if>
|
||||
<if test="query.channelId != null "> and sr.channel_id = #{query.channelId}</if>
|
||||
<if test="query.createDateStart != null">and date(sr.create_time) >= #{query.createDateStart}</if>
|
||||
<if test="query.createDateEnd != null">and date(sr.create_time) <= #{query.createDateEnd}</if>
|
||||
<if test="query.statusList != null and query.statusList.size() > 0">
|
||||
and sr.status in
|
||||
<foreach item="item" collection="query.statusList" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="selectRefundList" parameterType="Refund" resultMap="RefundResult">
|
||||
|
@ -61,6 +69,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
limit 1
|
||||
</select>
|
||||
|
||||
<resultMap id="LocalDateDecimalVO" type="LocalDateDecimalVO" autoMapping="true">
|
||||
<result column="value" property="value" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler"/>
|
||||
</resultMap>
|
||||
<select id="selectDailyAmount" resultMap="LocalDateDecimalVO">
|
||||
select
|
||||
sum(sr.amount) as `value`,
|
||||
date(sr.create_time) as `key`
|
||||
from ss_refund sr
|
||||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
group by `key`
|
||||
</select>
|
||||
|
||||
<insert id="insertRefund" parameterType="Refund" useGeneratedKeys="true" keyProperty="refundId">
|
||||
insert into ss_refund
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.ruoyi.ss.refund.service;
|
||||
|
||||
import com.ruoyi.common.domain.vo.LocalDateDecimalVO;
|
||||
import com.ruoyi.dashboard.domain.dto.BillDailyAmountQuery;
|
||||
import com.ruoyi.ss.refund.domain.Refund;
|
||||
import com.ruoyi.ss.refund.domain.RefundQuery;
|
||||
import com.ruoyi.ss.refund.domain.RefundVO;
|
||||
|
@ -93,4 +95,9 @@ public interface RefundService
|
|||
* 刷新退款结果
|
||||
*/
|
||||
int refreshResult(RefundVO refund);
|
||||
|
||||
/**
|
||||
* 统计退款金额
|
||||
*/
|
||||
List<LocalDateDecimalVO> selectDailyAmount(RefundQuery query);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.ss.refund.service.impl;
|
||||
|
||||
import com.ruoyi.common.domain.vo.LocalDateDecimalVO;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.pay.syb.enums.SybTrxStatus;
|
||||
import com.ruoyi.common.pay.syb.service.SybPayService;
|
||||
|
@ -24,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
@ -259,4 +261,9 @@ public class RefundServiceImpl implements RefundService
|
|||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LocalDateDecimalVO> selectDailyAmount(RefundQuery query) {
|
||||
return refundMapper.selectDailyAmount(query);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -261,4 +261,11 @@ public interface ISmUserService
|
|||
* @param info @return
|
||||
*/
|
||||
UserRealNameVO riskRealName(RiskInfoVO info);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param openId
|
||||
* @return
|
||||
*/
|
||||
SmUserVO selectSmUserByAliOpenId(String openId);
|
||||
}
|
||||
|
|
|
@ -627,6 +627,16 @@ public class SmUserServiceImpl implements ISmUserService
|
|||
return this.realName(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param openId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SmUserVO selectSmUserByAliOpenId(String openId) {
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
|
||||
private int selectCountByPhone(String phone) {
|
||||
return smUserMapper.selectCountByPhone(phone);
|
||||
}
|
||||
|
|
|
@ -57,4 +57,22 @@ public class AppAuthController extends BaseController {
|
|||
ajax.put(Constants.TOKEN, token);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 前台用户支付宝登录
|
||||
* @return token
|
||||
*/
|
||||
@Log(title = "支付宝授权登录", businessType = BusinessType.OTHER)
|
||||
@ApiOperation("支付宝授权登录")
|
||||
@PostMapping("/aliLogin")
|
||||
public AjaxResult aliLogin(@RequestBody @Validated WxLoginBody body)
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
// 生成令牌
|
||||
String token = loginService.aliLogin(body);
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.ruoyi.common.core.domain.ValidGroup;
|
|||
import com.ruoyi.common.domain.vo.LocalDateDecimalVO;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
import com.ruoyi.dashboard.domain.dto.BillDailyAmountQuery;
|
||||
import com.ruoyi.dashboard.service.DashboardService;
|
||||
import com.ruoyi.ss.balancePeriod.domain.SmBalancePeriodQuery;
|
||||
import com.ruoyi.ss.balancePeriod.service.ISmBalancePeriodService;
|
||||
|
@ -13,6 +14,13 @@ import com.ruoyi.ss.bonus.domain.BonusQuery;
|
|||
import com.ruoyi.ss.bonus.service.BonusService;
|
||||
import com.ruoyi.ss.businessRecord.service.ISmBusinessRecordService;
|
||||
import com.ruoyi.dashboard.domain.dto.ServiceIncomeQuery;
|
||||
import com.ruoyi.ss.payBill.domain.PayBillQuery;
|
||||
import com.ruoyi.ss.payBill.domain.enums.PayBillStatus;
|
||||
import com.ruoyi.ss.payBill.domain.vo.PayDailyAmountVO;
|
||||
import com.ruoyi.ss.payBill.service.PayBillService;
|
||||
import com.ruoyi.ss.refund.domain.RefundQuery;
|
||||
import com.ruoyi.ss.refund.domain.enums.RefundStatus;
|
||||
import com.ruoyi.ss.refund.service.RefundService;
|
||||
import com.ruoyi.ss.transactionBill.domain.TransactionBillQuery;
|
||||
import com.ruoyi.ss.transactionBill.domain.vo.TransactionDailyAmountVO;
|
||||
import com.ruoyi.ss.transactionBill.service.TransactionBillService;
|
||||
|
@ -22,12 +30,16 @@ import com.ruoyi.ss.businessRecord.domain.SmBusinessRecordVo;
|
|||
import com.ruoyi.dashboard.domain.vo.BriefVo;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -55,6 +67,12 @@ public class SmDashboardController extends BaseController {
|
|||
@Autowired
|
||||
private BonusService bonusService;
|
||||
|
||||
@Autowired
|
||||
private PayBillService payBillService;
|
||||
|
||||
@Autowired
|
||||
private RefundService refundService;
|
||||
|
||||
/**
|
||||
* 舆情分析数据
|
||||
*/
|
||||
|
@ -136,20 +154,46 @@ public class SmDashboardController extends BaseController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 按天统计订单金额数据
|
||||
* 按天统计支付订单金额数据
|
||||
*/
|
||||
@GetMapping("/billDailyAmount")
|
||||
public AjaxResult getBillDailyAmount(TransactionBillQuery query) {
|
||||
List<TransactionDailyAmountVO> list = transactionBillService.selectDailyAmount(query);
|
||||
if (query.getStartDate() != null && query.getEndDate() != null) {
|
||||
CollectionUtils.fillVoids(list, TransactionDailyAmountVO::getDate, (date) -> {
|
||||
TransactionDailyAmountVO vo = new TransactionDailyAmountVO();
|
||||
public AjaxResult getBillDailyAmount(BillDailyAmountQuery query) {
|
||||
PayBillQuery payQuery = new PayBillQuery();
|
||||
payQuery.setPayDateStart(query.getDateStart());
|
||||
payQuery.setPayDateEnd(query.getDateEnd());
|
||||
payQuery.setStatusList(PayBillStatus.payedList());
|
||||
List<LocalDateDecimalVO> payList = payBillService.selectDailyAmount(payQuery);
|
||||
|
||||
RefundQuery refundQuery = new RefundQuery();
|
||||
refundQuery.setCreateDateStart(query.getDateStart());
|
||||
refundQuery.setCreateDateEnd(query.getDateEnd());
|
||||
refundQuery.setStatusList(RefundStatus.successList());
|
||||
List<LocalDateDecimalVO> refundList = refundService.selectDailyAmount(refundQuery);
|
||||
|
||||
List<PayDailyAmountVO> list = new ArrayList<>();
|
||||
if (query.getDateStart() != null && query.getDateEnd() != null) {
|
||||
list = CollectionUtils.fillVoids(list, PayDailyAmountVO::getDate, (date) -> {
|
||||
PayDailyAmountVO vo = new PayDailyAmountVO();
|
||||
vo.setDate(date);
|
||||
vo.setTotal(BigDecimal.ZERO);
|
||||
vo.setRefund(BigDecimal.ZERO);
|
||||
vo.setReceived(BigDecimal.ZERO);
|
||||
|
||||
LocalDateDecimalVO pay = payList.stream().filter(item -> date.isEqual(item.getKey())).findFirst().orElse(null);
|
||||
if (pay == null) {
|
||||
vo.setTotal(BigDecimal.ZERO);
|
||||
} else {
|
||||
vo.setTotal(pay.getValue());
|
||||
}
|
||||
|
||||
LocalDateDecimalVO refund = refundList.stream().filter(item -> date.isEqual(item.getKey())).findFirst().orElse(null);
|
||||
if (refund == null) {
|
||||
vo.setRefund(BigDecimal.ZERO);
|
||||
} else {
|
||||
vo.setRefund(refund.getValue());
|
||||
}
|
||||
|
||||
vo.setReceived(vo.getTotal().subtract(vo.getRefund()));
|
||||
|
||||
return vo;
|
||||
}, query.getStartDate(), query.getEndDate());
|
||||
}, query.getDateStart(), query.getDateEnd());
|
||||
}
|
||||
return success(list);
|
||||
}
|
||||
|
|
|
@ -136,6 +136,7 @@ tm:
|
|||
liveness:
|
||||
returnUrl: http://192.168.2.40:3001/liveness
|
||||
|
||||
# 支付宝小程序
|
||||
ali:
|
||||
appId: 2021004193649611
|
||||
privateSecret: 123
|
||||
privateKey: D:\project\smart-switch\alipayPublicKey_RSA2.txt
|
||||
|
|
Loading…
Reference in New Issue
Block a user