debug:分时段订单账变格式化问题;

This commit is contained in:
墨大叔 2024-09-18 17:51:24 +08:00
parent e369d6c8a9
commit 0d546b4105
21 changed files with 278 additions and 79 deletions

View File

@ -107,8 +107,13 @@ public class DashboardService {
billQuery.setStartDate(query.getStartDate());
billQuery.setEndDate(query.getEndDate());
billQuery.setStatusList(TransactionBillStatus.serviceIncome());
billQuery.setType(TransactionBillType.RECHARGE.getType());
List<TransactionAmountVO<Date>> amountList = transactionBillService.selectCommonSumOfMoney(billQuery, TransactionBillGroupBy.create_date.name());
// 查询提现
billQuery.setType(TransactionBillType.WITHDRAW.getType());
List<TransactionAmountVO<Date>> withdrawList = transactionBillService.selectCommonSumOfMoney(billQuery, TransactionBillGroupBy.create_date.name());
// 查询月费收入
ReceiveBillQuery receiveQuery = new ReceiveBillQuery();
receiveQuery.setStartDate(query.getStartDate());
@ -134,6 +139,17 @@ public class DashboardService {
vo.setChannelCost(BigDecimal.ZERO);
}
// 提现服务费收入及成本
TransactionAmountVO<Date> withdraw = withdrawList.stream()
.filter(item -> item.getKey().compareTo(DateUtils.toDate(date)) == 0)
.findFirst().orElse(null);
if (withdraw != null) {
vo.setWithdrawServiceAmount(withdraw.getServiceAmount());
vo.setChannelCost(vo.getChannelCost().add(withdraw.getChannelCost()));
} else {
vo.setWithdrawServiceAmount(BigDecimal.ZERO);
}
// 月费收入
ReceiveAmountVO<Date> receive = receiveList.stream()
.filter(item -> item.getKey().compareTo(DateUtils.toDate(date)) == 0)

View File

@ -12,4 +12,7 @@ public class AccountVO extends Account {
@ApiModelProperty("用户名称")
private String userName;
@ApiModelProperty("渠道是否启用")
private Boolean channelEnabled;
}

View File

@ -0,0 +1,18 @@
package com.ruoyi.ss.account.service;
import com.ruoyi.ss.account.domain.AccountVO;
import java.util.List;
/**
* @author wjh
* 2024/9/18
*/
public interface AccountAssembler {
/**
* 拼接渠道是否启用
*/
void assembleChannelEnabled(List<AccountVO> list);
}

View File

@ -0,0 +1,44 @@
package com.ruoyi.ss.account.service.impl;
import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.ss.account.domain.AccountVO;
import com.ruoyi.ss.account.service.AccountAssembler;
import com.ruoyi.ss.channelWithdraw.domain.ChannelWithdrawVO;
import com.ruoyi.ss.channelWithdraw.service.ChannelWithdrawService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author wjh
* 2024/9/18
*/
@Service
public class AccountAssemblerImpl implements AccountAssembler {
@Autowired
private ChannelWithdrawService channelWithdrawService;
/**
* 拼接渠道是否启用
*
* @param list
*/
@Override
public void assembleChannelEnabled(List<AccountVO> list) {
if (CollectionUtils.isEmptyElement(list)) {
return;
}
List<ChannelWithdrawVO> channelList = channelWithdrawService.selectEnabledList();
for (AccountVO account : list) {
ChannelWithdrawVO channel = channelList.stream()
.filter(item -> item.getAccountType() != null && item.getAccountType().equals(account.getAccountType()))
.findFirst()
.orElse(null);
account.setChannelEnabled(channel != null);
}
}
}

View File

@ -9,7 +9,11 @@ import com.ruoyi.ss.account.domain.AccountQuery;
import com.ruoyi.ss.account.domain.AccountVO;
import com.ruoyi.ss.account.domain.enums.AccountType;
import com.ruoyi.ss.account.mapper.AccountMapper;
import com.ruoyi.ss.account.service.AccountAssembler;
import com.ruoyi.ss.account.service.AccountService;
import com.ruoyi.ss.channel.service.ChannelService;
import com.ruoyi.ss.channelWithdraw.domain.ChannelWithdrawVO;
import com.ruoyi.ss.channelWithdraw.service.ChannelWithdrawService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -26,9 +30,16 @@ import java.util.stream.Collectors;
*/
@Service
public class AccountServiceImpl implements AccountService {
@Autowired
private AccountMapper accountMapper;
@Autowired
private AccountAssembler accountAssembler;
@Autowired
private ChannelWithdrawService channelWithdrawService;
/**
* 查询用户账户
*
@ -124,16 +135,29 @@ public class AccountServiceImpl implements AccountService {
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyMap();
}
// 获取可用渠道仅返回可用渠道
Set<String> enabledChannel = channelWithdrawService.selectEnabledList()
.stream().map(ChannelWithdrawVO::getAccountType).collect(Collectors.toSet());
list.forEach(AccountVO::desensitization);
Map<String, List<AccountVO>> map = new HashMap<>();
map.put(AccountType.BANK_CARD.name(), list.stream()
.filter(item -> Objects.equals(AccountType.BANK_CARD.getType(), item.getAccountType())).collect(Collectors.toList()));
map.put(AccountType.WECHAT.name(), list.stream()
.filter(item -> Objects.equals(AccountType.WECHAT.getType(), item.getAccountType())).collect(Collectors.toList()));
map.put(AccountType.ALIPAY.name(), list.stream()
.filter(item -> Objects.equals(AccountType.ALIPAY.getType(), item.getAccountType())).collect(Collectors.toList()));
map.put(AccountType.OFFLINE_IMAGE.name(), list.stream()
.filter(item -> Objects.equals(AccountType.OFFLINE_IMAGE.getType(), item.getAccountType())).collect(Collectors.toList()));
if (enabledChannel.contains(AccountType.BANK_CARD.getType())) {
map.put(AccountType.BANK_CARD.name(), list.stream()
.filter(item -> Objects.equals(AccountType.BANK_CARD.getType(), item.getAccountType())).collect(Collectors.toList()));
}
if (enabledChannel.contains(AccountType.WECHAT.getType())) {
map.put(AccountType.WECHAT.name(), list.stream()
.filter(item -> Objects.equals(AccountType.WECHAT.getType(), item.getAccountType())).collect(Collectors.toList()));
}
if (enabledChannel.contains(AccountType.ALIPAY.getType())) {
map.put(AccountType.ALIPAY.name(), list.stream()
.filter(item -> Objects.equals(AccountType.ALIPAY.getType(), item.getAccountType())).collect(Collectors.toList()));
}
if (enabledChannel.contains(AccountType.OFFLINE_IMAGE.getType())) {
map.put(AccountType.OFFLINE_IMAGE.name(), list.stream()
.filter(item -> Objects.equals(AccountType.OFFLINE_IMAGE.getType(), item.getAccountType())).collect(Collectors.toList()));
}
return map;
}

View File

@ -67,4 +67,10 @@ public interface ChannelWithdrawService
* 查询用户可用的提现渠道
*/
List<ChannelWithdrawVO> selectEnabledList(Long userId);
/**
* 查询启用渠道
* @return
*/
List<ChannelWithdrawVO> selectEnabledList();
}

View File

@ -118,4 +118,12 @@ public class ChannelWithdrawServiceImpl implements ChannelWithdrawService
query.setEnabled(true);
return this.selectChannelWithdrawList(query);
}
@Override
public List<ChannelWithdrawVO> selectEnabledList() {
// 查询渠道列表
ChannelWithdrawQuery query = new ChannelWithdrawQuery();
query.setEnabled(true);
return this.selectChannelWithdrawList(query);
}
}

