首页更新(一半)

This commit is contained in:
墨大叔 2024-08-06 17:43:10 +08:00
parent 3ae0c70b87
commit b548e1aad1
31 changed files with 445 additions and 63 deletions

View File

@ -45,4 +45,14 @@ public class CacheConstants
public static final String ACCESS_KEY_PREFIX = "access:"; public static final String ACCESS_KEY_PREFIX = "access:";
public static final String USER_PREFIX = "user:"; public static final String USER_PREFIX = "user:";
/**
* 仪表盘
*/
public static final String DASHBOARD_PREFIX = "dashboard:";
/**
* 舆情分析
*/
public static final String BRIEF = DASHBOARD_PREFIX + "brief";
} }

View File

@ -0,0 +1,83 @@
package com.ruoyi.dashboard;
import com.ruoyi.dashboard.vo.TodoListVO;
import com.ruoyi.ss.abnormal.domain.AbnormalQuery;
import com.ruoyi.ss.abnormal.domain.enums.AbnormalStatus;
import com.ruoyi.ss.abnormal.service.AbnormalService;
import com.ruoyi.ss.complaint.domain.SmComplaintQuery;
import com.ruoyi.ss.complaint.service.ISmComplaintService;
import com.ruoyi.ss.device.domain.DeviceQuery;
import com.ruoyi.ss.device.service.DeviceService;
import com.ruoyi.ss.mchApply.domain.MchApplyQuery;
import com.ruoyi.ss.mchApply.domain.enums.MchApplyStatus;
import com.ruoyi.ss.mchApply.service.IMchApplyService;
import com.ruoyi.ss.storeApply.domain.StoreApplyQuery;
import com.ruoyi.ss.storeApply.domain.enums.StoreApplyStatus;
import com.ruoyi.ss.storeApply.service.StoreApplyService;
import com.ruoyi.ss.transactionBill.domain.TransactionBillQuery;
import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillStatus;
import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillType;
import com.ruoyi.ss.transactionBill.service.TransactionBillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author wjh
* 2024/8/6
*/
@Service
public class DashboardService {
@Autowired
private TransactionBillService transactionBillService;
@Autowired
private IMchApplyService mchApplyService;
@Autowired
private AbnormalService abnormalService;
@Autowired
private ISmComplaintService complaintService;
@Autowired
private DeviceService deviceService;
@Autowired
private StoreApplyService storeApplyService;
public TodoListVO getTodoList() {
TodoListVO vo = new TodoListVO();
// 提现申请数量
TransactionBillQuery withdrawQuery = new TransactionBillQuery();
withdrawQuery.setType(TransactionBillType.WITHDRAW.getType());
withdrawQuery.setStatus(TransactionBillStatus.WITHDRAW_APPROVING.getStatus());
vo.setWithdrawCount(transactionBillService.selectSimpleCount(withdrawQuery));
// 商户合作申请
MchApplyQuery mchApplyQuery = new MchApplyQuery();
mchApplyQuery.setStatus(MchApplyStatus.APPROVING.getStatus());
vo.setMchApplyCount(mchApplyService.selectCount(mchApplyQuery));
// 店铺申请
StoreApplyQuery storeApplyQuery = new StoreApplyQuery();
storeApplyQuery.setStatus(StoreApplyStatus.WAIT_AUDIT.getStatus());
vo.setStoreApplyCount(storeApplyService.selectCount(storeApplyQuery));
// 设备故障
AbnormalQuery abnormalQuery = new AbnormalQuery();
abnormalQuery.setStatus(AbnormalStatus.UNREAD.getStatus());
vo.setAbnormalCount(abnormalService.selectCount(abnormalQuery));
// 投诉意见
vo.setComplaintCount(complaintService.selectCount(new SmComplaintQuery()));
// 过期设备
DeviceQuery deviceQuery = new DeviceQuery();
deviceQuery.setIsArrears(true);
vo.setArrearsDeviceCount(deviceService.selectCount(deviceQuery));
return vo;
}
}

View File

@ -0,0 +1,32 @@
package com.ruoyi.dashboard.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 待办事项VO
* @author wjh
* 2024/8/6
*/
@Data
public class TodoListVO {
@ApiModelProperty("提现申请数量")
private Integer withdrawCount;
@ApiModelProperty("商家合作申请数量")
private Integer mchApplyCount;
@ApiModelProperty("店铺审核数量")
private Integer storeApplyCount;
@ApiModelProperty("设备故障数量")
private Integer abnormalCount;
@ApiModelProperty("投诉意见数量")
private Integer complaintCount;
@ApiModelProperty("欠费设备数量")
private Integer arrearsDeviceCount;
}

