数据统计
This commit is contained in:
parent
8098ebc3da
commit
273b539859
|
@ -126,6 +126,10 @@ public class User extends BaseEntity
|
|||
@Excel(name = "所属运营区ID")
|
||||
private Long areaId;
|
||||
|
||||
@Excel(name = "分成延迟到账时间")
|
||||
@ApiModelProperty("分成延迟到账时间(小时)")
|
||||
private Integer bonusDelay;
|
||||
|
||||
public User(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
|
|
@ -104,4 +104,22 @@ public class MathUtils {
|
|||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
// 获取最小值
|
||||
public static BigDecimal min(BigDecimal ...values) {
|
||||
if (values == null || values.length == 0) {
|
||||
return null;
|
||||
}
|
||||
BigDecimal min = values[0];
|
||||
for (int i = 1; i < values.length; i++) {
|
||||
BigDecimal value = values[i];
|
||||
if (value == null) {
|
||||
continue;
|
||||
}
|
||||
if (min == null || value.compareTo(min) < 0) {
|
||||
min = value;
|
||||
}
|
||||
}
|
||||
return min;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,4 +90,9 @@ public interface AreaMapper
|
|||
*/
|
||||
int selectCount(@Param("query") AreaQuery query);
|
||||
|
||||
/**
|
||||
* 查询运营区简单数据
|
||||
*/
|
||||
List<AreaVO> selectSimpleList(@Param("query") AreaQuery query);
|
||||
|
||||
}
|
||||
|
|
|
@ -279,4 +279,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- selectSimpleList -->
|
||||
|
||||
<select id="selectSimpleList">
|
||||
select
|
||||
ba.id,
|
||||
ba.name
|
||||
from <include refid="searchTables"/>
|
||||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.List;
|
|||
import com.ruoyi.bst.area.domain.Area;
|
||||
import com.ruoyi.bst.area.domain.AreaQuery;
|
||||
import com.ruoyi.bst.area.domain.AreaVO;
|
||||
import com.ruoyi.bst.customerService.domain.CustomerServiceQuery;
|
||||
|
||||
/**
|
||||
* 运营区Service接口
|
||||
|
@ -79,4 +78,9 @@ public interface AreaService
|
|||
|
||||
public Long selectAreaByStoreId(Long storeId);
|
||||
|
||||
/**
|
||||
* 查询运营区简单数据
|
||||
*/
|
||||
public List<AreaVO> selectSimpleList(AreaQuery query);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package com.ruoyi.bst.area.service.impl;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.bst.customerService.domain.CustomerServiceQuery;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -64,6 +62,11 @@ public class AreaServiceImpl implements AreaService
|
|||
return areaMapper.selectAreaByStoreId(storeId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AreaVO> selectSimpleList(AreaQuery query) {
|
||||
return areaMapper.selectSimpleList(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询运营区列表
|
||||
*
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package com.ruoyi.bst.areaJoin.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AreaJoinStatVO {
|
||||
|
||||
@ApiModelProperty("加盟商数量")
|
||||
private Integer joinCount;
|
||||
|
||||
@ApiModelProperty("合伙人数量")
|
||||
private Integer partnerCount;
|
||||
}
|
|
@ -1,8 +1,10 @@
|
|||
package com.ruoyi.bst.areaJoin.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.bst.areaJoin.domain.AreaJoinQuery;
|
||||
import com.ruoyi.bst.areaJoin.domain.vo.AreaJoinStatVO;
|
||||
|
||||
public interface AreaJoinDashboard {
|
||||
|
||||
|
@ -13,5 +15,13 @@ public interface AreaJoinDashboard {
|
|||
*/
|
||||
BigDecimal selectMaxOfPoint(AreaJoinQuery query);
|
||||
|
||||
/**
|
||||
* 查询加盟商和合伙人数量
|
||||
* @param query
|
||||
* @param keys
|
||||
* @return
|
||||
*/
|
||||
AreaJoinStatVO selectStat(AreaJoinQuery query, List<String> keys);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +1,19 @@
|
|||
package com.ruoyi.bst.areaJoin.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ruoyi.bst.areaJoin.domain.AreaJoinQuery;
|
||||
import com.ruoyi.bst.areaJoin.domain.enums.AreaJoinType;
|
||||
import com.ruoyi.bst.areaJoin.domain.vo.AreaJoinStatVO;
|
||||
import com.ruoyi.bst.areaJoin.mapper.AreaJoinMapper;
|
||||
import com.ruoyi.bst.areaJoin.service.AreaJoinDashboard;
|
||||
import com.ruoyi.common.utils.MathUtils;
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import com.ruoyi.dashboard.constants.StatKeys;
|
||||
|
||||
@Service
|
||||
public class AreaJoinDashboardImpl implements AreaJoinDashboard {
|
||||
|
@ -19,4 +25,31 @@ public class AreaJoinDashboardImpl implements AreaJoinDashboard {
|
|||
public BigDecimal selectMaxOfPoint(AreaJoinQuery query) {
|
||||
return areaJoinMapper.selectMaxOfPoint(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AreaJoinStatVO selectStat(AreaJoinQuery query, List<String> keys) {
|
||||
AreaJoinStatVO vo = new AreaJoinStatVO();
|
||||
if (keys.contains(StatKeys.AREA_JOIN_COUNT)) {
|
||||
vo.setJoinCount(selectJoinCount(query));
|
||||
} else if (keys.contains(StatKeys.AREA_JOIN_PARTNER_COUNT)) {
|
||||
vo.setPartnerCount(selectPartnerCount(query));
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
// 加盟商数量
|
||||
private int selectJoinCount(AreaJoinQuery query) {
|
||||
AreaJoinQuery joinQuery = new AreaJoinQuery();
|
||||
BeanUtils.copyProperties(query, joinQuery);
|
||||
joinQuery.setType(AreaJoinType.JOIN.getCode());
|
||||
return MathUtils.dv(areaJoinMapper.selectCount(joinQuery));
|
||||
}
|
||||
|
||||
// 合伙人数量
|
||||
private int selectPartnerCount(AreaJoinQuery query) {
|
||||
AreaJoinQuery partnerQuery = new AreaJoinQuery();
|
||||
BeanUtils.copyProperties(query, partnerQuery);
|
||||
partnerQuery.setType(AreaJoinType.PARTNER.getCode());
|
||||
return MathUtils.dv(areaJoinMapper.selectCount(partnerQuery));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,4 +90,8 @@ public class Bonus extends BaseEntity
|
|||
@ApiModelProperty("原因")
|
||||
private String reason;
|
||||
|
||||
@Excel(name = "运营区ID")
|
||||
@ApiModelProperty("运营区ID")
|
||||
private Long areaId;
|
||||
|
||||
}
|
||||
|
|
|
@ -29,4 +29,7 @@ public class BonusQuery extends BonusVO {
|
|||
@ApiModelProperty("分成状态列表")
|
||||
private List<String> statusList;
|
||||
|
||||
@ApiModelProperty("分成方类型列表")
|
||||
private List<String> arrivalTypes;
|
||||
|
||||
}
|
||||
|
|
|
@ -78,11 +78,10 @@ public interface BonusMapper
|
|||
|
||||
/**
|
||||
* 预分成
|
||||
* @param ids 分成明细ID列表
|
||||
* @param prepayTime 预分成时间
|
||||
* @param list 分成明细列表
|
||||
* @return 结果
|
||||
*/
|
||||
int prepay(@Param("ids") List<Long> ids, @Param("prepayTime") LocalDateTime prepayTime);
|
||||
int prepay(@Param("list") List<? extends Bonus> list);
|
||||
|
||||
/**
|
||||
* 分成打款
|
||||
|
|
|
@ -29,7 +29,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
bb.pay_time,
|
||||
bb.to_balance,
|
||||
bb.reason,
|
||||
bb.create_time
|
||||
bb.create_time,
|
||||
bb.area_id
|
||||
from <include refid="searchTables"/>
|
||||
</sql>
|
||||
|
||||
|
@ -50,6 +51,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="query.reason != null and query.reason != ''"> and bb.reason like concat('%', #{query.reason}, '%')</if>
|
||||
<if test="query.prePayTimeStart != null "> and bb.pre_pay_time >= #{query.prePayTimeStart}</if>
|
||||
<if test="query.prePayTimeEnd != null "> and bb.pre_pay_time <= #{query.prePayTimeEnd}</if>
|
||||
<if test="query.areaId != null "> and bb.area_id = #{query.areaId}</if>
|
||||
<if test="query.arrivalTypes != null and query.arrivalTypes.size() > 0">
|
||||
and bb.arrival_type in
|
||||
<foreach collection="query.arrivalTypes" item="item" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="query.createDateRange != null and query.createDateRange.size() > 1">
|
||||
and bb.create_time >= #{query.createDateRange[0]}
|
||||
and bb.create_time <= #{query.createDateRange[1]}
|
||||
|
@ -102,6 +110,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="toBalance != null">to_balance,</if>
|
||||
<if test="reason != null">reason,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="areaId != null">area_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="bstId != null">#{bstId},</if>
|
||||
|
@ -121,6 +130,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="toBalance != null">#{toBalance},</if>
|
||||
<if test="reason != null">#{reason},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="areaId != null">#{areaId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
@ -144,6 +154,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
to_balance,
|
||||
reason,
|
||||
create_time,
|
||||
area_id,
|
||||
</trim>
|
||||
values
|
||||
<foreach collection="list" item="i" separator=",">
|
||||
|
@ -182,6 +193,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="i.reason == null ">default,</if>
|
||||
<if test="i.createTime != null ">#{i.createTime},</if>
|
||||
<if test="i.createTime == null ">default,</if>
|
||||
<if test="i.areaId != null ">#{i.areaId},</if>
|
||||
<if test="i.areaId == null ">default,</if>
|
||||
</trim>
|
||||
</foreach>
|
||||
</insert>
|
||||
|
@ -212,6 +225,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="data.toBalance != null">to_balance = #{data.toBalance},</if>
|
||||
<if test="data.reason != null">reason = #{data.reason},</if>
|
||||
<if test="data.createTime != null">create_time = #{data.createTime},</if>
|
||||
<if test="data.areaId != null">area_id = #{data.areaId},</if>
|
||||
</sql>
|
||||
|
||||
<delete id="deleteBonusById" parameterType="Long">
|
||||
|
@ -225,17 +239,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- prepay -->
|
||||
|
||||
<update id="prepay">
|
||||
update bst_bonus bb
|
||||
set bb.wait_amount = bb.wait_amount + bb.invalid_amount,
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
bb.wait_amount = bb.wait_amount + bb.invalid_amount,
|
||||
bb.invalid_amount = 0,
|
||||
bb.pre_pay_time = #{prepayTime},
|
||||
bb.status = 'WAIT_DIVIDE'
|
||||
bb.status = 'WAIT_DIVIDE',
|
||||
<foreach open="bb.pre_pay_time = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.prePayTime != null">
|
||||
WHEN #{item.id} THEN #{item.prePayTime}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN bb.pre_pay_time
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
where bb.id in
|
||||
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||
#{id}
|
||||
<foreach collection="list" item="item" open="(" separator="," close=")">
|
||||
#{item.id}
|
||||
</foreach>
|
||||
and <include refid="checkAmount"/>
|
||||
and bb.status = 'INVALID'
|
||||
|
|
|
@ -78,6 +78,7 @@ public class BonusConverterImpl implements BonusConverter {
|
|||
bonus.setStatus(BonusStatus.INVALID.getStatus());
|
||||
bonus.setToBalance(true);
|
||||
bonus.setInvalidAmount(bonus.getAmount());
|
||||
bonus.setAreaId(order.getAreaId());
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -26,6 +26,7 @@ import com.ruoyi.bst.bonus.utils.BonusUtil;
|
|||
import com.ruoyi.bst.bonusRefund.domain.BonusRefund;
|
||||
import com.ruoyi.bst.bonusRefund.service.BonusRefundConverter;
|
||||
import com.ruoyi.bst.bonusRefund.service.BonusRefundService;
|
||||
import com.ruoyi.common.core.domain.vo.UserVO;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
|
@ -178,19 +179,43 @@ public class BonusServiceImpl implements BonusService
|
|||
return 0;
|
||||
}
|
||||
|
||||
// 将未出账的金额转到待分成金额,并且保证金额不超总数
|
||||
// 后期如果有风控,需要每个分成单独处理
|
||||
List<Long> ids = list.stream().map(Bonus::getId).collect(Collectors.toList());
|
||||
int rows = bonusMapper.prepay(ids, LocalDateTime.now());
|
||||
// 获取用户列表
|
||||
List<UserVO> userList = userService.selectByIds(list.stream()
|
||||
.filter(item -> BonusArrivalType.userList().contains(item.getArrivalType()))
|
||||
.map(Bonus::getArrivalId)
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
for (BonusVO bonus : list) {
|
||||
// 设置预计分成时间
|
||||
if (BonusArrivalType.userList().contains(bonus.getArrivalType())) {
|
||||
UserVO user = userList.stream().filter(item -> item.getUserId().equals(bonus.getArrivalId())).findFirst().orElse(null);
|
||||
if (user == null) {
|
||||
continue;
|
||||
}
|
||||
bonus.setPrePayTime(now.plusHours(user.getBonusDelay()));
|
||||
} else {
|
||||
bonus.setPrePayTime(now);
|
||||
}
|
||||
}
|
||||
|
||||
// 更新数据库
|
||||
Integer result = transactionTemplate.execute(status -> {
|
||||
int rows = bonusMapper.prepay(list);
|
||||
ServiceUtil.assertion(rows != list.size(), "预分成失败,请刷新后重试");
|
||||
return rows;
|
||||
});
|
||||
|
||||
|
||||
// 如果预分成成功,则立即执行一次分成
|
||||
if (rows > 0) {
|
||||
if (result != null && result > 0) {
|
||||
scheduledExecutorService.schedule(() -> {
|
||||
this.payBonusBeforeTime(LocalDateTime.now());
|
||||
}, 3, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
return rows;
|
||||
return result == null ? 0 : result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,4 +15,10 @@ public class BonusRefundVO extends BonusRefund {
|
|||
|
||||
@ApiModelProperty("分成方名称")
|
||||
private String bonusArrivalName;
|
||||
|
||||
@ApiModelProperty("分成方ID")
|
||||
private Long bonusArrivalId;
|
||||
|
||||
@ApiModelProperty("运营区ID")
|
||||
private Long bonusAreaId;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
bbr.refund_amount,
|
||||
bbr.create_time,
|
||||
bb.arrival_type as bonus_arrival_type,
|
||||
bb.arrival_name as bonus_arrival_name
|
||||
bb.arrival_name as bonus_arrival_name,
|
||||
bb.arrival_id as bonus_arrival_id,
|
||||
bb.area_id as bonus_area_id
|
||||
from <include refid="searchTables"/>
|
||||
</sql>
|
||||
|
||||
|
@ -28,6 +30,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="query.createDate != null "> and date(bbr.create_time) = #{query.createDate}</if>
|
||||
<if test="query.bonusArrivalType != null and query.bonusArrivalType != '' "> and bb.arrival_type = #{query.bonusArrivalType}</if>
|
||||
<if test="query.bonusArrivalName != null and query.bonusArrivalName != '' "> and bb.arrival_name like concat('%', #{query.bonusArrivalName}, '%')</if>
|
||||
<if test="query.bonusArrivalId != null "> and bb.arrival_id = #{query.bonusArrivalId}</if>
|
||||
<if test="query.bonusAreaId != null "> and bb.area_id = #{query.bonusAreaId}</if>
|
||||
<if test="query.bonusArrivalTypes != null and query.bonusArrivalTypes.size() > 0 ">
|
||||
and bb.arrival_type in
|
||||
<foreach collection="query.bonusArrivalTypes" item="item" open="(" separator="," close=")">
|
||||
|
|
|
@ -16,7 +16,8 @@ public enum DeviceStatus {
|
|||
IN_USE("3", "骑行中"),
|
||||
TEMP_LOCKED("4", "临时锁车"),
|
||||
DISPATCHING("6", "调度中"),
|
||||
DISABLED("8", "禁用");
|
||||
DISABLED("8", "禁用"),
|
||||
Q_LOCKED("9", "强制锁车");
|
||||
|
||||
private final String code;
|
||||
private final String name;
|
||||
|
@ -43,7 +44,7 @@ public enum DeviceStatus {
|
|||
|
||||
// 允许管理员开锁的设备状态
|
||||
public static List<String> canAdminUnlock() {
|
||||
return CollectionUtils.map(DeviceStatus::getCode, DISPATCHING, STORAGE, AVAILABLE, TEMP_LOCKED);
|
||||
return CollectionUtils.map(DeviceStatus::getCode, DISPATCHING, STORAGE, AVAILABLE, TEMP_LOCKED, Q_LOCKED);
|
||||
}
|
||||
|
||||
// 允许用户开锁的设备状态
|
||||
|
|
|
@ -313,6 +313,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
bd.status,
|
||||
bd.lock_status,
|
||||
bd.area_id,
|
||||
bd.order_device_id,
|
||||
bod.status as order_device_status,
|
||||
bod.order_id
|
||||
from bst_device bd
|
||||
left join bst_order_device bod on bod.id = bd.order_device_id
|
||||
|
|
|
@ -151,7 +151,7 @@ public class DeviceIotServiceImpl implements DeviceIotService {
|
|||
// 更新设备状态
|
||||
Device data = new Device();
|
||||
data.setLockStatus(DeviceLockStatus.CLOSE.getCode());
|
||||
data.setStatus(hasOrder ? DeviceStatus.TEMP_LOCKED.getCode() : DeviceStatus.AVAILABLE.getCode());
|
||||
data.setStatus(hasOrder ? DeviceStatus.Q_LOCKED.getCode() : DeviceStatus.AVAILABLE.getCode());
|
||||
DeviceQuery query = new DeviceQuery();
|
||||
query.setId(device.getId());
|
||||
query.setStatusList(DeviceStatus.canLock());
|
||||
|
|
|
@ -18,5 +18,11 @@ public interface ModelValidator {
|
|||
*/
|
||||
boolean canDeleteAll(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 校验数据完整性
|
||||
* @param id
|
||||
*/
|
||||
void validate(Long id);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
|||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.ruoyi.bst.model.domain.Model;
|
||||
|
@ -11,6 +12,7 @@ import com.ruoyi.bst.model.domain.ModelQuery;
|
|||
import com.ruoyi.bst.model.domain.ModelVO;
|
||||
import com.ruoyi.bst.model.mapper.ModelMapper;
|
||||
import com.ruoyi.bst.model.service.ModelService;
|
||||
import com.ruoyi.bst.model.service.ModelValidator;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
|
||||
|
@ -26,6 +28,13 @@ public class ModelServiceImpl implements ModelService
|
|||
|
||||
@Autowired
|
||||
private ModelMapper modelMapper;
|
||||
|
||||
@Autowired
|
||||
private ModelValidator modelValidator;
|
||||
|
||||
@Autowired
|
||||
private TransactionTemplate transactionTemplate;
|
||||
|
||||
/**
|
||||
* 查询车辆型号
|
||||
*
|
||||
|
@ -70,7 +79,17 @@ public class ModelServiceImpl implements ModelService
|
|||
{
|
||||
data.setCreateTime(DateUtils.getNowDate());
|
||||
|
||||
return modelMapper.insertModel(data);
|
||||
Integer result = transactionTemplate.execute(status -> {
|
||||
int rows = modelMapper.insertModel(data);
|
||||
|
||||
if (rows > 0 ) {
|
||||
modelValidator.validate(data.getId());
|
||||
}
|
||||
|
||||
return rows;
|
||||
});
|
||||
|
||||
return result == null ? 0 : result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -82,7 +101,17 @@ public class ModelServiceImpl implements ModelService
|
|||
@Override
|
||||
public int updateModel(Model data)
|
||||
{
|
||||
return modelMapper.updateModel(data);
|
||||
Integer result = transactionTemplate.execute(status -> {
|
||||
int rows = modelMapper.updateModel(data);
|
||||
|
||||
if (rows > 0 ) {
|
||||
modelValidator.validate(data.getId());
|
||||
}
|
||||
|
||||
return rows;
|
||||
});
|
||||
|
||||
return result == null ? 0 : result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,8 +8,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ruoyi.bst.model.domain.ModelQuery;
|
||||
import com.ruoyi.bst.model.domain.ModelVO;
|
||||
import com.ruoyi.bst.model.mapper.ModelMapper;
|
||||
import com.ruoyi.bst.model.service.ModelValidator;
|
||||
import com.ruoyi.common.utils.MathUtils;
|
||||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
|
||||
@Service
|
||||
|
@ -43,5 +46,13 @@ public class ModelValidatorImpl implements ModelValidator {
|
|||
return new HashSet<>(idList).containsAll(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(Long id) {
|
||||
ModelVO model = modelMapper.selectModelById(id);
|
||||
ServiceUtil.assertion(model == null, "ID为%s的车型不存在", id);
|
||||
|
||||
ServiceUtil.assertion(MathUtils.equals(model.getLowVoltage(), model.getFullVoltage()), "满电电压与亏电电压不允许相等");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -34,4 +34,7 @@ public class OrderQuery extends OrderVO {
|
|||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate createDate;
|
||||
|
||||
@ApiModelProperty("分成用户ID")
|
||||
private Long bonusUserId;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package com.ruoyi.bst.order.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class OrderRankVO {
|
||||
|
||||
|
||||
@ApiModelProperty("运营区ID")
|
||||
private Long areaId;
|
||||
|
||||
@ApiModelProperty("运营区名称")
|
||||
private String areaName;
|
||||
|
||||
@ApiModelProperty("订单实收")
|
||||
private BigDecimal actualAmount;
|
||||
|
||||
@ApiModelProperty("订单数量")
|
||||
private Integer count;
|
||||
|
||||
@ApiModelProperty("进行中的数量")
|
||||
private Integer processingCount;
|
||||
|
||||
}
|
|
@ -11,6 +11,7 @@ import com.ruoyi.bst.order.domain.OrderVO;
|
|||
import com.ruoyi.bst.order.domain.query.OrderRefundQuery;
|
||||
import com.ruoyi.bst.order.domain.vo.OrderDailyRefundStatVO;
|
||||
import com.ruoyi.bst.order.domain.vo.OrderDailyStatVO;
|
||||
import com.ruoyi.bst.order.domain.vo.OrderRankVO;
|
||||
|
||||
/**
|
||||
* 订单Mapper接口
|
||||
|
@ -120,5 +121,11 @@ public interface OrderMapper
|
|||
*/
|
||||
List<OrderDailyRefundStatVO> selectDailyRefundStat(@Param("query") OrderRefundQuery query, @Param("keys") List<String> keys);
|
||||
|
||||
/**
|
||||
* 查询订单排行榜
|
||||
* @param query 查询条件
|
||||
* @return 结果
|
||||
*/
|
||||
List<OrderRankVO> selectRank(@Param("query") OrderQuery query);
|
||||
|
||||
}
|
||||
|
|
|
@ -118,6 +118,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="query.areaUserId != null "> and bo.area_user_id = #{query.areaUserId}</if>
|
||||
<if test="query.areaAgentId != null "> and bo.area_agent_id = #{query.areaAgentId}</if>
|
||||
<if test="query.createDate != null "> and date(bo.create_time) = #{query.createDate}</if>
|
||||
<if test="query.bonusUserId != null ">
|
||||
and bo.id in (
|
||||
select distinct bb.bst_id from bst_bonus bb
|
||||
where bb.arrival_id = #{query.bonusUserId} and bb.arrival_type in ('AGENT', 'MCH', 'JOIN', 'PARTNER')
|
||||
and bb.bst_type = '1'
|
||||
)
|
||||
</if>
|
||||
<if test="query.createDateRange != null and query.createDateRange.size() > 1">
|
||||
and date(bo.create_time) >= #{query.createDateRange[0]}
|
||||
and date(bo.create_time) <= #{query.createDateRange[1]}
|
||||
|
@ -401,4 +408,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
group by `date`
|
||||
</select>
|
||||
|
||||
<!-- selectRank -->
|
||||
|
||||
<resultMap id="OrderRankVO" type="OrderRankVO" autoMapping="true">
|
||||
<result property="actualAmount" column="actual_amount" typeHandler="com.ruoyi.common.mybatis.typehandler.NonNullDecimalTypeHandler"/>
|
||||
<result property="count" column="count" typeHandler="com.ruoyi.common.mybatis.typehandler.NonNullIntegerTyperHandler"/>
|
||||
<result property="processingCount" column="processing_count" typeHandler="com.ruoyi.common.mybatis.typehandler.NonNullIntegerTyperHandler"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectRank" resultMap="OrderRankVO">
|
||||
select
|
||||
bo.area_id,
|
||||
ba.name as area_name,
|
||||
sum(bp.refunded) - sum(bo.pay_amount) as actual_amount,
|
||||
count(bo.id) as `count`,
|
||||
sum(if(bo.status = 'PROCESSING', 1, 0)) as processing_count
|
||||
from <include refid="searchTables"/>
|
||||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
group by bo.area_id,ba.name
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.ruoyi.bst.order.domain.OrderQuery;
|
|||
import com.ruoyi.bst.order.domain.query.OrderRefundQuery;
|
||||
import com.ruoyi.bst.order.domain.vo.OrderDailyRefundStatVO;
|
||||
import com.ruoyi.bst.order.domain.vo.OrderDailyStatVO;
|
||||
import com.ruoyi.bst.order.domain.vo.OrderRankVO;
|
||||
import com.ruoyi.bst.order.domain.vo.OrderRefundStatVO;
|
||||
import com.ruoyi.bst.order.domain.vo.OrderStatVO;
|
||||
|
||||
|
@ -37,5 +38,10 @@ public interface OrderDashboard {
|
|||
*/
|
||||
List<OrderDailyRefundStatVO> selectDailyRefundStat(OrderRefundQuery query, List<String> keys);
|
||||
|
||||
/**
|
||||
* 查询订单排行榜
|
||||
*/
|
||||
List<OrderRankVO> selectRank(OrderQuery query);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.ruoyi.bst.order.domain.OrderQuery;
|
|||
import com.ruoyi.bst.order.domain.query.OrderRefundQuery;
|
||||
import com.ruoyi.bst.order.domain.vo.OrderDailyRefundStatVO;
|
||||
import com.ruoyi.bst.order.domain.vo.OrderDailyStatVO;
|
||||
import com.ruoyi.bst.order.domain.vo.OrderRankVO;
|
||||
import com.ruoyi.bst.order.domain.vo.OrderRefundStatVO;
|
||||
import com.ruoyi.bst.order.domain.vo.OrderStatVO;
|
||||
import com.ruoyi.bst.order.mapper.OrderMapper;
|
||||
|
@ -62,4 +63,10 @@ public class OrderDashboardImpl implements OrderDashboard {
|
|||
return orderMapper.selectDailyRefundStat(query, keys);
|
||||
}
|
||||
|
||||
// 查询订单排行榜
|
||||
@Override
|
||||
public List<OrderRankVO> selectRank(OrderQuery query) {
|
||||
return orderMapper.selectRank(query);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ import com.ruoyi.common.utils.ServiceUtil;
|
|||
import com.ruoyi.common.utils.SnowFlakeUtil;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
import com.ruoyi.system.user.service.UserService;
|
||||
|
||||
/**
|
||||
* 订单Service业务层处理
|
||||
|
@ -134,6 +135,9 @@ public class OrderServiceImpl implements OrderService
|
|||
@Autowired
|
||||
private OrderDeviceConverter orderDeviceConverter;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
/**
|
||||
* 查询订单
|
||||
*
|
||||
|
@ -256,6 +260,10 @@ public class OrderServiceImpl implements OrderService
|
|||
int updateOrderDeviceId = this.updateOrderDeviceId(orderDevice.getOrderId(), orderDevice.getId());
|
||||
ServiceUtil.assertion(updateOrderDeviceId != 1, "更新订单当前设备失败");
|
||||
|
||||
// 设置用户运营区ID
|
||||
int updateAreaId = userService.updateAreaId(vo.getUserId(), vo.getAreaId());
|
||||
ServiceUtil.assertion(updateAreaId != 1, "更新用户运营区ID失败");
|
||||
|
||||
// 加入延时队列,超时取消
|
||||
this.cancelWhenExpired(order);
|
||||
|
||||
|
|
|
@ -60,23 +60,6 @@ public class OrderUtil {
|
|||
public static OrderFeeVO calcOrderFee(OrderVO order, AreaVO area, OrderInParkingVO inParkingVO, LocalDateTime endTime) {
|
||||
OrderFeeVO vo = new OrderFeeVO();
|
||||
|
||||
// 运营区外调度费
|
||||
if (!inParkingVO.getInArea()) {
|
||||
BigDecimal manageFee = area.getVehicleManagementFee();
|
||||
if (manageFee == null) {
|
||||
manageFee = BigDecimal.ZERO;
|
||||
}
|
||||
vo.setManageFee(manageFee);
|
||||
}
|
||||
// 停车点外调度费
|
||||
else if (!inParkingVO.getInParking()) {
|
||||
BigDecimal dispatchFee = area.getDispatchFee();
|
||||
if (dispatchFee == null) {
|
||||
dispatchFee = BigDecimal.ZERO;
|
||||
}
|
||||
vo.setDispatchFee(dispatchFee);
|
||||
}
|
||||
|
||||
// 骑行费
|
||||
Duration duration = Duration.between(order.getStartTime(), endTime);
|
||||
long seconds = duration.getSeconds();
|
||||
|
@ -87,6 +70,31 @@ public class OrderUtil {
|
|||
vo.setRidingFee(SuitUtil.calcAmountForIntervalFee(seconds, order.getSuitIntervalRule(), rentalUnit));
|
||||
}
|
||||
|
||||
// 剩余押金金额
|
||||
BigDecimal surplusDepositFee = MathUtils.subtractDecimal(
|
||||
order.getDepositFee(),
|
||||
vo.getRidingFee()
|
||||
);
|
||||
|
||||
// 运营区外调度费
|
||||
if (!inParkingVO.getInArea()) {
|
||||
BigDecimal manageFee = area.getVehicleManagementFee();
|
||||
manageFee = MathUtils.min(manageFee, surplusDepositFee);
|
||||
if (manageFee == null) {
|
||||
manageFee = BigDecimal.ZERO;
|
||||
}
|
||||
vo.setManageFee(manageFee);
|
||||
}
|
||||
// 停车点外调度费
|
||||
else if (!inParkingVO.getInParking()) {
|
||||
BigDecimal dispatchFee = area.getDispatchFee();
|
||||
dispatchFee = MathUtils.min(dispatchFee, surplusDepositFee);
|
||||
if (dispatchFee == null) {
|
||||
dispatchFee = BigDecimal.ZERO;
|
||||
}
|
||||
vo.setDispatchFee(dispatchFee);
|
||||
}
|
||||
|
||||
// 总费用
|
||||
vo.setTotalFee(MathUtils.addDecimal(
|
||||
vo.getRidingFee(),
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package com.ruoyi.bst.withdraw.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2025/4/7
|
||||
|
@ -12,6 +15,10 @@ import java.util.List;
|
|||
@Data
|
||||
public class WithdrawQuery extends WithdrawVO {
|
||||
|
||||
@ApiModelProperty("创建日期范围")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private List<LocalDate> createDateRange;
|
||||
|
||||
@ApiModelProperty("状态列表")
|
||||
private List<String> statusList;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package com.ruoyi.bst.withdraw.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class WithdrawStatVO {
|
||||
|
||||
@ApiModelProperty("成功提现金额")
|
||||
private BigDecimal successAmount;
|
||||
|
||||
}
|
|
@ -1,11 +1,14 @@
|
|||
package com.ruoyi.bst.withdraw.mapper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import com.ruoyi.bst.withdraw.domain.Withdraw;
|
||||
import com.ruoyi.bst.withdraw.domain.WithdrawVO;
|
||||
import com.ruoyi.bst.withdraw.domain.WithdrawQuery;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.ruoyi.bst.withdraw.domain.Withdraw;
|
||||
import com.ruoyi.bst.withdraw.domain.WithdrawQuery;
|
||||
import com.ruoyi.bst.withdraw.domain.WithdrawVO;
|
||||
|
||||
/**
|
||||
* 提现Mapper接口
|
||||
*
|
||||
|
@ -67,4 +70,9 @@ public interface WithdrawMapper
|
|||
* 根据条件更新
|
||||
*/
|
||||
int updateByQuery(@Param("data") Withdraw data, @Param("query") WithdrawQuery query);
|
||||
|
||||
/**
|
||||
* 根据条件查询金额
|
||||
*/
|
||||
BigDecimal selectSumOfAmount(@Param("query") WithdrawQuery query);
|
||||
}
|
||||
|
|
|
@ -62,6 +62,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="query.createDateRange != null and query.createDateRange.size() >= 2">
|
||||
and date(bw.create_time) >= #{query.createDateRange[0]}
|
||||
and date(bw.create_time) <= #{query.createDateRange[1]}
|
||||
</if>
|
||||
${query.params.dataScope}
|
||||
</sql>
|
||||
|
||||
|
@ -179,4 +183,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- selectSumOfAmount -->
|
||||
|
||||
<select id="selectSumOfAmount" parameterType="WithdrawQuery" resultType="BigDecimal">
|
||||
select sum(bw.amount)
|
||||
from bst_withdraw bw
|
||||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package com.ruoyi.bst.withdraw.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.bst.withdraw.domain.WithdrawQuery;
|
||||
import com.ruoyi.bst.withdraw.domain.vo.WithdrawStatVO;
|
||||
|
||||
public interface WithdrawDashboard {
|
||||
|
||||
/**
|
||||
* 查询提现统计
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
WithdrawStatVO selectStat(WithdrawQuery query, List<String> keys);
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package com.ruoyi.bst.withdraw.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ruoyi.bst.withdraw.domain.WithdrawQuery;
|
||||
import com.ruoyi.bst.withdraw.domain.enums.WithdrawStatus;
|
||||
import com.ruoyi.bst.withdraw.domain.vo.WithdrawStatVO;
|
||||
import com.ruoyi.bst.withdraw.mapper.WithdrawMapper;
|
||||
import com.ruoyi.bst.withdraw.service.WithdrawDashboard;
|
||||
import com.ruoyi.common.utils.MathUtils;
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import com.ruoyi.dashboard.constants.StatKeys;
|
||||
|
||||
@Service
|
||||
public class WithdrawDashboardImpl implements WithdrawDashboard {
|
||||
|
||||
@Autowired
|
||||
private WithdrawMapper withdrawMapper;
|
||||
|
||||
@Override
|
||||
public WithdrawStatVO selectStat(WithdrawQuery query, List<String> keys) {
|
||||
WithdrawStatVO vo = new WithdrawStatVO();
|
||||
if (keys.contains(StatKeys.WITHDRAW_SUCCESS_AMOUNT)) {
|
||||
vo.setSuccessAmount(this.selectSuccessAmount(query));
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
private BigDecimal selectSuccessAmount(WithdrawQuery query) {
|
||||
WithdrawQuery successQuery = new WithdrawQuery();
|
||||
BeanUtils.copyProperties(query, successQuery);
|
||||
successQuery.setStatus(WithdrawStatus.SUCCESS.getCode());
|
||||
return MathUtils.dv(withdrawMapper.selectSumOfAmount(successQuery));
|
||||
}
|
||||
}
|
|
@ -31,6 +31,10 @@ public class StatKeys {
|
|||
public static final String USER_TODAY_COUNT = "user_today_count";
|
||||
// 用户余额
|
||||
public static final String USER_BALANCE = "user_balance";
|
||||
// 运营商数量
|
||||
public static final String USER_MCH_COUNT = "user_mch_count";
|
||||
// 代理商数量
|
||||
public static final String USER_AGENT_COUNT = "user_agent_count";
|
||||
|
||||
// 设备数量
|
||||
public static final String DEVICE_COUNT = "device_count";
|
||||
|
@ -44,4 +48,12 @@ public class StatKeys {
|
|||
|
||||
// 型号数量
|
||||
public static final String MODEL_COUNT = "model_count";
|
||||
|
||||
// 加盟商数量
|
||||
public static final String AREA_JOIN_COUNT = "area_join_count";
|
||||
// 合伙人数量
|
||||
public static final String AREA_JOIN_PARTNER_COUNT = "area_join_partner_count";
|
||||
|
||||
// 成功提现金额
|
||||
public static final String WITHDRAW_SUCCESS_AMOUNT = "withdraw_success_amount";
|
||||
}
|
||||
|
|
|
@ -30,4 +30,10 @@ public class StatQuery {
|
|||
@ApiModelProperty("查询数据")
|
||||
private List<String> keys;
|
||||
|
||||
@ApiModelProperty("用户ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("运营区ID")
|
||||
private Long areaId;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
package com.ruoyi.dashboard.domain.stat;
|
||||
|
||||
import com.ruoyi.bst.area.domain.vo.AreaStatVO;
|
||||
import com.ruoyi.bst.areaJoin.domain.vo.AreaJoinStatVO;
|
||||
import com.ruoyi.bst.bonus.domain.vo.BonusStatVO;
|
||||
import com.ruoyi.bst.bonusRefund.domain.vo.BonusRefundStatVO;
|
||||
import com.ruoyi.bst.device.domain.vo.DeviceStatVO;
|
||||
import com.ruoyi.bst.model.domain.vo.ModelStatVO;
|
||||
import com.ruoyi.bst.order.domain.vo.OrderRefundStatVO;
|
||||
import com.ruoyi.bst.order.domain.vo.OrderStatVO;
|
||||
import com.ruoyi.bst.withdraw.domain.vo.WithdrawStatVO;
|
||||
import com.ruoyi.system.user.domain.vo.UserStatVO;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
@ -41,4 +43,10 @@ public class StatVO {
|
|||
|
||||
@ApiModelProperty("型号统计")
|
||||
private ModelStatVO model;
|
||||
|
||||
@ApiModelProperty("加盟商统计")
|
||||
private AreaJoinStatVO areaJoin;
|
||||
|
||||
@ApiModelProperty("提现统计")
|
||||
private WithdrawStatVO withdraw;
|
||||
}
|
||||
|
|
|
@ -1,19 +1,24 @@
|
|||
package com.ruoyi.dashboard.service;
|
||||
|
||||
import com.ruoyi.bst.bonus.domain.vo.BonusDailyStatVO;
|
||||
import com.ruoyi.bst.bonusRefund.domain.vo.BonusRefundDailyStatVO;
|
||||
import com.ruoyi.bst.order.domain.vo.OrderDailyRefundStatVO;
|
||||
import com.ruoyi.bst.order.domain.vo.OrderDailyStatVO;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ruoyi.bst.area.service.AreaDashboard;
|
||||
import com.ruoyi.bst.areaJoin.service.AreaJoinDashboard;
|
||||
import com.ruoyi.bst.bonus.domain.vo.BonusDailyStatVO;
|
||||
import com.ruoyi.bst.bonus.service.BonusDashboard;
|
||||
import com.ruoyi.bst.bonusRefund.domain.vo.BonusRefundDailyStatVO;
|
||||
import com.ruoyi.bst.bonusRefund.service.BonusRefundDashboard;
|
||||
import com.ruoyi.bst.device.service.DeviceDashboard;
|
||||
import com.ruoyi.bst.model.service.ModelDashboard;
|
||||
import com.ruoyi.bst.order.domain.vo.OrderDailyRefundStatVO;
|
||||
import com.ruoyi.bst.order.domain.vo.OrderDailyStatVO;
|
||||
import com.ruoyi.bst.order.service.OrderDashboard;
|
||||
import com.ruoyi.bst.withdraw.service.WithdrawDashboard;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
import com.ruoyi.dashboard.domain.dailyStat.DailyStatQuery;
|
||||
import com.ruoyi.dashboard.domain.dailyStat.DailyStatVO;
|
||||
import com.ruoyi.dashboard.domain.stat.StatQuery;
|
||||
|
@ -21,9 +26,6 @@ import com.ruoyi.dashboard.domain.stat.StatVO;
|
|||
import com.ruoyi.dashboard.utils.DashboardUtil;
|
||||
import com.ruoyi.system.user.service.UserDashboard;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class DashboardService {
|
||||
|
||||
|
@ -48,6 +50,12 @@ public class DashboardService {
|
|||
@Autowired
|
||||
private BonusRefundDashboard bonusRefundDashboard;
|
||||
|
||||
@Autowired
|
||||
private AreaJoinDashboard areaJoinDashboard;
|
||||
|
||||
@Autowired
|
||||
private WithdrawDashboard withdrawDashboard;
|
||||
|
||||
public StatVO selectStat(StatQuery query) {
|
||||
StatVO vo = new StatVO();
|
||||
vo.setOrder(orderDashboard.selectStat(DashboardUtil.toOrderQuery(query), query.getKeys()));
|
||||
|
@ -58,6 +66,8 @@ public class DashboardService {
|
|||
vo.setDevice(deviceDashboard.selectStat(DashboardUtil.toDeviceQuery(query), query.getKeys()));
|
||||
vo.setArea(areaDashboard.selectStat(DashboardUtil.toAreaQuery(query), query.getKeys()));
|
||||
vo.setModel(modelDashboard.selectStat(DashboardUtil.toModelQuery(query), query.getKeys()));
|
||||
vo.setAreaJoin(areaJoinDashboard.selectStat(DashboardUtil.toAreaJoinQuery(query), query.getKeys()));
|
||||
vo.setWithdraw(withdrawDashboard.selectStat(DashboardUtil.toWithdrawQuery(query), query.getKeys()));
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
package com.ruoyi.dashboard.utils;
|
||||
|
||||
import com.ruoyi.bst.area.domain.AreaQuery;
|
||||
import com.ruoyi.bst.areaJoin.domain.AreaJoinQuery;
|
||||
import com.ruoyi.bst.bonus.domain.BonusQuery;
|
||||
import com.ruoyi.bst.bonus.domain.enums.BonusArrivalType;
|
||||
import com.ruoyi.bst.bonusRefund.domain.BonusRefundQuery;
|
||||
import com.ruoyi.bst.device.domain.DeviceQuery;
|
||||
import com.ruoyi.bst.model.domain.ModelQuery;
|
||||
import com.ruoyi.bst.order.domain.OrderQuery;
|
||||
import com.ruoyi.bst.order.domain.query.OrderRefundQuery;
|
||||
import com.ruoyi.dashboard.domain.dailyStat.DailyStatQuery;
|
||||
import com.ruoyi.bst.withdraw.domain.WithdrawQuery;
|
||||
import com.ruoyi.dashboard.domain.stat.StatQuery;
|
||||
import com.ruoyi.system.user.domain.UserQuery;
|
||||
|
||||
|
@ -17,6 +19,8 @@ public class DashboardUtil {
|
|||
OrderQuery query = new OrderQuery();
|
||||
query.setCreateDateRange(params.getDateRange());
|
||||
query.setStatusList(params.getOrderStatusList());
|
||||
query.setBonusUserId(params.getUserId());
|
||||
query.setAreaId(params.getAreaId());
|
||||
query.setScope(params.getScope());
|
||||
return query;
|
||||
}
|
||||
|
@ -25,6 +29,8 @@ public class DashboardUtil {
|
|||
OrderRefundQuery query = new OrderRefundQuery();
|
||||
query.setRefundCreateDateRange(params.getDateRange());
|
||||
query.setStatusList(params.getRefundStatusList());
|
||||
query.setBonusUserId(params.getUserId());
|
||||
query.setAreaId(params.getAreaId());
|
||||
query.setScope(params.getScope());
|
||||
return query;
|
||||
}
|
||||
|
@ -33,6 +39,9 @@ public class DashboardUtil {
|
|||
BonusQuery query = new BonusQuery();
|
||||
query.setCreateDateRange(params.getDateRange());
|
||||
query.setStatusList(params.getBonusStatusList());
|
||||
query.setArrivalId(params.getUserId());
|
||||
query.setArrivalTypes(BonusArrivalType.userList());
|
||||
query.setAreaId(params.getAreaId());
|
||||
query.setScope(params.getScope());
|
||||
return query;
|
||||
}
|
||||
|
@ -41,6 +50,9 @@ public class DashboardUtil {
|
|||
BonusRefundQuery query = new BonusRefundQuery();
|
||||
query.setCreateDateRange(params.getDateRange());
|
||||
query.setBonusStatusList(params.getBonusStatusList());
|
||||
query.setBonusArrivalId(params.getUserId());
|
||||
query.setBonusArrivalTypes(BonusArrivalType.userList());
|
||||
query.setBonusAreaId(params.getAreaId());
|
||||
query.setScope(params.getScope());
|
||||
return query;
|
||||
}
|
||||
|
@ -48,25 +60,48 @@ public class DashboardUtil {
|
|||
public static UserQuery toUserQuery(StatQuery query) {
|
||||
UserQuery userQuery = new UserQuery();
|
||||
userQuery.setScope(query.getScope());
|
||||
userQuery.setUserId(query.getUserId());
|
||||
userQuery.setAreaId(query.getAreaId());
|
||||
return userQuery;
|
||||
}
|
||||
|
||||
public static DeviceQuery toDeviceQuery(StatQuery query) {
|
||||
DeviceQuery deviceQuery = new DeviceQuery();
|
||||
deviceQuery.setScope(query.getScope());
|
||||
deviceQuery.setMchId(query.getUserId());
|
||||
deviceQuery.setAreaId(query.getAreaId());
|
||||
return deviceQuery;
|
||||
}
|
||||
|
||||
public static AreaQuery toAreaQuery(StatQuery query) {
|
||||
AreaQuery areaQuery = new AreaQuery();
|
||||
areaQuery.setScope(query.getScope());
|
||||
areaQuery.setUserId(query.getUserId());
|
||||
areaQuery.setId(query.getAreaId());
|
||||
return areaQuery;
|
||||
}
|
||||
|
||||
public static ModelQuery toModelQuery(StatQuery query) {
|
||||
ModelQuery modelQuery = new ModelQuery();
|
||||
modelQuery.setScope(query.getScope());
|
||||
modelQuery.setUserId(query.getUserId());
|
||||
return modelQuery;
|
||||
}
|
||||
|
||||
public static AreaJoinQuery toAreaJoinQuery(StatQuery query) {
|
||||
AreaJoinQuery areaJoinQuery = new AreaJoinQuery();
|
||||
areaJoinQuery.setScope(query.getScope());
|
||||
areaJoinQuery.setMchId(query.getUserId());
|
||||
areaJoinQuery.setAreaId(query.getAreaId());
|
||||
return areaJoinQuery;
|
||||
}
|
||||
|
||||
public static WithdrawQuery toWithdrawQuery(StatQuery query) {
|
||||
WithdrawQuery withdrawQuery = new WithdrawQuery();
|
||||
withdrawQuery.setCreateDateRange(query.getDateRange());
|
||||
withdrawQuery.setUserId(query.getUserId());
|
||||
withdrawQuery.setScope(query.getScope());
|
||||
return withdrawQuery;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import com.ruoyi.bst.device.service.DeviceService;
|
|||
import com.ruoyi.bst.device.utils.DeviceUtil;
|
||||
import com.ruoyi.bst.locationLog.domain.LocationLog;
|
||||
import com.ruoyi.bst.locationLog.service.LocationLogConverter;
|
||||
import com.ruoyi.bst.orderDevice.domain.enums.OrderDeviceStatus;
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
|
@ -144,6 +145,7 @@ public class IotReceiveServiceImpl implements IotReceiveService {
|
|||
|
||||
// 车辆是否开锁
|
||||
boolean isOpen = DeviceLockStatus.OPEN.getCode().equals(device.getLockStatus());
|
||||
boolean isQLocked = DeviceStatus.Q_LOCKED.getCode().equals(device.getStatus());
|
||||
|
||||
BigDecimal boundaryDistance = area.getBoundaryDistance();// 靠近运营区边界时的播报距离
|
||||
BigDecimal outAreaDistance = area.getOutageDistance();// 超出运营区外断电距离
|
||||
|
@ -163,8 +165,10 @@ public class IotReceiveServiceImpl implements IotReceiveService {
|
|||
AreaSubVO nearAreaSub = AreaSubUtil.getNearAreaSub(noRidingList, device.getLongitude(), device.getLatitude(), boundaryDistance);
|
||||
boolean isNearyNoRidingArea = nearAreaSub != null;
|
||||
|
||||
// 在运营区内,并且不在禁行区内,并且车辆为关锁状态,为车辆上电
|
||||
if (isInAreaMax && !isInNoRidingArea && !isOpen) {
|
||||
boolean hasOrder = device.getOrderDeviceId() != null && OrderDeviceStatus.USING.getCode().equals(device.getOrderDeviceStatus());
|
||||
|
||||
// 在运营区内,并且不在禁行区内,并且车辆为强制断电状态,为车辆上电
|
||||
if (isInAreaMax && !isInNoRidingArea && isQLocked && !isOpen && hasOrder) {
|
||||
deviceIotService.unlock(device, false, "重新返回运营区上电", false);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,12 @@ public class UserStatVO {
|
|||
@ApiModelProperty("用户数量")
|
||||
private Integer count;
|
||||
|
||||
@ApiModelProperty("运营商数量")
|
||||
private Integer mchCount;
|
||||
|
||||
@ApiModelProperty("代理商数量")
|
||||
private Integer agentCount;
|
||||
|
||||
@ApiModelProperty("用户余额")
|
||||
private BigDecimal balance;
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
u.withdraw_service_type,
|
||||
u.withdraw_service_value,
|
||||
u.area_id,
|
||||
u.bonus_delay,
|
||||
d.dept_id,
|
||||
d.parent_id,
|
||||
d.ancestors,
|
||||
|
@ -284,6 +285,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="withdrawServiceType != null">withdraw_service_type,</if>
|
||||
<if test="withdrawServiceValue != null">withdraw_service_value,</if>
|
||||
<if test="areaId != null">area_id,</if>
|
||||
<if test="bonusDelay != null">bonus_delay,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="userId != null and userId != ''">#{userId},</if>
|
||||
|
@ -308,6 +310,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="withdrawServiceType != null">#{withdrawServiceType},</if>
|
||||
<if test="withdrawServiceValue != null">#{withdrawServiceValue},</if>
|
||||
<if test="areaId != null">#{areaId},</if>
|
||||
<if test="bonusDelay != null">#{bonusDelay},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
@ -338,6 +341,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="withdrawServiceType != null">withdraw_service_type = #{withdrawServiceType},</if>
|
||||
<if test="withdrawServiceValue != null">withdraw_service_value = #{withdrawServiceValue},</if>
|
||||
<if test="areaId != null">area_id = #{areaId},</if>
|
||||
<if test="bonusDelay != null">bonus_delay = #{bonusDelay},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where user_id = #{userId}
|
||||
|
|
|
@ -256,4 +256,12 @@ public interface UserService
|
|||
* @return 结果
|
||||
*/
|
||||
public int subtractBalance(Long userId, BigDecimal amount, BalanceLogBstType bstType, Long bstId, String reason, boolean checkBalance);
|
||||
|
||||
/**
|
||||
* 更新用户运营区ID
|
||||
* @param userId 用户ID
|
||||
* @param areaId 运营区ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAreaId(Long userId, Long areaId);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,9 @@ import java.util.List;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ruoyi.common.constant.RoleConstants;
|
||||
import com.ruoyi.common.utils.MathUtils;
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import com.ruoyi.dashboard.constants.StatKeys;
|
||||
import com.ruoyi.system.user.domain.UserQuery;
|
||||
import com.ruoyi.system.user.domain.vo.UserStatVO;
|
||||
|
@ -33,7 +35,26 @@ public class UserDashboardImpl implements UserDashboard {
|
|||
if (keys.contains(StatKeys.USER_BALANCE)) {
|
||||
vo.setBalance(MathUtils.dv(userMapper.selectSumOfBalance(query)));
|
||||
}
|
||||
if (keys.contains(StatKeys.USER_MCH_COUNT)) {
|
||||
vo.setMchCount(this.selectMchCount(query));
|
||||
}
|
||||
if (keys.contains(StatKeys.USER_AGENT_COUNT)) {
|
||||
vo.setAgentCount(this.selectAgentCount(query));
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
private Integer selectMchCount(UserQuery query) {
|
||||
UserQuery mchQuery = new UserQuery();
|
||||
BeanUtils.copyProperties(query, mchQuery);
|
||||
mchQuery.setRoleKey(RoleConstants.MCH);
|
||||
return userMapper.selectCount(mchQuery);
|
||||
}
|
||||
|
||||
private Integer selectAgentCount(UserQuery query) {
|
||||
UserQuery agentQuery = new UserQuery();
|
||||
BeanUtils.copyProperties(query, agentQuery);
|
||||
agentQuery.setRoleKey(RoleConstants.AGENT);
|
||||
return userMapper.selectCount(agentQuery);
|
||||
}
|
||||
}
|
|
@ -1,17 +1,14 @@
|
|||
package com.ruoyi.system.user.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.validation.Validator;
|
||||
|
||||
import com.ruoyi.common.constants.ConfigKeys;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -27,6 +24,7 @@ import com.ruoyi.bst.balanceLog.domain.enums.BalanceLogBstType;
|
|||
import com.ruoyi.bst.balanceLog.service.BalanceLogService;
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.constants.ConfigKeys;
|
||||
import com.ruoyi.common.core.domain.entity.Role;
|
||||
import com.ruoyi.common.core.domain.entity.User;
|
||||
import com.ruoyi.common.core.domain.vo.UserVO;
|
||||
|
@ -299,8 +297,8 @@ public class UserServiceImpl implements UserService
|
|||
if (user.getPassword() != null) {
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
}
|
||||
// 设置默认服务费
|
||||
this.setDefaultServiceType(user);
|
||||
// 设置默认信息
|
||||
this.setDefaultInfo(user);
|
||||
|
||||
// 操作数据库
|
||||
Integer result = transactionTemplate.execute(status -> {
|
||||
|
@ -324,7 +322,7 @@ public class UserServiceImpl implements UserService
|
|||
return result == null ? 0 : result;
|
||||
}
|
||||
|
||||
private void setDefaultServiceType(UserVO user) {
|
||||
private void setDefaultInfo(UserVO user) {
|
||||
if (StringUtils.isBlank(user.getWithdrawServiceType()) || user.getWithdrawServiceValue() == null) {
|
||||
String type = configService.selectConfigByKey(ConfigKeys.USER_DEFAULT_WITHDRAW_SERVICE_TYPE);
|
||||
BigDecimal value = configService.getDecimal(ConfigKeys.USER_DEFAULT_WITHDRAW_SERVICE_VALUE);
|
||||
|
@ -333,6 +331,9 @@ public class UserServiceImpl implements UserService
|
|||
user.setWithdrawServiceValue(value);
|
||||
}
|
||||
}
|
||||
if (user.getBonusDelay() == null) {
|
||||
user.setBonusDelay(24);
|
||||
}
|
||||
}
|
||||
|
||||
void clearCache() {
|
||||
|
@ -778,4 +779,14 @@ public class UserServiceImpl implements UserService
|
|||
return result == null ? 0 : result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateAreaId(Long userId, Long areaId) {
|
||||
if (userId == null || areaId == null) {
|
||||
return 0;
|
||||
}
|
||||
User user = new User();
|
||||
user.setUserId(userId);
|
||||
user.setAreaId(areaId);
|
||||
return userMapper.updateUser(user);
|
||||
}
|
||||
}
|
||||
|
|
22
ruoyi-web/src/main/java/com/ruoyi/task/bonus/BonusTask.java
Normal file
22
ruoyi-web/src/main/java/com/ruoyi/task/bonus/BonusTask.java
Normal file
|
@ -0,0 +1,22 @@
|
|||
package com.ruoyi.task.bonus;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.ruoyi.bst.bonus.service.BonusService;
|
||||
|
||||
@Component
|
||||
public class BonusTask {
|
||||
|
||||
@Autowired
|
||||
private BonusService bonusService;
|
||||
|
||||
/**
|
||||
* 分成打款
|
||||
*/
|
||||
public void payBonus() {
|
||||
bonusService.payBonusBeforeTime(LocalDateTime.now());
|
||||
}
|
||||
}
|
|
@ -4,7 +4,6 @@ import java.util.List;
|
|||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.common.annotation.DataScope;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
@ -73,6 +72,18 @@ public class AreaController extends BaseController
|
|||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询运营区简单数据
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bst:area:list')")
|
||||
@GetMapping("/simpleList")
|
||||
public AjaxResult simpleList(AreaQuery query)
|
||||
{
|
||||
query.setScope(true);
|
||||
List<AreaVO> list = areaService.selectSimpleList(query);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出运营区列表
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.web.common;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -17,6 +18,10 @@ import com.ruoyi.common.core.domain.model.LoginBody;
|
|||
import com.ruoyi.common.core.domain.model.WxLoginBody;
|
||||
import com.ruoyi.common.core.domain.vo.UserVO;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.dashboard.constants.StatKeys;
|
||||
import com.ruoyi.dashboard.domain.stat.StatQuery;
|
||||
import com.ruoyi.dashboard.domain.stat.StatVO;
|
||||
import com.ruoyi.dashboard.service.DashboardService;
|
||||
import com.ruoyi.framework.web.service.SysLoginService;
|
||||
import com.ruoyi.framework.web.service.SysPermissionService;
|
||||
import com.ruoyi.system.menu.service.MenuService;
|
||||
|
@ -42,6 +47,9 @@ public class LoginController
|
|||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private DashboardService dashboardService;
|
||||
|
||||
/**
|
||||
* 登录方法
|
||||
*
|
||||
|
@ -94,10 +102,21 @@ public class LoginController
|
|||
Set<String> roles = permissionService.getRolePermission(user);
|
||||
// 权限集合
|
||||
Set<String> permissions = permissionService.getMenuPermission(user);
|
||||
// 统计数据
|
||||
StatQuery query = new StatQuery();
|
||||
query.setScope(true);
|
||||
query.setUserId(user.getUserId());
|
||||
query.setKeys(Arrays.asList(
|
||||
StatKeys.WITHDRAW_SUCCESS_AMOUNT,
|
||||
StatKeys.BONUS_WAIT_DIVIDE_AMOUNT
|
||||
));
|
||||
StatVO stat = dashboardService.selectStat(query);
|
||||
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("user", user);
|
||||
ajax.put("roles", roles);
|
||||
ajax.put("permissions", permissions);
|
||||
ajax.put("stat", stat);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
package com.ruoyi.web.dashboard;
|
||||
|
||||
import com.ruoyi.bst.bonus.constants.BonusDailyKeys;
|
||||
import com.ruoyi.bst.bonusRefund.constants.BonusRefundDailyKeys;
|
||||
import com.ruoyi.bst.order.constants.OrderDailyKeys;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.ruoyi.bst.bonus.constants.BonusDailyKeys;
|
||||
import com.ruoyi.bst.bonus.domain.enums.BonusStatus;
|
||||
import com.ruoyi.bst.bonusRefund.constants.BonusRefundDailyKeys;
|
||||
import com.ruoyi.bst.order.constants.OrderDailyKeys;
|
||||
import com.ruoyi.bst.order.domain.enums.OrderStatus;
|
||||
import com.ruoyi.bst.refund.domain.enums.RefundStatus;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
|
@ -20,8 +22,6 @@ import com.ruoyi.dashboard.service.DashboardService;
|
|||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/dashboard")
|
||||
public class DashboardController extends BaseController {
|
||||
|
|
|
@ -9,12 +9,14 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.ruoyi.bst.order.constants.OrderDailyKeys;
|
||||
import com.ruoyi.bst.order.domain.OrderQuery;
|
||||
import com.ruoyi.bst.order.domain.enums.OrderStatus;
|
||||
import com.ruoyi.bst.order.domain.query.OrderRefundQuery;
|
||||
import com.ruoyi.bst.order.domain.vo.OrderDailyRefundStatVO;
|
||||
import com.ruoyi.bst.order.domain.vo.OrderDailyStatVO;
|
||||
import com.ruoyi.bst.order.domain.vo.OrderRankVO;
|
||||
import com.ruoyi.bst.order.service.OrderDashboard;
|
||||
import com.ruoyi.bst.refund.domain.enums.RefundStatus;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
|
@ -65,4 +67,14 @@ public class DashboardOrderController extends BaseController {
|
|||
return success(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('dashboard:order:rank')")
|
||||
@GetMapping("/rank")
|
||||
public AjaxResult getRank(OrderQuery query) {
|
||||
query.setScope(true);
|
||||
query.setStatusList(OrderStatus.valid());
|
||||
PageHelper.startPage(1, 10);
|
||||
startOrderBy();
|
||||
List<OrderRankVO> list = orderDashboard.selectRank(query);
|
||||
return success(list);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user