View File

@ -19,10 +19,13 @@ public class ServiceIncomeVO {
@ApiModelProperty("月费收入")
private BigDecimal monthAmount;
@ApiModelProperty("服务费收入")
@ApiModelProperty("订单服务费收入")
private BigDecimal serviceAmount;
@ApiModelProperty("成本")
@ApiModelProperty("提现服务费收入")
private BigDecimal withdrawServiceAmount;
@ApiModelProperty("渠道成本")
private BigDecimal channelCost;
}

View File

@ -139,9 +139,10 @@ public interface DeviceService
/**
* 归零电表并关闭订单
*
* @param deviceId 设备id
*/
boolean resetTimeWithBill(Long deviceId);
int resetTimeWithBill(Long deviceId);
/**
* 设备是否已经被绑定

View File

@ -31,6 +31,7 @@ import com.ruoyi.ss.deviceSuit.service.DeviceSuitConverter;
import com.ruoyi.ss.deviceSuit.service.DeviceSuitService;
import com.ruoyi.ss.model.domain.SmModelVO;
import com.ruoyi.ss.model.service.ModelService;
import com.ruoyi.ss.record.time.domain.enums.RecordTimeType;
import com.ruoyi.ss.record.time.service.IRecordTimeService;
import com.ruoyi.ss.record.time.service.RecordTimeConverter;
import com.ruoyi.ss.store.domain.StoreVo;
@ -306,7 +307,7 @@ public class DeviceServiceImpl implements DeviceService
LoginUser loginUser = SecurityUtils.getLoginUser();
scheduledExecutorService.schedule(() -> {
DeviceVO device = deviceMapper.selectSmDeviceByDeviceId(deviceId);
recordTimeService.insertRecordTime(recordTimeConverter.toRecordTime(device, seconds, reason, loginUser));
recordTimeService.insertRecordTime(recordTimeConverter.toRecordTime(device, seconds, reason, loginUser, RecordTimeType.TIME.getType()));
}, 0, TimeUnit.SECONDS);
}
@ -459,7 +460,7 @@ public class DeviceServiceImpl implements DeviceService
// 设备剩余时长
Duration duration = Duration.between(now, device.getExpireTime());
long seconds = duration.getSeconds() > 0 ? duration.getSeconds() : 0;
recordTimeService.insertRecordTime(recordTimeConverter.toRecordTime(device, -seconds, "设备归零", loginUser));
recordTimeService.insertRecordTime(recordTimeConverter.toRecordTime(device, -seconds, "设备归零", loginUser, RecordTimeType.TIME.getType()));
}, 0, TimeUnit.SECONDS);
return result == null ? 0 : result;
@ -495,7 +496,7 @@ public class DeviceServiceImpl implements DeviceService
// 归零记录
LoginUser loginUser = SecurityUtils.getLoginUser();
scheduledExecutorService.schedule(() -> {
recordTimeService.insertRecordTime(recordTimeConverter.toRecordTime(device, device.getSurplusEle().negate().intValue(), "设备归零", loginUser));
recordTimeService.insertRecordTime(recordTimeConverter.toRecordTime(device, device.getSurplusEle().negate().intValue(), "设备归零", loginUser, RecordTimeType.ELE.getType()));
}, 0, TimeUnit.SECONDS);
return result == null ? 0 : result;
@ -845,7 +846,7 @@ public class DeviceServiceImpl implements DeviceService
}
@Override
public boolean resetTimeWithBill(Long deviceId) {
public int resetTimeWithBill(Long deviceId) {
ServiceUtil.assertion(deviceId == null, "设备id不能为空");
// 拉取最新设备信息
@ -874,7 +875,7 @@ public class DeviceServiceImpl implements DeviceService
int reset = this.resetTime(device, true);
ServiceUtil.assertion(reset != 1, "归零失败");
return true;
return reset;
}
/**

View File

@ -4,6 +4,7 @@ import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -52,4 +53,8 @@ public class RecordTime extends BaseEntity
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime operatorTime;
@Excel(name = "变化类型1-时长2-电量")
@ApiModelProperty("变化类型1-时长2-电量")
private String type;
}

View File

@ -0,0 +1,20 @@
package com.ruoyi.ss.record.time.domain.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author wjh
* 2024/9/18
*/
@Getter
@AllArgsConstructor
public enum RecordTimeType {
TIME("1", "时长"),
ELE("2", "电量");
private final String type;
private final String msg;
}