View File

@ -44,4 +44,13 @@ public class SmBusinessRecord extends BaseEntity
@Excel(name = "充值总金额") @Excel(name = "充值总金额")
@ApiModelProperty("充值总金额") @ApiModelProperty("充值总金额")
private BigDecimal totalRecharge; private BigDecimal totalRecharge;
@ApiModelProperty("订单总数量")
private Integer rechargeCount;
@ApiModelProperty("月费总收入")
private BigDecimal totalMonth;
@ApiModelProperty("用户总余额")
private BigDecimal userBalance;
} }

View File

@ -4,27 +4,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.ss.businessRecord.mapper.SmBusinessRecordMapper"> <mapper namespace="com.ruoyi.ss.businessRecord.mapper.SmBusinessRecordMapper">
<resultMap type="SmBusinessRecordVo" id="SmBusinessRecordResult"> <resultMap type="SmBusinessRecordVo" id="SmBusinessRecordResult" autoMapping="true">
<result property="id" column="id" /> <result property="totalDevice" column="total_device" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullIntegerTyperHandler"/>
<result property="totalDevice" column="total_device" /> <result property="totalModel" column="total_model" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullIntegerTyperHandler"/>
<result property="totalModel" column="total_model" /> <result property="totalOnline" column="total_online" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullIntegerTyperHandler"/>
<result property="totalOnline" column="total_online" /> <result property="totalUser" column="total_user" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullIntegerTyperHandler"/>
<result property="totalUser" column="total_user" /> <result property="totalRecharge" column="total_recharge" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler"/>
<result property="createTime" column="create_time" /> <result property="rechargeCount" column="recharge_count" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullIntegerTyperHandler"/>
<result property="totalRecharge" column="total_recharge" /> <result property="totalMonth" column="total_month" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler"/>
<result property="createDate" column="create_date" /> <result property="userBalance" column="user_balance" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler"/>
</resultMap> </resultMap>
<sql id="selectSmBusinessRecordVo"> <sql id="selectSmBusinessRecordVo">
select id, total_device, total_model, total_online, total_user, create_time, total_recharge from sm_business_record select
sbr.id,
sbr.total_device,
sbr.total_model,
sbr.total_online,
sbr.total_user,
sbr.create_time,
sbr.total_recharge,
sbr.recharge_count,
sbr.total_month,
sbr.user_balance
from sm_business_record sbr
</sql> </sql>
<sql id="searchCondition"> <sql id="searchCondition">
<if test="totalDevice != null "> and total_device = #{totalDevice}</if> <if test="totalDevice != null "> and sbr.total_device = #{totalDevice}</if>
<if test="totalModel != null "> and total_model = #{totalModel}</if> <if test="totalModel != null "> and sbr.total_model = #{totalModel}</if>
<if test="totalOnline != null "> and total_online = #{totalOnline}</if> <if test="totalOnline != null "> and sbr.total_online = #{totalOnline}</if>
<if test="totalUser != null "> and total_user = #{totalUser}</if> <if test="totalUser != null "> and sbr.total_user = #{totalUser}</if>
<if test="createDate != null "> and date(create_time) = date(#{createDate})</if> <if test="createDate != null "> and sbr.date(create_time) = date(#{createDate})</if>
</sql> </sql>
<select id="selectSmBusinessRecordList" parameterType="SmBusinessRecord" resultMap="SmBusinessRecordResult"> <select id="selectSmBusinessRecordList" parameterType="SmBusinessRecord" resultMap="SmBusinessRecordResult">
@ -83,6 +94,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="totalUser != null">total_user,</if> <if test="totalUser != null">total_user,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="totalRecharge != null">total_recharge,</if> <if test="totalRecharge != null">total_recharge,</if>
<if test="rechargeCount != null">recharge_count,</if>
<if test="totalMonth != null">total_month,</if>
<if test="userBalance != null">user_balance,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="totalDevice != null">#{totalDevice},</if> <if test="totalDevice != null">#{totalDevice},</if>
@ -91,6 +105,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="totalUser != null">#{totalUser},</if> <if test="totalUser != null">#{totalUser},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="totalRecharge != null">#{totalRecharge},</if> <if test="totalRecharge != null">#{totalRecharge},</if>
<if test="rechargeCount != null">#{rechargeCount},</if>
<if test="totalMonth != null">#{totalMonth},</if>
<if test="userBalance != null">#{userBalance},</if>
</trim> </trim>
</insert> </insert>
@ -103,6 +120,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="totalUser != null">total_user = #{totalUser},</if> <if test="totalUser != null">total_user = #{totalUser},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="totalRecharge != null">total_recharge = #{totalRecharge},</if> <if test="totalRecharge != null">total_recharge = #{totalRecharge},</if>
<if test="data.rechargeCount != null">recharge_count = #{data.rechargeCount},</if>
<if test="data.totalMonth != null">total_month = #{data.totalMonth},</if>
<if test="data.userBalance != null">user_balance = #{data.userBalance},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>

View File

@ -1,5 +1,7 @@
package com.ruoyi.ss.businessRecord.service; package com.ruoyi.ss.businessRecord.service;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.ss.businessRecord.domain.SmBusinessRecord; import com.ruoyi.ss.businessRecord.domain.SmBusinessRecord;
import com.ruoyi.ss.businessRecord.domain.SmBusinessRecordQuery; import com.ruoyi.ss.businessRecord.domain.SmBusinessRecordQuery;
@ -12,8 +14,12 @@ import com.ruoyi.ss.device.domain.enums.DeviceOnlineStatus;
import com.ruoyi.ss.device.service.DeviceService; import com.ruoyi.ss.device.service.DeviceService;
import com.ruoyi.ss.model.domain.SmModelQuery; import com.ruoyi.ss.model.domain.SmModelQuery;
import com.ruoyi.ss.model.service.ModelService; import com.ruoyi.ss.model.service.ModelService;
import com.ruoyi.ss.receiveBill.domain.ReceiveBillQuery;
import com.ruoyi.ss.receiveBill.domain.enums.ReceiveBillType;
import com.ruoyi.ss.receiveBill.service.ReceiveBillService;
import com.ruoyi.ss.transactionBill.domain.TransactionBillQuery; import com.ruoyi.ss.transactionBill.domain.TransactionBillQuery;
import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillStatus; import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillStatus;
import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillType;
import com.ruoyi.ss.transactionBill.service.TransactionBillService; import com.ruoyi.ss.transactionBill.service.TransactionBillService;
import com.ruoyi.ss.user.domain.SmUserQuery; import com.ruoyi.ss.user.domain.SmUserQuery;
import com.ruoyi.ss.user.service.ISmUserService; import com.ruoyi.ss.user.service.ISmUserService;
@ -21,8 +27,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit;
/** /**
* 经营记录Service业务层处理 * 经营记录Service业务层处理
@ -43,11 +52,14 @@ public class SmBusinessRecordServiceImpl implements ISmBusinessRecordService
private ISmUserService userService; private ISmUserService userService;
@Autowired @Autowired
private ModelService modelService; private ReceiveBillService receiveBillService;
@Autowired @Autowired
private TransactionBillService transactionBillService; private TransactionBillService transactionBillService;
@Autowired
private RedisCache redisCache;
/** /**
* 查询经营记录 * 查询经营记录
* *
@ -141,43 +153,81 @@ public class SmBusinessRecordServiceImpl implements ISmBusinessRecordService
*/ */
@Override @Override
public BriefVo selectBrief() { public BriefVo selectBrief() {
BriefVo brief = new BriefVo(); BriefVo brief = redisCache.getCacheObject(CacheConstants.BRIEF);
// if (brief == null ) {
brief = new BriefVo();
Date now = DateUtils.getNowDate();
// 设备总数 // 总订单数
DeviceQuery deviceDto = new DeviceQuery(); TransactionBillQuery rechargeQuery = new TransactionBillQuery();
deviceDto.setDeleted(false); rechargeQuery.setType(TransactionBillType.RECHARGE.getType());
deviceDto.setIsBind(true); brief.setRechargeCount(transactionBillService.selectSimpleCount(rechargeQuery));
brief.setDeviceCount(deviceService.selectCount(deviceDto));
// 在线设备总数 // 今日订单数
DeviceQuery onlineDto = new DeviceQuery(); TransactionBillQuery todayQuery = new TransactionBillQuery();
onlineDto.setOnlineStatus(DeviceOnlineStatus.ONLINE.getStatus()); todayQuery.setType(TransactionBillType.RECHARGE.getType());
onlineDto.setDeleted(false); todayQuery.setCreateDate(now);
onlineDto.setIsBind(true); brief.setTodayRechargeCount(transactionBillService.selectSimpleCount(todayQuery));
brief.setOnlineCount(deviceService.selectCount(onlineDto));
// 型号总数 // 设备总数
SmModelQuery modelDto = new SmModelQuery(); DeviceQuery deviceDto = new DeviceQuery();
modelDto.setDeleted(false); deviceDto.setDeleted(false);
brief.setModelCount(modelService.selectCount(modelDto)); deviceDto.setIsBind(true);
brief.setDeviceCount(deviceService.selectCount(deviceDto));
// 商户总数 // 在线设备总数
SmUserQuery userDto = new SmUserQuery(); DeviceQuery onlineDto = new DeviceQuery();
userDto.setIsMch(true); onlineDto.setOnlineStatus(DeviceOnlineStatus.ONLINE.getStatus());
brief.setUserCount(userService.selectCount(userDto)); onlineDto.setDeleted(false);
onlineDto.setIsBind(true);
brief.setOnlineCount(deviceService.selectCount(onlineDto));
// 租户总数 // 户总数
SmUserQuery tenantDto = new SmUserQuery(); SmUserQuery userDto = new SmUserQuery();
tenantDto.setIsMch(false); userDto.setIsMch(true);
brief.setTenantCount(userService.selectCount(tenantDto)); brief.setUserCount(userService.selectCount(userDto));
// 充值金额总数 // 租户总数
TransactionBillQuery rechargeDto = new TransactionBillQuery(); SmUserQuery tenantDto = new SmUserQuery();
rechargeDto.setStatus(TransactionBillStatus.SUCCESS.getStatus()); tenantDto.setIsMch(false);
List<BillCountVo> billCount = transactionBillService.selectCount(rechargeDto); brief.setTenantCount(userService.selectCount(tenantDto));
if (!CollectionUtils.isEmpty(billCount)) {
brief.setRechargeAmount(billCount.get(0).getRecharge()); // 充值金额总数
} TransactionBillQuery rechargeDto = new TransactionBillQuery();
rechargeDto.setStatus(TransactionBillStatus.SUCCESS.getStatus());
List<BillCountVo> billCount = transactionBillService.selectCount(rechargeDto);
if (!CollectionUtils.isEmpty(billCount) && billCount.get(0).getRecharge() != null) {
brief.setRechargeAmount(billCount.get(0).getRecharge());
} else {
brief.setRechargeAmount(BigDecimal.ZERO);
}
// 今日充值金额总数
TransactionBillQuery todayRechargeAmountQuery = new TransactionBillQuery();
todayRechargeAmountQuery.setStatus(TransactionBillStatus.SUCCESS.getStatus());
todayRechargeAmountQuery.setCreateDate(now);
List<BillCountVo> todayBillCount = transactionBillService.selectCount(todayRechargeAmountQuery);
if (!CollectionUtils.isEmpty(todayBillCount) && todayBillCount.get(0).getRecharge() != null) {
brief.setTodayRechargeAmount(todayBillCount.get(0).getRecharge());
} else {
brief.setTodayRechargeAmount(BigDecimal.ZERO);
}
// 用户总余额
brief.setTotalUserBalance(userService.selectSumOfBalance(new SmUserQuery()));
// 总月费
ReceiveBillQuery monthQuery = new ReceiveBillQuery();
monthQuery.setType(ReceiveBillType.MONTH.getType());
brief.setTotalMonthAmount(receiveBillService.selectSumOfAmount(monthQuery));
// 今日月费
monthQuery.setBillDate(LocalDate.now());
brief.setTodayMonthAmount(receiveBillService.selectSumOfAmount(monthQuery));
redisCache.setCacheObject(CacheConstants.BRIEF, brief, 30, TimeUnit.MINUTES);
// }
return brief; return brief;
} }
@ -192,9 +242,11 @@ public class SmBusinessRecordServiceImpl implements ISmBusinessRecordService
SmBusinessRecord data = new SmBusinessRecord(); SmBusinessRecord data = new SmBusinessRecord();
data.setTotalDevice(brief.getDeviceCount()); data.setTotalDevice(brief.getDeviceCount());
data.setTotalOnline(brief.getOnlineCount()); data.setTotalOnline(brief.getOnlineCount());
data.setTotalModel(brief.getModelCount());
data.setTotalUser(brief.getUserCount() + brief.getTenantCount()); data.setTotalUser(brief.getUserCount() + brief.getTenantCount());
data.setTotalRecharge(brief.getRechargeAmount()); data.setTotalRecharge(brief.getRechargeAmount());
data.setRechargeCount(brief.getTodayRechargeCount());
data.setTotalMonth(brief.getTotalMonthAmount());
data.setUserBalance(brief.getTotalUserBalance());
this.insertSmBusinessRecord(data); this.insertSmBusinessRecord(data);
} }
} }

