型号新增默认服务费值
This commit is contained in:
parent
d42b3fff75
commit
922aedda0d
|
@ -10,5 +10,5 @@ public class DictTypeConstants {
|
|||
// 套餐时长单位
|
||||
public static final String SUIT_TIME_UNIT = "suit_time_unit";
|
||||
// 设备服务费类型
|
||||
public static final String DEVICE_SERVICE_TYPE = "device_service_type";
|
||||
public static final String SERVICE_TYPE = "service_type";
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.ruoyi.ss.user.domain.enums;
|
||||
package com.ruoyi.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
@ -10,7 +10,7 @@ import lombok.Getter;
|
|||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum UserServiceType {
|
||||
public enum ServiceType {
|
||||
|
||||
PERCENT("1", "按订单比例"),
|
||||
MONTH("2", "月费");
|
|
@ -152,7 +152,7 @@ public class Device extends BaseEntity
|
|||
|
||||
@ApiModelProperty("服务费类型")
|
||||
@NotBlank(message = "服务费类型不允许为空", groups = {ValidGroup.Create.class})
|
||||
@DictValid(type = DictTypeConstants.DEVICE_SERVICE_TYPE, message = "非法的服务费类型")
|
||||
@DictValid(type = DictTypeConstants.SERVICE_TYPE, message = "非法的服务费类型")
|
||||
private String serviceType;
|
||||
|
||||
@ApiModelProperty("剩余时长(秒)")
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
package com.ruoyi.ss.device.domain.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 设备服务费类型
|
||||
* @author wjh
|
||||
* 2024/7/23
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DeviceServiceType {
|
||||
|
||||
PERCENT("1", "按订单比例"),
|
||||
MONTH("2", "月费");
|
||||
|
||||
private final String type;
|
||||
private final String msg;
|
||||
|
||||
|
||||
}
|
|
@ -26,6 +26,8 @@ import com.ruoyi.ss.device.service.DeviceAssembler;
|
|||
import com.ruoyi.ss.device.service.DeviceValidator;
|
||||
import com.ruoyi.ss.device.service.DeviceService;
|
||||
import com.ruoyi.ss.deviceBindRecord.service.ISmDeviceBindRecordService;
|
||||
import com.ruoyi.ss.model.domain.SmModelVO;
|
||||
import com.ruoyi.ss.model.service.ModelService;
|
||||
import com.ruoyi.ss.record.time.service.IRecordTimeService;
|
||||
import com.ruoyi.ss.record.time.service.RecordTimeConverter;
|
||||
import com.ruoyi.ss.store.domain.StoreVo;
|
||||
|
@ -103,6 +105,9 @@ public class DeviceServiceImpl implements DeviceService
|
|||
@Autowired
|
||||
private RedisLock redisLock;
|
||||
|
||||
@Autowired
|
||||
private ModelService modelService;
|
||||
|
||||
/**
|
||||
* 查询设备
|
||||
*
|
||||
|
@ -289,12 +294,20 @@ public class DeviceServiceImpl implements DeviceService
|
|||
|
||||
@Override
|
||||
public int register(DeviceRegisterDTO dto) {
|
||||
if (dto == null) {
|
||||
return 0;
|
||||
}
|
||||
SmModelVO model = modelService.selectSmModelByModelId(dto.getModelId());
|
||||
ServiceUtil.assertion(model == null, "型号不存在");
|
||||
|
||||
// 添加
|
||||
Device device = new Device();
|
||||
device.setDeviceName("未命名");
|
||||
device.setMac(dto.getMac());
|
||||
device.setDeviceNo(dto.getSn());
|
||||
device.setModelId(dto.getModelId());
|
||||
device.setServiceType(model.getServiceType());
|
||||
device.setServiceRate(model.getServiceRate());
|
||||
return this.insertSmDevice(device);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
package com.ruoyi.ss.model.domain;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.constants.DictTypeConstants;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import com.ruoyi.common.core.domain.ValidGroup;
|
||||
import com.ruoyi.system.valid.DictValid;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -54,4 +58,12 @@ public class SmModel extends BaseEntity
|
|||
@NotNull(message = "标签列表不允许为空", groups = {ValidGroup.Create.class})
|
||||
@Size(min = 1, message = "至少需要一个标签", groups = {ValidGroup.Create.class})
|
||||
private List<String> tags;
|
||||
|
||||
@ApiModelProperty("默认服务费类型")
|
||||
@DictValid(type = DictTypeConstants.SERVICE_TYPE, message = "非法的服务费类型")
|
||||
private String serviceType;
|
||||
|
||||
@ApiModelProperty("默认服务费")
|
||||
@Min(value = 0, message = "默认服务费不能小于0")
|
||||
private BigDecimal serviceRate;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@ public class SmModelBO extends SmModel {
|
|||
bo.setPicture(getPicture());
|
||||
bo.setIntroduce(getIntroduce());
|
||||
bo.setRemark(getRemark());
|
||||
bo.setServiceType(getServiceType());
|
||||
bo.setServiceRate(getServiceRate());
|
||||
return bo;
|
||||
}
|
||||
|
||||
|
@ -30,6 +32,8 @@ public class SmModelBO extends SmModel {
|
|||
bo.setPicture(getPicture());
|
||||
bo.setIntroduce(getIntroduce());
|
||||
bo.setRemark(getRemark());
|
||||
bo.setServiceType(getServiceType());
|
||||
bo.setServiceRate(getServiceRate());
|
||||
return bo;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
sm.remark,
|
||||
sm.deleted,
|
||||
sm.tags,
|
||||
sm.service_type,
|
||||
sm.service_rate,
|
||||
count(case when sd.activation_time is not null and sd.deleted = false then sd.device_id end) as activation_count,
|
||||
count(case when sd.online_status = '1' and sd.activation_time is not null and sd.deleted = false then sd.device_id end) as online_count
|
||||
from sm_model sm
|
||||
|
@ -30,6 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<sql id="searchCondition">
|
||||
<if test="modelName != null and modelName != ''"> and sm.model_name like concat('%', #{modelName}, '%')</if>
|
||||
<if test="model != null and model != ''"> and sm.model = #{model}</if>
|
||||
<if test="serviceType != null and serviceType != ''"> and sm.service_type = #{serviceType}</if>
|
||||
<if test="deleted == null">and sm.deleted = false</if>
|
||||
<if test="deleted != null">and sm.deleted = #{deleted}</if>
|
||||
</sql>
|
||||
|
@ -78,6 +81,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="remark != null">remark,</if>
|
||||
<if test="deleted != null">deleted,</if>
|
||||
<if test="tags != null">tags,</if>
|
||||
<if test="serviceType != null">service_type,</if>
|
||||
<if test="serviceRate != null">service_rate,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="modelName != null">#{modelName},</if>
|
||||
|
@ -91,6 +96,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="remark != null">#{remark},</if>
|
||||
<if test="deleted != null">#{deleted},</if>
|
||||
<if test="tags != null">#{tags,typeHandler=com.ruoyi.system.mapper.typehandler.StringSplitListTypeHandler},</if>
|
||||
<if test="serviceType != null">#{serviceType},</if>
|
||||
<if test="serviceRate != null">#{serviceRate},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
@ -108,6 +115,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="deleted != null">deleted = #{deleted},</if>
|
||||
<if test="tags != null">tags = #{tags,typeHandler=com.ruoyi.system.mapper.typehandler.StringSplitListTypeHandler},</if>
|
||||
<if test="serviceType != null">service_type = #{serviceType},</if>
|
||||
<if test="serviceRate != null">service_rate = #{serviceRate},</if>
|
||||
</trim>
|
||||
where model_id = #{modelId}
|
||||
</update>
|
||||
|
|
|
@ -11,7 +11,6 @@ import com.ruoyi.ss.account.service.ISmAccountService;
|
|||
import com.ruoyi.ss.channel.domain.SmChannel;
|
||||
import com.ruoyi.ss.channel.service.ISmChannelService;
|
||||
import com.ruoyi.ss.dashboard.BillCountVo;
|
||||
import com.ruoyi.ss.device.domain.enums.DeviceServiceType;
|
||||
import com.ruoyi.ss.device.domain.vo.DeviceVO;
|
||||
import com.ruoyi.ss.device.service.DeviceService;
|
||||
import com.ruoyi.ss.receiveBill.service.ReceiveBillService;
|
||||
|
@ -35,7 +34,7 @@ import com.ruoyi.ss.transactionBill.mapper.TransactionBillMapper;
|
|||
import com.ruoyi.ss.transactionBill.service.TransactionBillService;
|
||||
import com.ruoyi.ss.transactionBill.service.TransactionBillValidator;
|
||||
import com.ruoyi.ss.user.domain.SmUserVo;
|
||||
import com.ruoyi.ss.user.domain.enums.UserServiceType;
|
||||
import com.ruoyi.common.enums.ServiceType;
|
||||
import com.ruoyi.ss.user.mapper.SmUserMapper;
|
||||
import com.ruoyi.ss.user.service.ISmUserService;
|
||||
import com.ruoyi.ss.wxPay.service.IWxPayService;
|
||||
|
@ -247,7 +246,7 @@ public class TransactionBillServiceImpl implements TransactionBillService {
|
|||
// 优先级: 设备 > 商户 > 渠道
|
||||
if (device.getServiceRate() != null) {
|
||||
// 设备月费
|
||||
if (DeviceServiceType.MONTH.getType().equals(device.getServiceType())) {
|
||||
if (ServiceType.MONTH.getType().equals(device.getServiceType())) {
|
||||
int count = receiveBillService.genBillByMonthAndPay(mch, device, LocalDateTime.now(), device.getServiceRate());
|
||||
ServiceUtil.assertion(count == 0, "商户出账失败,请刷新后重试");
|
||||
}
|
||||
|
@ -259,7 +258,7 @@ public class TransactionBillServiceImpl implements TransactionBillService {
|
|||
// 用户
|
||||
else if (mch.getServiceRate() != null) {
|
||||
// 用户月费
|
||||
if (UserServiceType.MONTH.getType().equals(mch.getServiceType())) {
|
||||
if (ServiceType.MONTH.getType().equals(mch.getServiceType())) {
|
||||
int count = receiveBillService.genBillByMonthAndPay(mch, device, LocalDateTime.now(), mch.getServiceRate());
|
||||
ServiceUtil.assertion(count == 0, "商户出账失败,请刷新后重试");
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user