View File

@ -7,7 +7,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="RecordTimeVO" id="RecordTimeResult" autoMapping="true"/>
<sql id="selectRecordTimeVo">
select id, device_id, amount, reason, operator_id, operator_name, operator_type, operator_time from ss_record_time
select
id,
device_id,
amount,
reason,
operator_id,
operator_name,
operator_type,
operator_time,
type
from ss_record_time
</sql>
<select id="selectRecordTimeList" parameterType="RecordTimeQuery" resultMap="RecordTimeResult">
@ -20,6 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="operatorName != null and operatorName != ''"> and operator_name like concat('%', #{operatorName}, '%')</if>
<if test="operatorType != null and operatorType != ''"> and operator_type = #{operatorType}</if>
<if test="operatorTime != null "> and operator_time = #{operatorTime}</if>
<if test="type != null and type != ''"> and type = #{type}</if>
</where>
order by operator_time desc
</select>
@ -40,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="operatorName != null">operator_name,</if>
<if test="operatorType != null">operator_type,</if>
<if test="operatorTime != null">operator_time,</if>
<if test="type != null and type != ''">type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
@ -50,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="operatorName != null">#{operatorName},</if>
<if test="operatorType != null">#{operatorType},</if>
<if test="operatorTime != null">#{operatorTime},</if>
<if test="type != null and type != ''">#{type},</if>
</trim>
</insert>
@ -63,6 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="operatorName != null">operator_name = #{operatorName},</if>
<if test="operatorType != null">operator_type = #{operatorType},</if>
<if test="operatorTime != null">operator_time = #{operatorTime},</if>
<if test="type != null and type != ''">type = #{type},</if>
</trim>
where id = #{id}
</update>

View File

@ -12,7 +12,7 @@ import com.ruoyi.ss.user.domain.SmUserVo;
*/
public interface RecordTimeConverter {
RecordTime toRecordTime(Device device, long seconds, String reason, LoginUser loginUser);
RecordTime toRecordTime(Device device, long amount, String reason, LoginUser loginUser, String type);
RecordTime toRecordTime(DeviceVO device, long secondSuitTime, String reason, SmUserVo user);
RecordTime toRecordTime(DeviceVO device, long secondSuitTime, String reason, SmUserVo user, String type);
}

View File

@ -19,11 +19,12 @@ import java.time.LocalDateTime;
@Service
public class RecordTimeConverterImpl implements RecordTimeConverter {
@Override
public RecordTime toRecordTime(Device device, long seconds, String reason, LoginUser loginUser) {
public RecordTime toRecordTime(Device device, long amount, String reason, LoginUser loginUser, String type) {
RecordTime record = new RecordTime();
record.setDeviceId(device == null ? null : device.getDeviceId());
record.setAmount(seconds);
record.setAmount(amount);
record.setReason(reason);
record.setType(type);
if (loginUser != null) {
record.setOperatorId(loginUser.getUserId());
record.setOperatorName(loginUser.getUsername());
@ -35,7 +36,7 @@ public class RecordTimeConverterImpl implements RecordTimeConverter {
}
@Override
public RecordTime toRecordTime(DeviceVO device, long seconds, String reason, SmUserVo user) {
public RecordTime toRecordTime(DeviceVO device, long seconds, String reason, SmUserVo user, String type) {
RecordTime record = new RecordTime();
record.setDeviceId(device == null ? null : device.getDeviceId());
record.setAmount(seconds);

View File

@ -103,6 +103,9 @@ public class TransactionBillQuery extends TransactionBill {
@ApiModelProperty("套餐收费类型列表")
private List<String> suitFeeTypes;
@ApiModelProperty("套餐收费模式列表")
private List<String> suitFeeModes;
@ApiModelProperty("是否正在使用")
private Boolean isUsing;
@ -114,4 +117,7 @@ public class TransactionBillQuery extends TransactionBill {
@ApiModelProperty("是否已结束")
private Boolean isFinished;
@ApiModelProperty("渠道ID列表")
private List<Long> channelIds;
}

View File

@ -167,6 +167,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="query.endSuitEndEle != null"> and stb.suit_end_ele &lt;= #{query.endSuitEndEle}</if>
<if test="query.channelId != null"> and stb.channel_id = #{query.channelId}</if>
<if test="query.withdrawType != null"> and stb.withdraw_type = #{query.withdrawType}</if>
<if test="query.money != null"> and stb.money = #{query.money}</if>
<if test="query.deviceNo != null and query.deviceNo != ''"> and sd.device_no like concat('%', #{query.deviceNo}, '%')</if>
<if test="query.userMobile != null and query.userMobile != ''"> and su.phonenumber like concat('%', #{query.userMobile}, '%')</if>
<if test="query.suitFeeMode != null and query.suitFeeMode != ''"> and suit_fee_mode = #{query.suitFeeMode}</if>
@ -201,6 +202,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item}
</foreach>
</if>
<if test="query.suitFeeModes != null and query.suitFeeModes.size() > 0">
and stb.suit_fee_mode in
<foreach item="item" collection="query.suitFeeModes" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="query.billIds != null and query.billIds.size() > 0">
and stb.bill_id in
<foreach item="item" collection="query.billIds" open="(" separator="," close=")">
@ -231,11 +238,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item}
</foreach>
</if>
<if test="query.channelIds != null and query.channelIds.size() > 0">
and stb.channel_id in
<foreach item="item" collection="query.channelIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="query.createDateRange != null and query.createDateRange.size() > 1">
and stb.create_time >= #{query.createDateRange[0]} and stb.create_time &lt;= #{query.createDateRange[1]}
and date(stb.create_time) >= date(#{query.createDateRange[0]}) and date(stb.create_time) &lt;= date(#{query.createDateRange[1]})
</if>
<if test="query.payDateRange != null and query.payDateRange.size() > 1">
and stb.pay_time >= #{query.payDateRange[0]} and stb.pay_time &lt;= #{query.payDateRange[1]}
and date(stb.pay_time) >= date(#{query.payDateRange[0]}) and date(stb.pay_time) &lt;= date(#{query.payDateRange[1]})
</if>
</sql>
@ -485,60 +498,61 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<update id="updateSmTransactionBill" parameterType="TransactionBill">
update sm_transaction_bill
update sm_transaction_bill stb
<trim prefix="SET" suffixOverrides=",">
<include refid="updateColumns"/>
</trim>
where bill_id = #{data.billId}
where stb.bill_id = #{data.billId}
</update>
<!--FIXME 更新两个表都有的字段时,会报错-->
<sql id="updateColumns">
<if test="data.userId != null">user_id = #{data.userId},</if>
<if test="data.type != null">`type` = #{data.type},</if>
<if test="data.deviceId != null">device_id = #{data.deviceId},</if>
<if test="data.mchId != null">mch_id = #{data.mchId},</if>
<if test="data.money != null">money = #{data.money},</if>
<if test="data.arrivalAmount != null">arrival_amount = #{data.arrivalAmount},</if>
<if test="data.serviceCharge != null">service_charge = #{data.serviceCharge},</if>
<if test="data.createTime != null">create_time = #{data.createTime},</if>
<if test="data.remark != null">remark = #{data.remark},</if>
<if test="data.status != null">`status` = #{data.status},</if>
<if test="data.channelId != null">channel_id = #{data.channelId},</if>
<if test="data.afterBalance != null">after_balance = #{data.afterBalance},</if>
<if test="data.payTime != null">pay_time = #{data.payTime},</if>
<if test="data.expireTime != null">expire_time = #{data.expireTime},</if>
<if test="data.accountNo != null">account_no = #{data.accountNo},</if>
<if test="data.payedAmount != null">payed_amount = #{data.payedAmount},</if>
<if test="data.transferIds != null">transfer_ids = #{data.transferIds,typeHandler=com.ruoyi.system.mapper.typehandler.StringListTypeHandler},</if>
<if test="data.channelCost != null">channel_cost = #{data.channelCost},</if>
<if test="data.suitId != null">suit_id = #{data.suitId},</if>
<if test="data.suitTime != null">suit_time = #{data.suitTime},</if>
<if test="data.suitTimeUnit != null">suit_time_unit = #{data.suitTimeUnit},</if>
<if test="data.suitStartTime != null">suit_start_time = #{data.suitStartTime},</if>
<if test="data.suitEndTime != null">suit_end_time = #{data.suitEndTime},</if>
<if test="data.suitExpireTime != null">suit_expire_time = #{data.suitExpireTime},</if>
<if test="data.suitFeeMode != null">suit_fee_mode = #{data.suitFeeMode},</if>
<if test="data.suitFeeType != null">suit_fee_type = #{data.suitFeeType},</if>
<if test="data.suitGearAmount != null">suit_gear_amount = #{data.suitGearAmount,typeHandler=com.ruoyi.system.mapper.typehandler.DecimalSplitListTypeHandler},</if>
<if test="data.suitGearTime != null">suit_gear_time = #{data.suitGearTime,typeHandler=com.ruoyi.system.mapper.typehandler.IntegerSplitListTypeHandler},</if>
<if test="data.suitPrice != null">suit_price = #{data.suitPrice},</if>
<if test="data.suitStartEle != null">suit_start_ele = #{data.suitStartEle},</if>
<if test="data.suitEndEle != null">suit_end_ele = #{data.suitEndEle},</if>
<if test="data.storeId != null ">store_id = #{data.storeId},</if>
<if test="data.storeName != null ">store_name = #{data.storeName},</if>
<if test="data.storeAddress != null ">store_address = #{data.storeAddress},</if>
<if test="data.deviceName != null ">device_name = #{data.deviceName},</if>
<if test="data.deviceNo != null ">device_no = #{data.deviceNo},</if>
<if test="data.suitName != null ">suit_name = #{data.suitName},</if>
<if test="data.deviceMac != null ">device_mac = #{data.deviceMac},</if>
<if test="data.refundAmount != null">refund_amount = #{data.refundAmount},</if>
<if test="data.refundMchAmount != null">refund_mch_amount = #{data.refundMchAmount},</if>
<if test="data.refundServiceAmount != null">refund_service_amount = #{data.refundServiceAmount},</if>
<if test="data.payPicture != null">pay_picture = #{data.payPicture},</if>
<if test="data.withdrawType != null">withdraw_type = #{data.withdrawType},</if>
<if test="data.offlineImage != null">offline_image = #{data.offlineImage},</if>
<if test="data.depositPayId != null">deposit_pay_id = #{data.depositPayId},</if>
<if test="data.payId != null">pay_id = #{data.payId},</if>
<if test="data.userId != null">stb.user_id = #{data.userId},</if>
<if test="data.type != null">stb.`type` = #{data.type},</if>
<if test="data.deviceId != null">stb.device_id = #{data.deviceId},</if>
<if test="data.mchId != null">stb.mch_id = #{data.mchId},</if>
<if test="data.money != null">stb.money = #{data.money},</if>
<if test="data.arrivalAmount != null">stb.arrival_amount = #{data.arrivalAmount},</if>
<if test="data.serviceCharge != null">stb.service_charge = #{data.serviceCharge},</if>
<if test="data.createTime != null">stb.create_time = #{data.createTime},</if>
<if test="data.remark != null">stb.remark = #{data.remark},</if>
<if test="data.status != null">stb.`status` = #{data.status},</if>
<if test="data.channelId != null">stb.channel_id = #{data.channelId},</if>
<if test="data.afterBalance != null">stb.after_balance = #{data.afterBalance},</if>
<if test="data.payTime != null">stb.pay_time = #{data.payTime},</if>
<if test="data.expireTime != null">stb.expire_time = #{data.expireTime},</if>
<if test="data.accountNo != null">stb.account_no = #{data.accountNo},</if>
<if test="data.payedAmount != null">stb.payed_amount = #{data.payedAmount},</if>
<if test="data.transferIds != null">stb.transfer_ids = #{data.transferIds,typeHandler=com.ruoyi.system.mapper.typehandler.StringListTypeHandler},</if>
<if test="data.channelCost != null">stb.channel_cost = #{data.channelCost},</if>
<if test="data.suitId != null">stb.suit_id = #{data.suitId},</if>
<if test="data.suitTime != null">stb.suit_time = #{data.suitTime},</if>
<if test="data.suitTimeUnit != null">stb.suit_time_unit = #{data.suitTimeUnit},</if>
<if test="data.suitStartTime != null">stb.suit_start_time = #{data.suitStartTime},</if>
<if test="data.suitEndTime != null">stb.suit_end_time = #{data.suitEndTime},</if>
<if test="data.suitExpireTime != null">stb.suit_expire_time = #{data.suitExpireTime},</if>
<if test="data.suitFeeMode != null">stb.suit_fee_mode = #{data.suitFeeMode},</if>
<if test="data.suitFeeType != null">stb.suit_fee_type = #{data.suitFeeType},</if>
<if test="data.suitGearAmount != null">stb.suit_gear_amount = #{data.suitGearAmount,typeHandler=com.ruoyi.system.mapper.typehandler.DecimalSplitListTypeHandler},</if>
<if test="data.suitGearTime != null">stb.suit_gear_time = #{data.suitGearTime,typeHandler=com.ruoyi.system.mapper.typehandler.IntegerSplitListTypeHandler},</if>
<if test="data.suitPrice != null">stb.suit_price = #{data.suitPrice},</if>
<if test="data.suitStartEle != null">stb.suit_start_ele = #{data.suitStartEle},</if>
<if test="data.suitEndEle != null">stb.suit_end_ele = #{data.suitEndEle},</if>
<if test="data.storeId != null ">stb.store_id = #{data.storeId},</if>
<if test="data.storeName != null ">stb.store_name = #{data.storeName},</if>
<if test="data.storeAddress != null ">stb.store_address = #{data.storeAddress},</if>
<if test="data.deviceName != null ">stb.device_name = #{data.deviceName},</if>
<if test="data.deviceNo != null ">stb.device_no = #{data.deviceNo},</if>
<if test="data.suitName != null ">stb.suit_name = #{data.suitName},</if>
<if test="data.deviceMac != null ">stb.device_mac = #{data.deviceMac},</if>
<if test="data.refundAmount != null">stb.refund_amount = #{data.refundAmount},</if>
<if test="data.refundMchAmount != null">stb.refund_mch_amount = #{data.refundMchAmount},</if>
<if test="data.refundServiceAmount != null">stb.refund_service_amount = #{data.refundServiceAmount},</if>
<if test="data.payPicture != null">stb.pay_picture = #{data.payPicture},</if>
<if test="data.withdrawType != null">stb.withdraw_type = #{data.withdrawType},</if>
<if test="data.offlineImage != null">stb.offline_image = #{data.offlineImage},</if>
<if test="data.depositPayId != null">stb.deposit_pay_id = #{data.depositPayId},</if>
<if test="data.payId != null">stb.pay_id = #{data.payId},</if>
</sql>
<update id="updateByQuery">

View File

@ -26,6 +26,7 @@ import com.ruoyi.ss.payBill.domain.vo.DoPayVO;
import com.ruoyi.ss.payBill.service.PayBillConverter;
import com.ruoyi.ss.payBill.service.PayBillService;
import com.ruoyi.ss.receiveBill.service.ReceiveBillService;
import com.ruoyi.ss.record.time.domain.enums.RecordTimeType;
import com.ruoyi.ss.record.time.service.IRecordTimeService;
import com.ruoyi.ss.record.time.service.RecordTimeConverter;
import com.ruoyi.ss.recordBalance.domain.enums.RecordBalanceBstType;
@ -770,7 +771,7 @@ public class TransactionBillServiceImpl implements TransactionBillService, After
if (success) {
// 记录时长变化
this.recordTime(bill, "用户充值");
this.recordTime(bill, "用户充值订单:" + bill.getBillNo());
} else {
// 修改设备充值状态为失败
transactionBillMapper.updateDeviceRechargeStatus(billId, TransactionBillDeviceRechargeStatus.FAIL.getStatus());
@ -1409,7 +1410,7 @@ public class TransactionBillServiceImpl implements TransactionBillService, After
// 成功后操作
if (success) {
// 时长变化记录
this.recordTime(bill, "蓝牙手动充值");
this.recordTime(bill, "蓝牙手动充值订单:" + bill.getBillNo());
}
return success;
@ -1423,7 +1424,12 @@ public class TransactionBillServiceImpl implements TransactionBillService, After
return;
}
SmUserVo user = userService.selectSmUserByUserId(bill.getUserId());
recordTimeService.insertRecordTime(recordTimeConverter.toRecordTime(device, bill.toSecondSuitTime(), reason, user));
// 根据订单套餐类型记录
if (SuitFeeType.TIME.getType().equals(bill.getSuitFeeType())) {
recordTimeService.insertRecordTime(recordTimeConverter.toRecordTime(device, bill.toSecondSuitTime(), reason, user, RecordTimeType.TIME.getType()));
} else if (SuitFeeType.COUNT.getType().equals(bill.getSuitFeeType())) {
recordTimeService.insertRecordTime(recordTimeConverter.toRecordTime(device, bill.toSecondSuitTime(), reason, user, RecordTimeType.ELE.getType()));
}
}, 1L, TimeUnit.SECONDS);
}

View File

@ -13,12 +13,16 @@ import com.ruoyi.ss.account.domain.AccountVO;
import com.ruoyi.ss.account.domain.enums.AccountType;
import com.ruoyi.ss.account.service.AccountService;
import com.ruoyi.ss.account.service.AccountValidator;
import com.ruoyi.ss.channelWithdraw.domain.ChannelWithdrawVO;
import com.ruoyi.ss.channelWithdraw.service.ChannelWithdrawService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.stream.Collectors;
/**
* @author wjh
* 2024/3/26
@ -36,6 +40,9 @@ public class AppAccountController extends BaseController {
@Autowired
private WxAuthService wxAuthService;
@Autowired
private ChannelWithdrawService channelWithdrawService;
@ApiOperation("添加收款账户")
@PostMapping
public AjaxResult addAccount(@RequestBody @Validated({ValidGroup.FrontCreate.class}) Account data) {

View File

@ -125,11 +125,13 @@ public class AppDeviceController extends BaseController {
return toAjax(smDeviceService.unbind(deviceId));
}
@Log(title = "设备电量归零", businessType = BusinessType.OTHER, operatorType = OperatorType.MOBILE)
@ApiOperation("设备电量归零")
@Log(title = "设备归零", businessType = BusinessType.OTHER, operatorType = OperatorType.MOBILE)
@ApiOperation("设备归零")
@PutMapping("{deviceId}/reset")
public AjaxResult reset(@PathVariable @ApiParam("设备id") Long deviceId) {
return success(smDeviceService.resetTimeWithBill(deviceId));
int r1 = smDeviceService.resetTimeWithBill(deviceId);
int r2 = smDeviceService.resetEleWithBill(deviceId);
return toAjax(r1 >= 0 && r2 >= 0);
}
@ApiOperation("获取设备用电量分析")

View File

@ -155,7 +155,7 @@ public class SmDeviceController extends BaseController
@Log(title = "设备时长归零", businessType = BusinessType.OTHER)
@PutMapping("/{deviceId}/reset")
public AjaxResult reset(@PathVariable @ApiParam("设备id") Long deviceId) {
return success(deviceService.resetTimeWithBill(deviceId));
return toAjax(deviceService.resetTimeWithBill(deviceId));
}
@PreAuthorize("@ss.hasPermi('system:device:resetEle')")