View File

@ -61,4 +61,9 @@ public interface SmComplaintMapper
* @return 结果 * @return 结果
*/ */
public int deleteSmComplaintByIds(Long[] ids); public int deleteSmComplaintByIds(Long[] ids);
/**
* 查询数量
*/
int selectCount(SmComplaintQuery query);
} }

View File

@ -25,17 +25,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sc.picture, sc.picture,
sc.contact, sc.contact,
su.user_name user_name su.user_name user_name
from sm_complaint sc from <include refid="searchTables"/>
</sql>
<sql id="searchTables">
sm_complaint sc
left join sm_user su on su.user_id = sc.user_id left join sm_user su on su.user_id = sc.user_id
</sql> </sql>
<sql id="searchCondition">
<if test="userId != null "> and sc.user_id = #{userId}</if>
<if test="content != null and content != ''"> and sc.content = #{content}</if>
<if test="userName != null "> and su.user_name like concat('%', #{userName}, '%')</if>
<if test="type != null "> and sc.type = #{type}</if>
</sql>
<select id="selectSmComplaintList" parameterType="SmComplaintQuery" resultMap="SmComplaintResult"> <select id="selectSmComplaintList" parameterType="SmComplaintQuery" resultMap="SmComplaintResult">
<include refid="selectSmComplaintVo"/> <include refid="selectSmComplaintVo"/>
<where> <where>
<if test="userId != null "> and sc.user_id = #{userId}</if> <include refid="searchCondition"/>
<if test="content != null and content != ''"> and sc.content = #{content}</if>
<if test="userName != null "> and su.user_name like concat('%', #{userName}, '%')</if>
<if test="type != null "> and sc.type = #{type}</if>
</where> </where>
order by sc.create_time desc order by sc.create_time desc
</select> </select>
@ -45,6 +53,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where sc.id = #{id} where sc.id = #{id}
</select> </select>
<select id="selectCount" resultType="java.lang.Integer">
select count(sc.id)
from <include refid="searchTables"/>
<where>
<include refid="searchCondition"/>
</where>
</select>
<insert id="insertSmComplaint" parameterType="SmComplaint" useGeneratedKeys="true" keyProperty="id"> <insert id="insertSmComplaint" parameterType="SmComplaint" useGeneratedKeys="true" keyProperty="id">
insert into sm_complaint insert into sm_complaint
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">

View File

@ -61,4 +61,9 @@ public interface ISmComplaintService
* @return 结果 * @return 结果
*/ */
public int deleteSmComplaintById(Long id); public int deleteSmComplaintById(Long id);
/**
* 查询数量
*/
int selectCount(SmComplaintQuery query);
} }

