更新
This commit is contained in:
parent
b49a8bda8f
commit
41eef23439
|
@ -94,4 +94,7 @@ public class DeviceQuery extends Device {
|
||||||
|
|
||||||
@ApiModelProperty("排除ID")
|
@ApiModelProperty("排除ID")
|
||||||
private Long excludeDeviceId;
|
private Long excludeDeviceId;
|
||||||
|
|
||||||
|
@ApiModelProperty("关键词")
|
||||||
|
private String keyword;
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,6 +126,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="version != null and version != ''"> and sd.version like concat('%', #{version}, '%')</if>
|
<if test="version != null and version != ''"> and sd.version like concat('%', #{version}, '%')</if>
|
||||||
<if test="modelTag != null and modelTag != ''"> and find_in_set(#{modelTag}, sm.tags)</if>
|
<if test="modelTag != null and modelTag != ''"> and find_in_set(#{modelTag}, sm.tags)</if>
|
||||||
<if test="excludeDeviceId != null"> and sd.device_id != #{excludeDeviceId}</if>
|
<if test="excludeDeviceId != null"> and sd.device_id != #{excludeDeviceId}</if>
|
||||||
|
<if test="keyword != null and keyword != ''">
|
||||||
|
and (
|
||||||
|
sd.device_name like concat('%', #{keyword}, '%') or
|
||||||
|
sd.device_no like concat('%', #{keyword}, '%') or
|
||||||
|
su.phonenumber like concat('%', #{keyword}, '%') or
|
||||||
|
su.user_name like concat('%', #{keyword}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
<if test="isArrears != null">
|
<if test="isArrears != null">
|
||||||
<if test="isArrears">
|
<if test="isArrears">
|
||||||
and (sd.rent_time is null or sd.rent_time <= now())
|
and (sd.rent_time is null or sd.rent_time <= now())
|
||||||
|
|
|
@ -55,6 +55,7 @@ import com.ruoyi.ss.transactionBill.domain.vo.TransactionBillVO;
|
||||||
import com.ruoyi.ss.transactionBill.service.TransactionBillService;
|
import com.ruoyi.ss.transactionBill.service.TransactionBillService;
|
||||||
import com.ruoyi.ss.user.domain.SmUserVO;
|
import com.ruoyi.ss.user.domain.SmUserVO;
|
||||||
import com.ruoyi.ss.user.service.ISmUserService;
|
import com.ruoyi.ss.user.service.ISmUserService;
|
||||||
|
import com.ruoyi.ss.user.service.UserValidator;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -135,6 +136,9 @@ public class DeviceServiceImpl implements DeviceService
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeviceSuitConverter deviceConverter;
|
private DeviceSuitConverter deviceConverter;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserValidator userValidator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备
|
* 查询设备
|
||||||
*
|
*
|
||||||
|
@ -742,6 +746,7 @@ public class DeviceServiceImpl implements DeviceService
|
||||||
if (deviceId == null || agentId == null || agentServiceRate == null) {
|
if (deviceId == null || agentId == null || agentServiceRate == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
ServiceUtil.assertion(!userValidator.isAgent(agentId), "该用户不是代理商,无法绑定为设备代理商");
|
||||||
|
|
||||||
Integer result = transactionTemplate.execute(status -> {
|
Integer result = transactionTemplate.execute(status -> {
|
||||||
// 绑定
|
// 绑定
|
||||||
|
|
|
@ -134,7 +134,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<select id="selectSimpleById" resultMap="SmUserResult">
|
<select id="selectSimpleById" resultMap="SmUserResult">
|
||||||
select *
|
select *
|
||||||
from sm_user
|
from sm_user
|
||||||
where user_id = #{userId}
|
where user_id = #{userId} and del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectBalanceCount" resultType="java.math.BigDecimal">
|
<select id="selectBalanceCount" resultType="java.math.BigDecimal">
|
||||||
|
|
|
@ -52,4 +52,11 @@ public interface UserValidator {
|
||||||
* 插入前校验
|
* 插入前校验
|
||||||
*/
|
*/
|
||||||
void checkBeforeInsert(SmUser smUser);
|
void checkBeforeInsert(SmUser smUser);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断用户是否代理商
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean isAgent(Long userId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.BaseValidator;
|
||||||
import com.ruoyi.common.core.domain.ValidateResult;
|
import com.ruoyi.common.core.domain.ValidateResult;
|
||||||
import com.ruoyi.common.core.domain.entity.SmUser;
|
import com.ruoyi.common.core.domain.entity.SmUser;
|
||||||
import com.ruoyi.common.enums.UserStatus;
|
import com.ruoyi.common.enums.UserStatus;
|
||||||
|
import com.ruoyi.common.enums.UserType;
|
||||||
import com.ruoyi.common.utils.ServiceUtil;
|
import com.ruoyi.common.utils.ServiceUtil;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.ss.device.domain.DeviceQuery;
|
import com.ruoyi.ss.device.domain.DeviceQuery;
|
||||||
|
@ -135,6 +136,15 @@ public class UserValidatorImpl extends BaseValidator implements UserValidator {
|
||||||
this.checkOpenId(data.getUserId(), data.getWxOpenId());
|
this.checkOpenId(data.getUserId(), data.getWxOpenId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAgent(Long userId) {
|
||||||
|
if (userId == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SmUserVO user = userService.selectSimpleById(userId);
|
||||||
|
return user != null && UserType.AGENT.getType().equals(user.getType());
|
||||||
|
}
|
||||||
|
|
||||||
private void checkAgentServiceRate(SmUserVO vo) {
|
private void checkAgentServiceRate(SmUserVO vo) {
|
||||||
if (vo == null) {
|
if (vo == null) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -4,10 +4,12 @@ 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.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||||
import com.ruoyi.dashboard.service.DashboardService;
|
import com.ruoyi.dashboard.service.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.bonus.domain.BonusQuery;
|
import com.ruoyi.ss.bonus.domain.BonusQuery;
|
||||||
|
import com.ruoyi.ss.bonus.domain.vo.BonusDailyAmountVO;
|
||||||
import com.ruoyi.ss.bonus.service.BonusService;
|
import com.ruoyi.ss.bonus.service.BonusService;
|
||||||
import com.ruoyi.ss.businessRecord.service.ISmBusinessRecordService;
|
import com.ruoyi.ss.businessRecord.service.ISmBusinessRecordService;
|
||||||
import com.ruoyi.dashboard.domain.dto.ServiceIncomeQuery;
|
import com.ruoyi.dashboard.domain.dto.ServiceIncomeQuery;
|
||||||
|
@ -24,6 +26,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -113,4 +116,22 @@ public class SmDashboardController extends BaseController {
|
||||||
return success(bonusService.selectMonthAmount(query));
|
return success(bonusService.selectMonthAmount(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按天统计分成
|
||||||
|
*/
|
||||||
|
@GetMapping("/bonusDailyAmount")
|
||||||
|
public AjaxResult getBonusDailyAmount(BonusQuery query) {
|
||||||
|
List<BonusDailyAmountVO> list = bonusService.selectDailyAmount(query);
|
||||||
|
// 若开始和结束日期不为空,则补全缺失的日期
|
||||||
|
if (query.getPayDateStart() != null && query.getPayDateEnd() != null) {
|
||||||
|
list = CollectionUtils.fillVoids(list, BonusDailyAmountVO::getKey, (date) -> {
|
||||||
|
BonusDailyAmountVO vo = new BonusDailyAmountVO();
|
||||||
|
vo.setKey(date);
|
||||||
|
vo.setSum(BigDecimal.ZERO);
|
||||||
|
return vo;
|
||||||
|
}, query.getPayDateStart(), query.getPayDateEnd());
|
||||||
|
}
|
||||||
|
return success(list);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user