View File

@ -94,4 +94,9 @@ public class SmComplaintServiceImpl implements ISmComplaintService
{ {
return smComplaintMapper.deleteSmComplaintById(id); return smComplaintMapper.deleteSmComplaintById(id);
} }
@Override
public int selectCount(SmComplaintQuery query) {
return smComplaintMapper.selectCount(query);
}
} }

View File

@ -14,11 +14,21 @@ import java.util.List;
@Data @Data
public class BriefVo { public class BriefVo {
private Integer deviceCount; // 设备数量 private Integer deviceCount; // 设备数量
private Integer modelCount; // 型号数量
private Integer onlineCount; // 在线数量 private Integer onlineCount; // 在线数量
private Integer userCount; // 商户用户数量 private Integer userCount; // 商户用户数量
private Integer tenantCount; // 租户用户数量 private Integer tenantCount; // 租户用户数量
private BigDecimal rechargeAmount; // 充值金额
private Integer rechargeCount; // 充值订单数量
private Integer todayRechargeCount; // 今日充值订单数量
private BigDecimal rechargeAmount; // 充值金额
private BigDecimal todayRechargeAmount; // 今日充值金额
private BigDecimal totalMonthAmount; // 总月费收入
private BigDecimal todayMonthAmount; // 今日月费收入
private BigDecimal totalUserBalance; // 用户总余额
private List<SmBusinessRecordVo> history; // 历史数据 private List<SmBusinessRecordVo> history; // 历史数据
} }

View File

@ -6,6 +6,7 @@ import com.ruoyi.ss.device.domain.enums.DeviceGroupByTable;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
/** /**
@ -60,4 +61,13 @@ public class DeviceQuery extends Device {
@ApiModelProperty("用户id列表") @ApiModelProperty("用户id列表")
private List<Long> userIds; private List<Long> userIds;
@ApiModelProperty("租期(起始)")
private LocalDateTime startRentTime;
@ApiModelProperty("租期(结束)")
private LocalDateTime endRentTime;
@ApiModelProperty("是否过期")
private Boolean isArrears;
} }

View File

@ -23,7 +23,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null"> and sd.user_id = #{userId}</if> <if test="userId != null"> and sd.user_id = #{userId}</if>
<if test="storeId != null"> and sd.store_id = #{storeId}</if> <if test="storeId != null"> and sd.store_id = #{storeId}</if>
<if test="deviceId != null"> and sd.device_id = #{deviceId}</if> <if test="deviceId != null"> and sd.device_id = #{deviceId}</if>
<if test="startRentTime != null"> and sd.rent_time >= #{startRentTime}</if>
<if test="endRentTime != null"> and sd.device_id &lt;= #{endRentTime}</if>
<if test="deviceNo != null"> and sd.device_no like concat('%', #{deviceNo}, '%')</if> <if test="deviceNo != null"> and sd.device_no like concat('%', #{deviceNo}, '%')</if>
<if test="isArrears != null">
<if test="isArrears">
and sd.rent_time is null or sd.rent_time &lt;= now()
</if>
<if test="!isArrears">
and sd.rent_time is not null and sd.rent_time > now()
</if>
</if>
<if test="deviceIds != null and deviceIds.size() > 0"> <if test="deviceIds != null and deviceIds.size() > 0">
and sd.device_id in and sd.device_id in
<foreach collection="deviceIds" open="(" close=")" separator="," item="item"> <foreach collection="deviceIds" open="(" close=")" separator="," item="item">

View File

@ -3,6 +3,8 @@ package com.ruoyi.ss.receiveBill.domain;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.time.LocalDate;
/** /**
* @author wjh * @author wjh
* 2024/7/22 * 2024/7/22
@ -10,12 +12,15 @@ import lombok.Data;
@Data @Data
public class ReceiveBillQuery extends ReceiveBill{ public class ReceiveBillQuery extends ReceiveBill{
@ApiModelProperty("年份") @ApiModelProperty("账单年份")
private Integer billYear; private Integer billYear;
@ApiModelProperty("月份") @ApiModelProperty("账单月份")
private Integer billMonth; private Integer billMonth;
@ApiModelProperty("账单日期")
private LocalDate billDate;
@ApiModelProperty("用户名称") @ApiModelProperty("用户名称")
private String userName; private String userName;

View File

@ -1,5 +1,6 @@
package com.ruoyi.ss.receiveBill.mapper; package com.ruoyi.ss.receiveBill.mapper;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import com.ruoyi.ss.receiveBill.domain.ReceiveBill; import com.ruoyi.ss.receiveBill.domain.ReceiveBill;
import com.ruoyi.ss.receiveBill.domain.ReceiveBillVO; import com.ruoyi.ss.receiveBill.domain.ReceiveBillVO;
@ -66,4 +67,9 @@ public interface ReceiveBillMapper
* 查询数量 * 查询数量
*/ */
int selectCount(@Param("query") ReceiveBillQuery query); int selectCount(@Param("query") ReceiveBillQuery query);
/**
* 查询账单金额总额
*/
BigDecimal selectSumOfAmount(@Param("query") ReceiveBillQuery query);
} }

View File

@ -36,6 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="query.deviceId != null "> and srb.device_id = #{query.deviceId}</if> <if test="query.deviceId != null "> and srb.device_id = #{query.deviceId}</if>
<if test="query.billYear != null "> and year(srb.bill_time) = #{query.billYear}</if> <if test="query.billYear != null "> and year(srb.bill_time) = #{query.billYear}</if>
<if test="query.billMonth != null "> and month(srb.bill_time) = #{query.billMonth}</if> <if test="query.billMonth != null "> and month(srb.bill_time) = #{query.billMonth}</if>
<if test="query.billDate != null "> and date(srb.bill_time) = #{query.billDate}</if>
<if test="query.type != null and query.type != ''"> and srb.type = #{query.type}</if> <if test="query.type != null and query.type != ''"> and srb.type = #{query.type}</if>
<if test="query.status != null and query.status != ''"> and srb.status = #{query.status}</if> <if test="query.status != null and query.status != ''"> and srb.status = #{query.status}</if>
<if test="query.userName != null and query.userName != ''"> and su.user_name like concat('%', #{query.userName}, '%')</if> <if test="query.userName != null and query.userName != ''"> and su.user_name like concat('%', #{query.userName}, '%')</if>
@ -64,6 +65,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
</select> </select>
<select id="selectSumOfAmount" resultType="java.math.BigDecimal">
select sum(srb.amount)
from <include refid="selectTables"/>
<where>
<include refid="searchCondition"/>
</where>
</select>
<insert id="insertReceiveBill" parameterType="ReceiveBill" useGeneratedKeys="true" keyProperty="billId"> <insert id="insertReceiveBill" parameterType="ReceiveBill" useGeneratedKeys="true" keyProperty="billId">
<selectKey keyProperty="billId" resultType="Long" order="AFTER"> <selectKey keyProperty="billId" resultType="Long" order="AFTER">
SELECT LAST_INSERT_ID() SELECT LAST_INSERT_ID()

View File

@ -76,4 +76,9 @@ public interface ReceiveBillService
* 查询数量 * 查询数量
*/ */
int selectCount(ReceiveBillQuery query); int selectCount(ReceiveBillQuery query);
/**
* 查询账单金额总额
*/
BigDecimal selectSumOfAmount(ReceiveBillQuery query);
} }

View File

@ -182,4 +182,9 @@ public class ReceiveBillServiceImpl implements ReceiveBillService
return receiveBillMapper.selectCount(query); return receiveBillMapper.selectCount(query);
} }
@Override
public BigDecimal selectSumOfAmount(ReceiveBillQuery query) {
return receiveBillMapper.selectSumOfAmount(query);
}
} }

View File

@ -71,4 +71,9 @@ public interface StoreApplyMapper
* 查询一个 * 查询一个
*/ */
StoreApplyVO selectOne(@Param("query") StoreApplyQuery query); StoreApplyVO selectOne(@Param("query") StoreApplyQuery query);
/**
* 查询数量
*/
int selectCount(@Param("query") StoreApplyQuery query);
} }

View File

@ -25,7 +25,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ss.name as store_name, ss.name as store_name,
su.user_name as user_name, su.user_name as user_name,
sys_u.user_name as verify_name sys_u.user_name as verify_name
from ss_store_apply ssa from <include refid="searchTables"/>
</sql>
<sql id="searchTables">
ss_store_apply ssa
left join sm_store ss on ss.store_id = ssa.store_id left join sm_store ss on ss.store_id = ssa.store_id
left join sm_user su on su.user_id = ssa.user_id left join sm_user su on su.user_id = ssa.user_id
left join sys_user sys_u on sys_u.user_id = ssa.verify_id left join sys_user sys_u on sys_u.user_id = ssa.verify_id
@ -64,6 +68,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
limit 1 limit 1
</select> </select>
<select id="selectCount" resultType="java.lang.Integer">
select count(ssa.id)
from <include refid="searchTables"/>
<where>
<include refid="searchCondition"/>
</where>
</select>
<insert id="insertStoreApply" parameterType="StoreApply" useGeneratedKeys="true" keyProperty="id"> <insert id="insertStoreApply" parameterType="StoreApply" useGeneratedKeys="true" keyProperty="id">
insert into ss_store_apply insert into ss_store_apply
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">

View File

@ -83,4 +83,9 @@ public interface StoreApplyService
* 取消申请 * 取消申请
*/ */
int cancel(Long id); int cancel(Long id);
/**
* 查询数量
*/
int selectCount(StoreApplyQuery query);
} }

View File

@ -218,4 +218,9 @@ public class StoreApplyServiceImpl implements StoreApplyService
return result == null ? 0 : result; return result == null ? 0 : result;
} }
@Override
public int selectCount(StoreApplyQuery query) {
return storeApplyMapper.selectCount(query);
}
} }

View File

@ -179,4 +179,9 @@ public interface TransactionBillMapper
* 查询提现详情 * 查询提现详情
*/ */
TransactionBillVO selectWithdrawById(Long billId); TransactionBillVO selectWithdrawById(Long billId);
/**
* 简单查询数量
*/
int selectSimpleCount(@Param("query") TransactionBillQuery query);
} }

View File

@ -59,7 +59,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
su1.phonenumber as mch_mobile, su1.phonenumber as mch_mobile,
sd.device_no as device_no, sd.device_no as device_no,
su.phonenumber as user_mobile su.phonenumber as user_mobile
from sm_transaction_bill stb from <include refid="rechargeTables"/>
</sql>
<sql id="rechargeTables">
sm_transaction_bill stb
left join sm_user su on su.user_id = stb.user_id left join sm_user su on su.user_id = stb.user_id
left join sm_user su1 on su1.user_id = stb.mch_id left join sm_user su1 on su1.user_id = stb.mch_id
left join sm_device sd on sd.device_id = stb.device_id left join sm_device sd on sd.device_id = stb.device_id
@ -250,6 +254,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where stb.bill_id = #{billId} where stb.bill_id = #{billId}
</select> </select>
<select id="selectSimpleCount" resultType="java.lang.Integer">
select count(stb.bill_id)
from <include refid="rechargeTables"/>
<where>
<include refid="searchCondition"/>
</where>
</select>
<insert id="insertSmTransactionBill" parameterType="TransactionBill" useGeneratedKeys="true" keyProperty="billId"> <insert id="insertSmTransactionBill" parameterType="TransactionBill" useGeneratedKeys="true" keyProperty="billId">
insert into sm_transaction_bill insert into sm_transaction_bill
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">

View File

@ -263,4 +263,9 @@ public interface TransactionBillService
* 查询提现详情 * 查询提现详情
*/ */
TransactionBillVO selectWithdrawById(Long billId); TransactionBillVO selectWithdrawById(Long billId);
/**
* 简单查询数量
*/
int selectSimpleCount(TransactionBillQuery query);
} }

View File

@ -1114,4 +1114,9 @@ public class TransactionBillServiceImpl implements TransactionBillService {
public TransactionBillVO selectWithdrawById(Long billId) { public TransactionBillVO selectWithdrawById(Long billId) {
return transactionBillMapper.selectWithdrawById(billId); return transactionBillMapper.selectWithdrawById(billId);
} }
@Override
public int selectSimpleCount(TransactionBillQuery query) {
return transactionBillMapper.selectSimpleCount(query);
}
} }

View File

@ -104,4 +104,9 @@ public interface SmUserMapper
* 更新用户服务费 * 更新用户服务费
*/ */
int updateServiceRate(SmUser user); int updateServiceRate(SmUser user);
/**
* 查询用户余额
*/
BigDecimal selectSumOfBalance(SmUserQuery query);
} }

View File

@ -269,4 +269,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join sm_device_tenant sdt on su.user_id = sdt.tenant_id left join sm_device_tenant sdt on su.user_id = sdt.tenant_id
where sdt.device_id = #{deviceId} and su.del_flag = '0' where sdt.device_id = #{deviceId} and su.del_flag = '0'
</select> </select>
<select id="selectSumOfBalance" resultType="java.math.BigDecimal">
select sum(su.balance)
from sm_user su
<where>
<include refid="searchCondition"/>
</where>
</select>
</mapper> </mapper>

View File

@ -198,4 +198,9 @@ public interface ISmUserService
* 重置用户服务费 * 重置用户服务费
*/ */
int resetService(Long userId); int resetService(Long userId);
/**
* 查询用户总余额
*/
BigDecimal selectSumOfBalance(SmUserQuery smUserQuery);
} }

View File

@ -270,6 +270,11 @@ public class SmUserServiceImpl implements ISmUserService
return this.updateServiceRate(data); return this.updateServiceRate(data);
} }
@Override
public BigDecimal selectSumOfBalance(SmUserQuery query) {
return smUserMapper.selectSumOfBalance(query);
}
/** /**
* 逻辑删除前校验 * 逻辑删除前校验
* @param userIds * @param userIds

View File

@ -1,9 +1,11 @@
package com.ruoyi.web.controller.ss; package com.ruoyi.web.controller.ss;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.ValidGroup; import com.ruoyi.common.core.domain.ValidGroup;
import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.dashboard.DashboardService;
import com.ruoyi.ss.balancePeriod.domain.SmBalancePeriodQuery; import com.ruoyi.ss.balancePeriod.domain.SmBalancePeriodQuery;
import com.ruoyi.ss.balancePeriod.service.ISmBalancePeriodService; import com.ruoyi.ss.balancePeriod.service.ISmBalancePeriodService;
import com.ruoyi.ss.businessRecord.service.ISmBusinessRecordService; import com.ruoyi.ss.businessRecord.service.ISmBusinessRecordService;
@ -30,8 +32,7 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/system/dashboard") @RequestMapping("/system/dashboard")
public class SmDashboardController { public class SmDashboardController extends BaseController {
@Autowired @Autowired
private TransactionBillService transactionBillService; private TransactionBillService transactionBillService;
@ -41,9 +42,8 @@ public class SmDashboardController {
@Autowired @Autowired
private ISmBusinessRecordService businessRecordService; private ISmBusinessRecordService businessRecordService;
@Autowired @Autowired
private RedisCache redisCache; private DashboardService dashboardService;
/** /**
* 舆情分析数据 * 舆情分析数据
@ -82,4 +82,12 @@ public class SmDashboardController {
public AjaxResult balancePeriod(SmBalancePeriodQuery dto) { public AjaxResult balancePeriod(SmBalancePeriodQuery dto) {
return AjaxResult.success(balancePeriodService.selectSmBalancePeriodList(dto)); return AjaxResult.success(balancePeriodService.selectSmBalancePeriodList(dto));
} }
/**
* 获取待办事项
*/
@GetMapping("/todoList")
public AjaxResult getTodoList() {
return success(dashboardService.getTodoList());
}
} }