优化店铺、设备、用户

This commit is contained in:
墨大叔 2024-05-13 15:05:46 +08:00
parent 753db322c7
commit 7d2bfc4bbf
78 changed files with 1104 additions and 203 deletions

View File

@ -1,6 +1,8 @@
package com.ruoyi.common.core.domain.entity;
import com.fasterxml.jackson.annotation.JsonView;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.domain.JsonViewProfile;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -22,25 +24,30 @@ public class SmArticleClassify extends BaseEntity
/** 分类ID */
@ApiModelProperty("分类ID")
@JsonView(JsonViewProfile.App.class)
private Long classifyId;
/** 父分类ID */
@ApiModelProperty("父分类ID")
@JsonView(JsonViewProfile.App.class)
private Long parentId;
/** 祖级列表 */
@ApiModelProperty("祖级列表")
@JsonView(JsonViewProfile.App.class)
private String ancestors;
/** 分类名称 */
@ApiModelProperty("分类名称")
@NotBlank(message = "分类名称不能为空")
@Size(min = 0, max = 30, message = "分类名称长度不能超过30个字符")
@JsonView(JsonViewProfile.App.class)
private String classifyName;
/** 显示顺序 */
@ApiModelProperty("显示顺序")
@NotNull(message = "显示顺序不能为空")
@JsonView(JsonViewProfile.App.class)
private Integer orderNum;
@ -54,10 +61,12 @@ public class SmArticleClassify extends BaseEntity
/** 父分类名称 */
@ApiModelProperty("父分类名称")
@JsonView(JsonViewProfile.App.class)
private String parentName;
/** 子分类 */
@ApiModelProperty("子分类")
@JsonView(JsonViewProfile.App.class)
private List<SmArticleClassify> children = new ArrayList<SmArticleClassify>();
@ApiModelProperty("是否系统内置")

View File

@ -135,4 +135,7 @@ public class SmUser extends BaseEntity
@ApiModelProperty("是否商家")
@JsonView(JsonViewProfile.App.class)
private Boolean isMch;
@ApiModelProperty("服务费费率")
private BigDecimal serviceRate;
}

View File

@ -1,14 +1,11 @@
package com.ruoyi.ss.abnormal.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.domain.ValidGroup;
import com.ruoyi.common.utils.RegexpUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.springframework.beans.factory.annotation.Autowired;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

View File

@ -1,11 +1,12 @@
package com.ruoyi.ss.abnormal.mapper;
import java.util.List;
import com.ruoyi.ss.abnormal.domain.Abnormal;
import com.ruoyi.ss.abnormal.domain.AbnormalQuery;
import com.ruoyi.ss.abnormal.domain.AbnormalVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 设备故障Mapper接口
*

View File

@ -1,10 +1,11 @@
package com.ruoyi.ss.abnormal.service;
import java.util.List;
import com.ruoyi.ss.abnormal.domain.Abnormal;
import com.ruoyi.ss.abnormal.domain.AbnormalQuery;
import com.ruoyi.ss.abnormal.domain.AbnormalVO;
import java.util.List;
/**
* 设备故障Service接口
*

View File

@ -1,14 +1,15 @@
package com.ruoyi.ss.abnormal.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.ss.abnormal.domain.Abnormal;
import com.ruoyi.ss.abnormal.domain.AbnormalQuery;
import com.ruoyi.ss.abnormal.domain.AbnormalVO;
import com.ruoyi.ss.abnormal.mapper.AbnormalMapper;
import com.ruoyi.ss.abnormal.service.IAbnormalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ss.abnormal.mapper.AbnormalMapper;
import com.ruoyi.ss.abnormal.domain.Abnormal;
import com.ruoyi.ss.abnormal.service.IAbnormalService;
import java.util.List;
/**
* 设备故障Service业务层处理

View File

@ -0,0 +1,35 @@
package com.ruoyi.ss.ad.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 广告对象 ss_ad
*
* @author ruoyi
* @date 2024-05-11
*/
@Data
public class Ad extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ApiModelProperty("广告ID")
private Long adId;
@Excel(name = "广告类型 1活动推广")
@ApiModelProperty("广告类型 1活动推广 ")
private String type;
@Excel(name = "广告图片")
@ApiModelProperty("广告图片")
private String picture;
@Excel(name = "跳转链接")
@ApiModelProperty("跳转链接")
private String url;
}

View File

@ -0,0 +1,11 @@
package com.ruoyi.ss.ad.domain;
import lombok.Data;
/**
* @author wjh
* 2024/5/11
*/
@Data
public class AdQuery extends Ad {
}

View File

@ -0,0 +1,11 @@
package com.ruoyi.ss.ad.domain;
import lombok.Data;
/**
* @author wjh
* 2024/5/11
*/
@Data
public class AdVO extends Ad{
}

View File

@ -0,0 +1,78 @@
package com.ruoyi.ss.ad.mapper;
import java.util.List;
import com.ruoyi.ss.ad.domain.Ad;
import com.ruoyi.ss.ad.domain.AdQuery;
import com.ruoyi.ss.ad.domain.AdVO;
import org.apache.ibatis.annotations.Param;
/**
* 广告Mapper接口
*
* @author ruoyi
* @date 2024-05-11
*/
public interface AdMapper
{
/**
* 查询广告
*
* @param adId 广告主键
* @return 广告
*/
public AdVO selectAdByAdId(Long adId);
/**
* 查询广告列表
*
* @param ad 广告
* @return 广告集合
*/
public List<AdVO> selectAdList(AdQuery ad);
/**
* 新增广告
*
* @param ad 广告
* @return 结果
*/
public int insertAd(Ad ad);
/**
* 修改广告
*
* @param ad 广告
* @return 结果
*/
public int updateAd(Ad ad);
/**
* 删除广告
*
* @param adId 广告主键
* @return 结果
*/
public int deleteAdByAdId(Long adId);
/**
* 批量删除广告
*
* @param adIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteAdByAdIds(Long[] adIds);
/**
* 逻辑删除
* @param ids
* @return
*/
int logicDel(@Param("ids") List<Long> ids);
/**
* 查询一个
* @param query
* @return
*/
AdVO selectOne(AdQuery query);
}

View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.ss.ad.mapper.AdMapper">
<resultMap type="AdVO" id="AdResult">
<result property="adId" column="ad_id" />
<result property="type" column="type" />
<result property="picture" column="picture" />
<result property="url" column="url" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="deleted" column="deleted" />
</resultMap>
<sql id="selectAdVo">
select
sa.ad_id,
sa.type,
sa.picture,
sa.url,
sa.create_by,
sa.create_time,
sa.update_by,
sa.update_time,
sa.remark,
sa.deleted
from ss_ad sa
</sql>
<sql id="searchCondition">
<if test="adId != null "> and sa.ad_id = #{adId}</if>
<if test="type != null and type != ''"> and sa.type = #{type}</if>
<if test="url != null and url != ''"> and sa.url like concat('%', #{url}, '%')</if>
<if test="deleted != null "> and sa.deleted = #{deleted}</if>
<if test="deleted == null "> and sa.deleted = false</if>
</sql>
<select id="selectAdList" parameterType="AdQuery" resultMap="AdResult">
<include refid="selectAdVo"/>
<where>
<include refid="searchCondition"/>
</where>
</select>
<select id="selectAdByAdId" parameterType="Long" resultMap="AdResult">
<include refid="selectAdVo"/>
where sa.ad_id = #{adId} and sa.deleted = false
</select>
<select id="selectOne" resultMap="AdResult">
<include refid="selectAdVo"/>
<where>
<include refid="searchCondition"/>
</where>
limit 1
</select>
<insert id="insertAd" parameterType="Ad" useGeneratedKeys="true" keyProperty="adId">
insert into ss_ad
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="type != null">type,</if>
<if test="picture != null">picture,</if>
<if test="url != null">url,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="deleted != null">deleted,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="type != null">#{type},</if>
<if test="picture != null">#{picture},</if>
<if test="url != null">#{url},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="deleted != null">#{deleted},</if>
</trim>
</insert>
<update id="updateAd" parameterType="Ad">
update ss_ad
<trim prefix="SET" suffixOverrides=",">
<if test="type != null">type = #{type},</if>
<if test="picture != null">picture = #{picture},</if>
<if test="url != null">url = #{url},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where ad_id = #{adId}
</update>
<update id="logicDel">
update ss_ad
set deleted = true
where ad_id in
<foreach item="adId" collection="ids" open="(" separator="," close=")">
#{adId}
</foreach>
</update>
<delete id="deleteAdByAdId" parameterType="Long">
delete from ss_ad where ad_id = #{adId}
</delete>
<delete id="deleteAdByAdIds" parameterType="String">
delete from ss_ad where ad_id in
<foreach item="adId" collection="array" open="(" separator="," close=")">
#{adId}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,72 @@
package com.ruoyi.ss.ad.service;
import java.util.List;
import com.ruoyi.ss.ad.domain.Ad;
import com.ruoyi.ss.ad.domain.AdQuery;
import com.ruoyi.ss.ad.domain.AdVO;
/**
* 广告Service接口
*
* @author ruoyi
* @date 2024-05-11
*/
public interface IAdService
{
/**
* 查询广告
*
* @param adId 广告主键
* @return 广告
*/
public AdVO selectAdByAdId(Long adId);
/**
* 查询广告列表
*
* @param ad 广告
* @return 广告集合
*/
public List<AdVO> selectAdList(AdQuery ad);
/**
* 新增广告
*
* @param ad 广告
* @return 结果
*/
public int insertAd(Ad ad);
/**
* 修改广告
*
* @param ad 广告
* @return 结果
*/
public int updateAd(Ad ad);
/**
* 批量删除广告
*
* @param adIds 需要删除的广告主键集合
* @return 结果
*/
public int deleteAdByAdIds(Long[] adIds);
/**
* 删除广告信息
*
* @param adId 广告主键
* @return 结果
*/
public int deleteAdByAdId(Long adId);
/**
* 逻辑删除
* @param ids
* @return
*/
int logicDel(List<Long> ids);
AdVO selectOne(AdQuery query);
}

View File

@ -0,0 +1,114 @@
package com.ruoyi.ss.ad.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.ss.ad.domain.AdQuery;
import com.ruoyi.ss.ad.domain.AdVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ss.ad.mapper.AdMapper;
import com.ruoyi.ss.ad.domain.Ad;
import com.ruoyi.ss.ad.service.IAdService;
/**
* 广告Service业务层处理
*
* @author ruoyi
* @date 2024-05-11
*/
@Service
public class AdServiceImpl implements IAdService
{
@Autowired
private AdMapper adMapper;
/**
* 查询广告
*
* @param adId 广告主键
* @return 广告
*/
@Override
public AdVO selectAdByAdId(Long adId)
{
return adMapper.selectAdByAdId(adId);
}
/**
* 查询广告列表
*
* @param ad 广告
* @return 广告
*/
@Override
public List<AdVO> selectAdList(AdQuery ad)
{
return adMapper.selectAdList(ad);
}
/**
* 新增广告
*
* @param ad 广告
* @return 结果
*/
@Override
public int insertAd(Ad ad)
{
ad.setCreateTime(DateUtils.getNowDate());
return adMapper.insertAd(ad);
}
/**
* 修改广告
*
* @param ad 广告
* @return 结果
*/
@Override
public int updateAd(Ad ad)
{
ad.setUpdateTime(DateUtils.getNowDate());
return adMapper.updateAd(ad);
}
/**
* 批量删除广告
*
* @param adIds 需要删除的广告主键
* @return 结果
*/
@Override
public int deleteAdByAdIds(Long[] adIds)
{
return adMapper.deleteAdByAdIds(adIds);
}
/**
* 删除广告信息
*
* @param adId 广告主键
* @return 结果
*/
@Override
public int deleteAdByAdId(Long adId)
{
return adMapper.deleteAdByAdId(adId);
}
/**
* 逻辑删除
*
* @param ids
* @return
*/
@Override
public int logicDel(List<Long> ids) {
return adMapper.logicDel(ids);
}
@Override
public AdVO selectOne(AdQuery query) {
return adMapper.selectOne(query);
}
}

View File

@ -7,8 +7,6 @@ import com.ruoyi.common.core.domain.JsonViewProfile;
import com.ruoyi.common.core.domain.entity.SmArticleClassify;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* 文章对象 as_article
*

View File

@ -14,9 +14,10 @@ import java.util.Objects;
@AllArgsConstructor
public enum LicenceType {
USER("user", "ss.licence.user.id"),
PRIVACY("privacy", "ss.licence.privacy.id"),
COLLECT("collection", "ss.licence.collection.id");
USER("user", "ss.licence.user.id"), // 用户协议
PRIVACY("privacy", "ss.licence.privacy.id"), // 隐私协议
COLLECT("collection", "ss.licence.collection.id"), // 个人信息收集清单
ABOUT("about", "ss.licence.about.id"); // 关于我们
private final String type; // 类型
private final String key; // 配置键值

View File

@ -7,7 +7,6 @@ import com.ruoyi.ss.article.domain.SmArticleQuery;
import com.ruoyi.ss.article.domain.enums.LicenceType;
import com.ruoyi.ss.article.mapper.SmArticleMapper;
import com.ruoyi.ss.article.service.ISmArticleService;
import com.ruoyi.system.mapper.SysDictDataMapper;
import com.ruoyi.system.service.ISysConfigService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;

View File

@ -1,6 +1,5 @@
package com.ruoyi.ss.businessRecord.service;
import com.ruoyi.common.enums.UserStatus;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.ss.businessRecord.domain.SmBusinessRecord;
import com.ruoyi.ss.businessRecord.domain.SmBusinessRecordQuery;

View File

@ -1,7 +1,5 @@
package com.ruoyi.ss.channel.service;
import com.ruoyi.common.core.domain.ValidateResult;
/**
* @author wjh
* 2024/5/5

View File

@ -113,12 +113,12 @@ public class SmDevice extends BaseEntity
@Excel(name = "欠费断电")
@ApiModelProperty("断电方式0欠费不断电1欠费立即断电")
@EnumValid(
clazz = DeviceOutageWay.class,
message = "非法的欠费断电方式",
method = "getValue",
groups = {ValidGroup.Create.class, ValidGroup.Update.class, ValidGroup.FrontUpdate.class}
)
// @EnumValid(
// clazz = DeviceOutageWay.class,
// message = "非法的超时断电方式",
// method = "getValue",
// groups = {ValidGroup.Create.class, ValidGroup.Update.class, ValidGroup.FrontUpdate.class}
// )
private String outageWay;
@Excel(name = "wifi名称")
@ -138,4 +138,16 @@ public class SmDevice extends BaseEntity
@ApiModelProperty("设备到期时间")
@JsonView(DeviceView.SuitList.class)
private LocalDateTime expireTime;
@ApiModelProperty("所属用户ID")
@NotNull(message = "用户不允许为空", groups = {ValidGroup.Create.class})
private Long userId;
@ApiModelProperty("用户自定义图片")
private String customPicture;
@ApiModelProperty("服务费费率")
@Range(min = 0, max = 100, message = "服务费费率必须在0-100之间")
private BigDecimal serviceRate;
}

View File

@ -0,0 +1,54 @@
package com.ruoyi.ss.device.domain;
import lombok.Data;
/**
* @author wjh
* 2024/5/10
*/
@Data
public class SmDeviceBO extends SmDevice {
/**
* 过滤新增字段
*/
public SmDeviceBO filterCreate() {
SmDeviceBO bo = new SmDeviceBO();
bo.setDeviceNo(getDeviceNo());
bo.setStoreId(getStoreId());
bo.setDeviceName(getDeviceName());
bo.setModelId(getModelId());
bo.setMac(getMac());
bo.setUserId(getUserId());
bo.setServiceRate(getServiceRate());
return bo;
}
/**
* 过滤更新字段
*/
public SmDeviceBO filterUpdate() {
SmDeviceBO bo = new SmDeviceBO();
bo.setDeviceId(getDeviceId());
bo.setDeviceNo(getDeviceNo());
bo.setStoreId(getStoreId());
bo.setDeviceName(getDeviceName());
bo.setModelId(getModelId());
bo.setUserId(getUserId());
bo.setServiceRate(getServiceRate());
return bo;
}
/**
* 过滤APP更新字段
*/
public SmDeviceBO filterUpdateByApp() {
SmDeviceBO bo = new SmDeviceBO();
bo.setDeviceId(getDeviceId());
bo.setStoreId(getStoreId());
bo.setRemark(getRemark());
bo.setDeviceName(getDeviceName());
bo.setCustomPicture(getCustomPicture());
return bo;
}
}

View File

@ -55,9 +55,6 @@ public class SmDeviceQuery extends SmDevice {
@ApiModelProperty("设备编号列表")
private List<String> deviceNos;
@ApiModelProperty("所属商户ID")
private Long userId;
@ApiModelProperty("商户id列表")
@ApiModelProperty("用户id列表")
private List<Long> userIds;
}

View File

@ -2,17 +2,13 @@ package com.ruoyi.ss.device.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonView;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.JsonViewProfile;
import com.ruoyi.common.core.domain.ValidGroup;
import com.ruoyi.ss.device.domain.DeviceView;
import com.ruoyi.ss.device.domain.SmDevice;
import com.ruoyi.ss.suit.domain.SuitVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalTime;
import java.util.List;
@ -59,9 +55,6 @@ public class SmDeviceVo extends SmDevice {
@JsonFormat(pattern = "HH:mm", timezone = "GMT+8")
private LocalTime storeBusinessTimeEnd;
@ApiModelProperty("所属商户ID")
private Long userId;
@ApiModelProperty("订单总数量")
private Integer orderCount;

View File

@ -1,6 +1,8 @@
package com.ruoyi.ss.device.mapper;
import com.ruoyi.ss.device.domain.*;
import com.ruoyi.ss.device.domain.SmDevice;
import com.ruoyi.ss.device.domain.SmDeviceCountVO;
import com.ruoyi.ss.device.domain.SmDeviceQuery;
import com.ruoyi.ss.device.domain.vo.SmDeviceVo;
import org.apache.ibatis.annotations.Param;
@ -138,4 +140,9 @@ public interface SmDeviceMapper
* @return
*/
SmDeviceVo selectSimpleSmDeviceBySn(String deviceNo);
/**
* 通过用户id修改服务费率
*/
int updateServiceRateByUserId(@Param("userId") Long userId, @Param("serviceRate") BigDecimal serviceRate);
}

View File

@ -17,9 +17,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="mac != null and mac != ''"> and sd.mac like concat('%', #{mac}, '%')</if>
<if test="onlineStatus != null and onlineStatus != ''"> and sd.online_status = #{onlineStatus}</if>
<if test="status != null and status != ''"> and sd.status = #{status}</if>
<if test="userName != null and userName != ''"> and sd.user_name like concat('%', #{userName}, '%')</if>
<if test="userName != null and userName != ''"> and su.user_name like concat('%', #{userName}, '%')</if>
<if test="nickName != null and nickName != ''"> and sd.nick_name like concat('%', #{nickName}, '%')</if>
<if test="userId != null"> and su.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="deviceId != null"> and sd.device_id = #{deviceId}</if>
<if test="deviceNo != null"> and sd.device_no like concat('%', #{deviceNo}, '%')</if>
@ -50,7 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</if>
<if test="userIds != null and userIds.size() > 0">
and ss.user_id in
and sd.user_id in
<foreach collection="userIds" open="(" close=")" separator="," item="item">
#{item}
</foreach>
@ -66,12 +66,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sm.picture as picture,
sm.tags as model_tags,
ss.name as store_name,
su.user_id as user_id,
su.user_name as user_name
from sm_device sd
left join sm_model sm on sm.model_id = sd.model_id
left join sm_store ss on ss.store_id = sd.store_id
left join sm_user su on su.user_id = ss.user_id
left join sm_user su on su.user_id = sd.user_id
</sql>
<select id="selectSmDeviceList" parameterType="SmDeviceQuery" resultMap="SmDeviceResult">
@ -194,6 +193,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="initReading != null">init_reading,</if>
<if test="powerStatus != null">power_status,</if>
<if test="deviceNo != null">device_no,</if>
<if test="userId != null">user_id,</if>
<if test="customPicture != null">custom_picture,</if>
<if test="serviceRate != null">service_rate,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="storeId != null">#{storeId},</if>
@ -220,6 +222,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="initReading != null">#{initReading},</if>
<if test="powerStatus != null">#{powerStatus},</if>
<if test="deviceNo != null">#{deviceNo},</if>
<if test="userId != null">#{userId},</if>
<if test="customPicture != null">#{customPicture},</if>
<if test="serviceRate != null">#{serviceRate},</if>
</trim>
</insert>
@ -246,6 +251,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deviceName != null">device_name = #{deviceName},</if>
<if test="modelId != null">model_id = #{modelId},</if>
<if test="mac != null">mac = #{mac},</if>
<if test="deviceNo != null">device_no = #{deviceNo},</if>
<if test="activationTime != null">activation_time = #{activationTime},</if>
<if test="totalElectriQuantity != null">total_electri_quantity = #{totalElectriQuantity},</if>
<if test="onlineStatus != null">online_status = #{onlineStatus},</if>
@ -266,6 +272,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="initReading != null">init_reading = #{initReading},</if>
<if test="powerStatus != null">power_status = #{powerStatus},</if>
<if test="expireTime != null">expire_time = #{expireTime},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="customPicture != null">custom_picture = #{customPicture},</if>
<if test="serviceRate != null">service_rate = #{serviceRate},</if>
</trim>
where device_id = #{deviceId}
</update>
@ -292,6 +301,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where device_id = #{deviceId}
</update>
<update id="updateServiceRateByUserId">
update sm_device
set service_rate = #{serviceRate}
where user_id = #{userId}
</update>
<delete id="deleteSmDeviceByDeviceId" parameterType="Long">
delete from sm_device where device_id = #{deviceId}
</delete>

View File

@ -1,6 +1,7 @@
package com.ruoyi.ss.device.service;
import com.ruoyi.common.core.domain.ValidateResult;
import com.ruoyi.ss.device.domain.SmDeviceBO;
import java.util.List;
@ -21,4 +22,19 @@ public interface DeviceValidator {
* @param userId 用户id
*/
boolean isBelong(Long deviceId, Long userId);
/**
* 创建前校验
*/
ValidateResult preCreate(SmDeviceBO data);
/**
* 更新前校验
*/
ValidateResult preUpdate(SmDeviceBO data);
/**
* APP更新前校验
*/
ValidateResult preUpdateByApp(SmDeviceBO data);
}

View File

@ -3,8 +3,8 @@ package com.ruoyi.ss.device.service;
import com.ruoyi.ss.device.domain.SmDevice;
import com.ruoyi.ss.device.domain.SmDeviceCountVO;
import com.ruoyi.ss.device.domain.SmDeviceQuery;
import com.ruoyi.ss.device.domain.vo.SmDeviceVo;
import com.ruoyi.ss.device.domain.enums.DevicePowerStatus;
import com.ruoyi.ss.device.domain.vo.SmDeviceVo;
import java.math.BigDecimal;
import java.util.List;
@ -187,4 +187,9 @@ public interface ISmDeviceService
* @return
*/
boolean isBindBySn(String deviceNo);
/**
* 更新设备服务费
*/
int updateServiceRateByUserId(Long userId, BigDecimal serviceRate);
}

View File

@ -4,11 +4,11 @@ import com.ruoyi.common.utils.CollectionUtils;
import com.ruoyi.ss.dashboard.BillCountVo;
import com.ruoyi.ss.device.domain.vo.SmDeviceVo;
import com.ruoyi.ss.device.service.DeviceAssembler;
import com.ruoyi.ss.deviceTenant.domain.SmDeviceTenant;
import com.ruoyi.ss.deviceTenant.service.ISmDeviceTenantService;
import com.ruoyi.ss.store.domain.StoreQuery;
import com.ruoyi.ss.store.domain.StoreVo;
import com.ruoyi.ss.store.service.IStoreService;
import com.ruoyi.ss.deviceTenant.domain.SmDeviceTenant;
import com.ruoyi.ss.deviceTenant.service.ISmDeviceTenantService;
import com.ruoyi.ss.suit.domain.SuitQuery;
import com.ruoyi.ss.suit.domain.SuitVo;
import com.ruoyi.ss.suit.service.ISuitService;

View File

@ -3,15 +3,18 @@ package com.ruoyi.ss.device.service.impl;
import com.ruoyi.common.core.domain.BaseValidator;
import com.ruoyi.common.core.domain.ValidateResult;
import com.ruoyi.common.utils.CollectionUtils;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.common.utils.UserUtil;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.ss.device.domain.SmDeviceBO;
import com.ruoyi.ss.device.domain.SmDeviceQuery;
import com.ruoyi.ss.device.domain.vo.SmDeviceVo;
import com.ruoyi.ss.device.service.DeviceValidator;
import com.ruoyi.ss.device.service.ISmDeviceService;
import com.ruoyi.ss.store.service.StoreValidator;
import com.ruoyi.ss.user.service.UserValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
@ -26,6 +29,12 @@ public class DeviceValidatorImpl extends BaseValidator implements DeviceValidato
@Autowired
private ISmDeviceService deviceService;
@Autowired
private StoreValidator storeValidator;
@Autowired
private UserValidator userValidator;
/**
* 设备编号是否存在
*
@ -55,4 +64,82 @@ public class DeviceValidatorImpl extends BaseValidator implements DeviceValidato
SmDeviceVo device = deviceService.selectSmDeviceByDeviceId(deviceId);
return device != null && Objects.equals(device.getUserId(), userId);
}
/**
* 创建前校验
*
* @param data
* @return
*/
@Override
public ValidateResult preCreate(SmDeviceBO data) {
if (data == null) {
return error("数据不允许为空");
}
if (data.getStoreId() != null && !storeValidator.isExist(Collections.singletonList(data.getStoreId()))) {
return error("店铺不存在");
}
if (!userValidator.isExist(Collections.singletonList(data.getUserId()))) {
return error("用户不存在");
}
if (data.getStoreId() != null && !storeValidator.isStoreBelongUser(Collections.singletonList(data.getStoreId()), data.getUserId())) {
return error("该店铺不属于该用户");
}
return success();
}
/**
* 更新前校验
*
* @param data
*/
@Override
public ValidateResult preUpdate(SmDeviceBO data) {
if (data == null) {
return error("数据不允许为空");
}
if (data.getStoreId() != null && !storeValidator.isExist(Collections.singletonList(data.getStoreId()))) {
return error("店铺不存在");
}
if (data.getUserId() != null && !userValidator.isExist(Collections.singletonList(data.getUserId()))) {
return error("用户不存在");
}
if (data.getStoreId() != null && !storeValidator.isStoreBelongUser(Collections.singletonList(data.getStoreId()), data.getUserId())) {
return error("该店铺不属于该用户");
}
return success();
}
/**
* APP更新前校验
*
* @param data
*/
@Override
public ValidateResult preUpdateByApp(SmDeviceBO data) {
if (data == null) {
return error("数据不允许为空");
}
if (data.getStoreId() != null && !storeValidator.isExist(Collections.singletonList(data.getStoreId()))) {
return error("店铺不存在");
}
Long userId = SecurityUtils.getUserId();
// 判断是否有权限更改
if (!isBelong(data.getDeviceId(), userId)) {
return error("这不是您的设备,您无权更改");
}
return success();
}
}

View File

@ -1,16 +1,17 @@
package com.ruoyi.ss.device.service.impl;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.enums.LoginType;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.*;
import com.ruoyi.iot.domain.IotDeviceInfo;
import com.ruoyi.iot.service.IotService;
import com.ruoyi.ss.device.domain.SmDevice;
import com.ruoyi.ss.device.domain.SmDeviceCountVO;
import com.ruoyi.ss.device.domain.SmDeviceQuery;
import com.ruoyi.ss.device.domain.vo.SmDeviceVo;
import com.ruoyi.ss.device.domain.enums.DeviceOnlineStatus;
import com.ruoyi.ss.device.domain.enums.DevicePowerStatus;
import com.ruoyi.ss.device.domain.enums.DeviceStatus;
import com.ruoyi.ss.device.domain.vo.SmDeviceVo;
import com.ruoyi.ss.device.mapper.SmDeviceMapper;
import com.ruoyi.ss.device.service.DeviceAssembler;
import com.ruoyi.ss.device.service.ISmDeviceService;
@ -19,8 +20,6 @@ import com.ruoyi.ss.resetRecord.domain.SmResetRecord;
import com.ruoyi.ss.resetRecord.service.ISmResetRecordService;
import com.ruoyi.ss.store.domain.StoreVo;
import com.ruoyi.ss.store.service.IStoreService;
import com.ruoyi.iot.domain.IotDeviceInfo;
import com.ruoyi.iot.service.IotService;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -154,7 +153,6 @@ public class SmDeviceServiceImpl implements ISmDeviceService
@Override
public int insertSmDevice(SmDevice data)
{
this.validate(data, false);
data.setCreateTime(DateUtils.getNowDate());
data.setStatus(DeviceStatus.NORMAL.getStatus());
return smDeviceMapper.insertSmDevice(data);
@ -170,8 +168,6 @@ public class SmDeviceServiceImpl implements ISmDeviceService
@Transactional
public int updateSmDevice(SmDevice smDevice)
{
// 校验
this.validate(smDevice, true);
// 修改数据库
smDevice.setUpdateTime(DateUtils.getNowDate());
@ -187,19 +183,6 @@ public class SmDeviceServiceImpl implements ISmDeviceService
return updateCount;
}
private void validate(SmDevice smDevice, boolean update) {
// 判断是否有权限修改
LoginUser loginUser = SecurityUtils.getLoginUser();
if (update) {
ServiceUtil.assertion(smDevice.getDeviceId() == null, "参数错误设备id不允许为空");
SmDeviceVo device = smDeviceMapper.selectSmDeviceByDeviceId(smDevice.getDeviceId());
ServiceUtil.assertion(device == null || device.getDeleted(), "设备" + smDevice.getDeviceId() + "不存在");
if (LoginType.FRONT.equals(loginUser.getLoginType())) {
ServiceUtil.assertion(!Objects.equals(device.getUserId(), loginUser.getUserId()), "这不是您的设备");
}
}
}
/**
* 批量删除设备
*
@ -544,6 +527,20 @@ public class SmDeviceServiceImpl implements ISmDeviceService
return device != null && device.getStoreId() != null;
}
/**
* 更新设备服务费
*
* @param userId
* @param serviceRate
*/
@Override
public int updateServiceRateByUserId(Long userId, BigDecimal serviceRate) {
if (userId == null) {
return 0;
}
return smDeviceMapper.updateServiceRateByUserId(userId, serviceRate);
}
/**
* ids查询列表
*

View File

@ -1,22 +1,18 @@
package com.ruoyi.ss.mchApply.domain;
import java.time.LocalDateTime;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonView;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.domain.JsonViewProfile;
import com.ruoyi.common.core.domain.ValidGroup;
import com.ruoyi.common.utils.RegexpUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
/**
* 商家合作申请对象 ss_mch_apply

View File

@ -1,11 +1,12 @@
package com.ruoyi.ss.mchApply.mapper;
import java.util.List;
import com.ruoyi.ss.mchApply.domain.MchApply;
import com.ruoyi.ss.mchApply.domain.MchApplyQuery;
import com.ruoyi.ss.mchApply.domain.MchApplyVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 商家合作申请Mapper接口
*

View File

@ -1,10 +1,11 @@
package com.ruoyi.ss.mchApply.service;
import java.util.List;
import com.ruoyi.ss.mchApply.domain.MchApply;
import com.ruoyi.ss.mchApply.domain.MchApplyQuery;
import com.ruoyi.ss.mchApply.domain.MchApplyVO;
import java.util.List;
/**
* 商家合作申请Service接口
*

View File

@ -1,21 +1,22 @@
package com.ruoyi.ss.mchApply.service.impl;
import java.time.LocalDateTime;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.ss.mchApply.domain.MchApply;
import com.ruoyi.ss.mchApply.domain.MchApplyQuery;
import com.ruoyi.ss.mchApply.domain.MchApplyVO;
import com.ruoyi.ss.mchApply.domain.enums.MchApplyStatus;
import com.ruoyi.ss.mchApply.mapper.MchApplyMapper;
import com.ruoyi.ss.mchApply.service.IMchApplyService;
import com.ruoyi.ss.user.service.ISmUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ss.mchApply.mapper.MchApplyMapper;
import com.ruoyi.ss.mchApply.domain.MchApply;
import com.ruoyi.ss.mchApply.service.IMchApplyService;
import org.springframework.transaction.support.TransactionTemplate;
import java.time.LocalDateTime;
import java.util.List;
/**
* 商家合作申请Service业务层处理
*

View File

@ -9,7 +9,6 @@ import com.ruoyi.ss.mchApply.domain.enums.MchApplyStatus;
import com.ruoyi.ss.mchApply.service.IMchApplyService;
import com.ruoyi.ss.mchApply.service.MchApplyValidator;
import com.ruoyi.ss.user.service.UserValidator;
import com.ruoyi.system.domain.enums.verificationCode.CodeBusinessType;
import com.ruoyi.system.service.IVerificationCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

View File

@ -2,6 +2,8 @@ package com.ruoyi.ss.meterReadingRecord.service;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.iot.domain.IotDeviceInfo;
import com.ruoyi.iot.service.IotService;
import com.ruoyi.ss.device.domain.SmDeviceQuery;
import com.ruoyi.ss.device.domain.vo.SmDeviceVo;
import com.ruoyi.ss.device.mapper.SmDeviceMapper;
@ -9,8 +11,6 @@ import com.ruoyi.ss.meterReadingRecord.domain.SmMeterReadingRecord;
import com.ruoyi.ss.meterReadingRecord.domain.SmMeterReadingRecordQuery;
import com.ruoyi.ss.meterReadingRecord.domain.SmMeterReadingRecordVo;
import com.ruoyi.ss.meterReadingRecord.mapper.SmMeterReadingRecordMapper;
import com.ruoyi.iot.domain.IotDeviceInfo;
import com.ruoyi.iot.service.IotService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

View File

@ -5,8 +5,6 @@ import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.domain.ValidGroup;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

View File

@ -9,13 +9,14 @@ import com.ruoyi.common.core.domain.ValidGroup;
import com.ruoyi.common.utils.RegexpUtils;
import com.ruoyi.common.valid.EnumValid;
import com.ruoyi.ss.store.domain.enums.StoreType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Range;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.time.LocalTime;

View File

@ -1,8 +1,4 @@
package com.ruoyi.ss.store.domain;
import java.math.BigDecimal;
import java.util.Date;
import java.time.LocalTime;
import com.google.common.collect.Maps;
import lombok.Data;

View File

@ -1,10 +1,8 @@
package com.ruoyi.ss.store.service;
import com.ruoyi.ss.store.domain.Store;
import com.ruoyi.ss.store.domain.StoreCountVO;
import com.ruoyi.ss.store.domain.StoreQuery;
import com.ruoyi.ss.store.domain.StoreVo;
import org.checkerframework.checker.units.qual.K;
import java.util.List;
import java.util.Map;

View File

@ -21,7 +21,6 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;

View File

@ -1,5 +1,6 @@
package com.ruoyi.ss.store.service.impl;
import com.ruoyi.common.utils.CollectionUtils;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ServiceUtil;
@ -17,10 +18,12 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.common.utils.CollectionUtils;
import org.springframework.transaction.support.TransactionTemplate;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -130,10 +133,22 @@ public class StoreServiceImpl implements IStoreService
@Override
public List<StoreVo> listCount(StoreQuery query) {
List<StoreVo> list = new ArrayList<>();
// 查询全部设备数据
SmDeviceQuery deviceDto = new SmDeviceQuery();
deviceDto.setUserId(query.getUserId());
int count = smDeviceService.selectCount(deviceDto);
StoreVo all = new StoreVo();
all.setDeviceCount(count);
all.setName("全部");
list.add(all);
// 查询各各店铺的设备数据
List<StoreVo> storeList = storeMapper.selectSmStoreList(query);
storeAssembler.assembleDeviceCount(storeList);
return storeList;
list.addAll(storeList);
return list;
}
@Override

View File

@ -1,22 +1,17 @@
package com.ruoyi.ss.suit.domain;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonView;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.domain.JsonViewProfile;
import com.ruoyi.common.core.domain.ValidGroup;
import com.ruoyi.ss.device.domain.DeviceView;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
/**
* 套餐对象 sm_suit

View File

@ -1,11 +1,8 @@
package com.ruoyi.ss.suit.domain;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* 2024/4/26
*
@ -16,4 +13,10 @@ public class SuitVo extends Suit {
@ApiModelProperty("设备名称")
private String deviceName;
@ApiModelProperty("店铺名称")
private String storeName;
@ApiModelProperty("用户名称")
private String userName;
}

View File

@ -1,11 +1,12 @@
package com.ruoyi.ss.suit.mapper;
import java.util.List;
import com.ruoyi.ss.suit.domain.Suit;
import com.ruoyi.ss.suit.domain.SuitQuery;
import com.ruoyi.ss.suit.domain.SuitVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 套餐Mapper接口
*

View File

@ -17,6 +17,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="deleted" column="deleted" />
<result property="deviceName" column="device_name" />
<result property="storeName" column="store_name" />
<result property="userName" column="user_name" />
</resultMap>
<sql id="selectSuitVo">
@ -32,9 +34,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ss.update_time,
ss.update_by,
ss.deleted,
sd.device_name as device_name
sd.device_name as device_name,
su.user_name as user_name,
store.name as store_name
from sm_suit ss
left join sm_device sd on sd.device_id = ss.device_id
left join sm_user su on su.user_id = sd.user_id
left join sm_store store on store.store_id = sd.store_id
</sql>
<sql id="searchCondition">

View File

@ -1,13 +1,13 @@
package com.ruoyi.ss.suit.service;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import com.ruoyi.ss.suit.domain.Suit;
import com.ruoyi.ss.suit.domain.SuitQuery;
import com.ruoyi.ss.suit.domain.SuitVo;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
/**
* 套餐Service接口
*

View File

@ -2,7 +2,6 @@ package com.ruoyi.ss.suit.service;
import com.ruoyi.common.core.domain.ValidateResult;
import com.ruoyi.ss.suit.domain.SuitBO;
import org.springframework.stereotype.Service;
import java.util.List;

View File

@ -1,21 +1,21 @@
package com.ruoyi.ss.suit.service.impl;
import com.ruoyi.common.utils.CollectionUtils;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.ss.suit.domain.Suit;
import com.ruoyi.ss.suit.domain.SuitQuery;
import com.ruoyi.ss.suit.domain.SuitVo;
import com.ruoyi.ss.suit.mapper.SuitMapper;
import com.ruoyi.ss.suit.service.ISuitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import com.ruoyi.common.utils.CollectionUtils;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.ss.suit.domain.SuitQuery;
import com.ruoyi.ss.suit.domain.SuitVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ss.suit.mapper.SuitMapper;
import com.ruoyi.ss.suit.domain.Suit;
import com.ruoyi.ss.suit.service.ISuitService;
/**
* 套餐Service业务层处理
*

View File

@ -2,6 +2,7 @@ package com.ruoyi.ss.suit.service.impl;
import com.ruoyi.common.core.domain.BaseValidator;
import com.ruoyi.common.core.domain.ValidateResult;
import com.ruoyi.common.utils.CollectionUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.ss.device.service.DeviceValidator;
import com.ruoyi.ss.suit.domain.SuitBO;
@ -10,7 +11,6 @@ import com.ruoyi.ss.suit.service.ISuitService;
import com.ruoyi.ss.suit.service.SuitValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.CollectionUtils;
import java.util.Collections;
import java.util.HashSet;

View File

@ -69,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="endDate != null"> and date(stb.create_time) &lt;= date(#{endDate}) </if>
<if test="deviceRechargeStatus != null"> and stb.device_recharge_status = #{deviceRechargeStatus} </if>
<if test="suitId != null"> and stb.suit_id = #{suitId} </if>
<if test="storeId != null"> and stb.store_id = #{storeId} </if>
<if test="deviceRechargeStatusList != null and deviceRechargeStatusList.size() > 0">
and stb.device_recharge_status in
<foreach item="item" collection="deviceRechargeStatusList" open="(" separator="," close=")">

View File

@ -2,12 +2,12 @@ package com.ruoyi.ss.transactionBill.service;
import com.ruoyi.ss.dashboard.BillCountVo;
import com.ruoyi.ss.transactionBill.domain.TransactionBill;
import com.ruoyi.ss.transactionBill.domain.bo.TransactionBillBO;
import com.ruoyi.ss.transactionBill.domain.TransactionBillQuery;
import com.ruoyi.ss.transactionBill.domain.TransactionBillVo;
import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillPayType;
import com.ruoyi.ss.transactionBill.domain.bo.TransactionBillBO;
import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillStatus;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -207,4 +207,12 @@ public interface TransactionBillService
* @param keyMapper 映射方法
*/
<K> Map<K, BillCountVo> selectCountMap(TransactionBillQuery query, Function<? super BillCountVo, ? extends K> keyMapper);
/**
* 获取服务费率
* @param deviceId
* @param channelId
* @return
*/
BigDecimal getServiceRate(Long deviceId, Long channelId);
}

View File

@ -17,9 +17,9 @@ import com.ruoyi.ss.store.service.IStoreService;
import com.ruoyi.ss.suit.domain.SuitVo;
import com.ruoyi.ss.suit.service.ISuitService;
import com.ruoyi.ss.transactionBill.domain.TransactionBill;
import com.ruoyi.ss.transactionBill.domain.bo.TransactionBillBO;
import com.ruoyi.ss.transactionBill.domain.TransactionBillQuery;
import com.ruoyi.ss.transactionBill.domain.TransactionBillVo;
import com.ruoyi.ss.transactionBill.domain.bo.TransactionBillBO;
import com.ruoyi.ss.transactionBill.domain.enums.*;
import com.ruoyi.ss.transactionBill.mapper.TransactionBillMapper;
import com.ruoyi.ss.transactionBill.service.TransactionBillService;
@ -40,7 +40,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.common.utils.CollectionUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
@ -241,7 +240,8 @@ public class TransactionBillServiceImpl implements TransactionBillService {
// 渠道价格计算
SmChannel channel = channelService.selectSmChannelByChannelId(order.getChannelId());
BigDecimal serviceCharge = channel.getServiceRate().multiply(order.getMoney()).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP); // 服务费
BigDecimal serviceRate = this.getServiceRate(order.getDeviceId(), order.getChannelId());
BigDecimal serviceCharge = serviceRate.multiply(order.getMoney()).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP); // 服务费
BigDecimal arrivalAmount = order.getMoney().subtract(serviceCharge); // 商户最终到账的金额 = 交易金额 - 服务费
order.setChannelCost(channel.getCostRate().multiply(order.getMoney()).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP));
order.setArrivalAmount(arrivalAmount);
@ -256,6 +256,36 @@ public class TransactionBillServiceImpl implements TransactionBillService {
return order;
}
/**
* 获取服务费率
* @param deviceId 设备ID
* @param channelId 支付渠道
*/
@Override
public BigDecimal getServiceRate(Long deviceId, Long channelId) {
SmDeviceVo device = deviceService.selectSmDeviceByDeviceId(deviceId);
if (device != null) {
// 如果设备有配置服务费率则返回设备服务费
if (device.getServiceRate() != null) {
return device.getServiceRate();
}
// 否则查询用户是否配置服务费率
if (device.getUserId() != null) {
SmUserVo user = userService.selectSimpleById(device.getUserId());
if (user != null && user.getServiceRate() != null) {
return user.getServiceRate();
}
}
}
// 返回渠道服务费
SmChannel channel = channelService.selectSmChannelByChannelId(channelId);
if (channel != null) {
return channel.getServiceRate();
}
return BigDecimal.ZERO;
}
@Override
@Transactional(rollbackFor = Exception.class)
public String addWithdraw(TransactionBillBO data) {

View File

@ -18,6 +18,7 @@ import com.ruoyi.ss.user.service.UserValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@ -98,6 +99,7 @@ public class TransactionBillValidatorImpl extends BaseValidator implements Trans
if (channel == null || channel.getEnabled() == null || !channel.getEnabled()) {
return error("不支持的支付方式");
}
return success();
}

View File

@ -1,4 +1,4 @@
package com.ruoyi.ss.user.domain;
package com.ruoyi.ss.user.domain.bo;
import com.ruoyi.common.core.domain.entity.SmUser;
import io.swagger.annotations.ApiModelProperty;

View File

@ -0,0 +1,30 @@
package com.ruoyi.ss.user.domain.bo;
import com.ruoyi.common.core.domain.ValidGroup;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* 更新用户服务费实体类
* @author wjh
* 2024/5/13
*/
@Data
public class UserUpdateServiceRateBO {
@ApiModelProperty("用户ID")
@NotNull(message = "用户ID不允许为空", groups = ValidGroup.Update.class)
private Long userId;
@ApiModelProperty("服务费费率")
@Range(min = 1, max = 100, message = "服务费费率范围1-100")
private BigDecimal serviceRate;
@ApiModelProperty("是否刷新用户所有设备的服务费")
private Boolean freshDevice;
}

View File

@ -98,4 +98,11 @@ public interface SmUserMapper
* @param amount 金额
*/
int subtractBalance(@Param("userId") Long userId, @Param("amount") BigDecimal amount);
/**
* 更新用户服务费
* @param userId
* @param serviceRate
*/
int updateServiceRate(@Param("userId") Long userId, @Param("serviceRate") BigDecimal serviceRate);
}

View File

@ -34,6 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="wxOpenId" column="wx_open_id" />
<result property="deleteTime" column="delete_time" />
<result property="isMch" column="is_mch" />
<result property="serviceRate" column="service_rate" />
</resultMap>
<sql id="selectSmUserVo">
@ -64,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
su.wx_open_id,
su.delete_time,
su.is_mch,
su.service_rate,
(select sum(stb.money) from sm_transaction_bill stb where stb.user_id = su.user_id and stb.type = '1' and stb.status = '2') as recharge_amount,
(select sum(stb.arrival_amount) from sm_transaction_bill stb where stb.user_id = su.user_id and stb.type = '2' and stb.status = '14') as with_drawl_amount,
(select sum(stb.arrival_amount) from sm_transaction_bill stb where stb.mch_id = su.user_id and stb.type = '1' and stb.status = '2') as total_income
@ -169,6 +171,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="wxOpenId != null">wx_open_id,</if>
<if test="deleteTime != null">delete_time,</if>
<if test="isMch != null">is_mch,</if>
<if test="serviceRate != null">service_rate,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userName != null and userName != ''">#{userName},</if>
@ -196,6 +199,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="wxOpenId != null">#{wxOpenId},</if>
<if test="deleteTime != null">#{deleteTime},</if>
<if test="isMch != null">#{isMch},</if>
<if test="serviceRate != null">#{serviceRate},</if>
</trim>
</insert>
@ -232,6 +236,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="wxOpenId != null">wx_open_id = #{wxOpenId},</if>
<if test="deleteTime != null">delete_time = #{deleteTime},</if>
<if test="isMch != null">is_mch = #{isMch},</if>
<if test="serviceRate != null">service_rate = #{serviceRate},</if>
</trim>
where user_id = #{userId}
</update>
@ -251,6 +256,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where user_id = #{userId} and del_flag = '0' and balance >= #{amount}
</update>
<update id="updateServiceRate">
update sm_user
set service_rate = #{serviceRate}
where user_id = #{userId} and del_flag = '0'
</update>
<delete id="deleteSmUserByUserId" parameterType="Long">
delete from sm_user where user_id = #{userId}
</delete>

View File

@ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.entity.SmUser;
import com.ruoyi.common.enums.UserType;
import com.ruoyi.ss.user.domain.SmUserQuery;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.bo.UserUpdateServiceRateBO;
import java.math.BigDecimal;
import java.util.List;
@ -162,4 +163,11 @@ public interface ISmUserService
* 将用户设置为商家
*/
int setMch(Long userId);
/**
* 更新用户服务费
* @param data
* @return
*/
int updateServiceRate(UserUpdateServiceRateBO data);
}

View File

@ -5,13 +5,16 @@ import com.ruoyi.common.enums.UserType;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.ss.device.service.ISmDeviceService;
import com.ruoyi.ss.user.domain.SmUserQuery;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.bo.UserUpdateServiceRateBO;
import com.ruoyi.ss.user.mapper.SmUserMapper;
import com.ruoyi.ss.user.service.ISmUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
@ -33,6 +36,12 @@ public class SmUserServiceImpl implements ISmUserService
@Autowired
private SmUserMapper smUserMapper;
@Autowired
private TransactionTemplate transactionTemplate;
@Autowired
private ISmDeviceService deviceService;
/**
* 查询普通用户信息
*
@ -210,6 +219,26 @@ public class SmUserServiceImpl implements ISmUserService
return smUserMapper.updateSmUser(user);
}
/**
* 更新用户服务费
*
* @param data
* @return
*/
@Override
public int updateServiceRate(UserUpdateServiceRateBO data) {
Integer result = transactionTemplate.execute(status -> {
// 更新用户服务费
int i = smUserMapper.updateServiceRate(data.getUserId(), data.getServiceRate());
// 若需要刷新设备服务费则一并更新设备服务费
if (i == 1 && data.getFreshDevice() != null && data.getFreshDevice()) {
deviceService.updateServiceRateByUserId(data.getUserId(), data.getServiceRate());
}
return i;
});
return result == null ? 0 : result;
}
/**
* 逻辑删除前校验
* @param userIds

View File

@ -6,8 +6,6 @@ import com.ruoyi.ss.device.domain.SmDeviceQuery;
import com.ruoyi.ss.device.domain.enums.DeviceGroupBy;
import com.ruoyi.ss.device.domain.enums.DeviceGroupByTable;
import com.ruoyi.ss.device.service.ISmDeviceService;
import com.ruoyi.ss.store.domain.StoreCountVO;
import com.ruoyi.ss.store.domain.StoreQuery;
import com.ruoyi.ss.store.service.IStoreService;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.service.UserAssembler;

View File

@ -3,7 +3,6 @@ package com.ruoyi.ss.user.service.impl;
import com.ruoyi.common.core.domain.BaseValidator;
import com.ruoyi.common.core.domain.ValidateResult;
import com.ruoyi.common.enums.UserStatus;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.ss.user.domain.SmUserQuery;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.service.ISmUserService;

View File

@ -45,7 +45,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**

View File

@ -3,13 +3,11 @@ package com.ruoyi.web.controller.app;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.ValidGroup;
import com.ruoyi.common.enums.UserType;
import com.ruoyi.ss.account.domain.SmAccountBO;
import com.ruoyi.ss.account.domain.SmAccountQuery;
import com.ruoyi.ss.account.service.ISmAccountService;
import com.ruoyi.system.service.IVerificationCodeService;
import com.ruoyi.web.core.annotation.MchRequired;
import com.ruoyi.web.core.annotation.UserTypePermission;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -0,0 +1,31 @@
package com.ruoyi.web.controller.app;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.ss.ad.domain.AdQuery;
import com.ruoyi.ss.ad.service.IAdService;
import com.ruoyi.ss.ad.service.impl.AdServiceImpl;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author wjh
* 2024/5/11
*/
@RestController
@RequestMapping("/app/ad")
public class AppAdController extends BaseController {
@Autowired
private IAdService adService;
@ApiOperation("获取广告")
@GetMapping
public AjaxResult getAd() {
return success(adService.selectOne(new AdQuery()));
}
}

View File

@ -5,12 +5,12 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.JsonViewProfile;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.ss.article.domain.enums.LicenceType;
import com.ruoyi.ss.articleClassify.domain.SmArticleClassifyQuery;
import com.ruoyi.ss.article.domain.SmArticleQuery;
import com.ruoyi.ss.article.domain.enums.LicenceType;
import com.ruoyi.ss.article.domain.enums.SystemClassify;
import com.ruoyi.ss.articleClassify.service.ISmArticleClassifyService;
import com.ruoyi.ss.article.service.ISmArticleService;
import com.ruoyi.ss.articleClassify.domain.SmArticleClassifyQuery;
import com.ruoyi.ss.articleClassify.service.ISmArticleClassifyService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
@ -65,5 +65,4 @@ public class AppArticleController extends BaseController {
return success(articleService.selectLicenceByType(licenceType));
}
}

View File

@ -4,7 +4,6 @@ import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.AppRegisterBody;
import com.ruoyi.common.core.domain.model.LoginBody;
import com.ruoyi.common.core.domain.model.WxLoginBody;
import com.ruoyi.common.enums.BusinessType;

View File

@ -7,11 +7,8 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
/**
* 系统配置接口
* @author wjh

View File

@ -10,24 +10,20 @@ import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.ss.device.domain.DeviceView;
import com.ruoyi.ss.device.domain.SmDevice;
import com.ruoyi.ss.device.domain.SmDeviceBO;
import com.ruoyi.ss.device.domain.SmDeviceQuery;
import com.ruoyi.ss.device.service.DeviceAssembler;
import com.ruoyi.ss.device.service.DeviceValidator;
import com.ruoyi.ss.meterReadingRecord.domain.SmMeterReadingRecordQuery;
import com.ruoyi.ss.device.domain.enums.DevicePowerStatus;
import com.ruoyi.ss.device.domain.vo.SmDeviceVo;
import com.ruoyi.ss.device.service.DeviceAssembler;
import com.ruoyi.ss.device.service.DeviceValidator;
import com.ruoyi.ss.device.service.ISmDeviceService;
import com.ruoyi.ss.meterReadingRecord.domain.SmMeterReadingRecordQuery;
import com.ruoyi.ss.meterReadingRecord.service.ISmMeterReadingRecordService;
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 com.ruoyi.web.core.annotation.MchRequired;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -54,30 +50,17 @@ public class AppDeviceController extends BaseController {
@Autowired
private DeviceAssembler deviceAssembler;
@Value("${debug}")
private Boolean debug;
@Autowired
private DeviceValidator deviceValidator;
@Autowired
private TransactionBillService transactionBillService;
/**
* 修改设备
*/
@MchRequired
@ApiOperation("商户修改设备")
@ApiOperation("商户修改设备信息")
@PutMapping
public AjaxResult edit(@RequestBody @Validated({ValidGroup.FrontUpdate.class}) SmDevice smDevice) {
SmDevice device = new SmDevice();
device.setDeviceId(smDevice.getDeviceId());
device.setStoreId(smDevice.getStoreId());
device.setRemark(smDevice.getRemark());
return toAjax(smDeviceService.updateSmDevice(device));
public AjaxResult edit(@RequestBody @Validated({ValidGroup.FrontUpdate.class}) SmDeviceBO data) {
data = data.filterUpdateByApp();
ServiceUtil.assertion(deviceValidator.preUpdateByApp(data));
return toAjax(smDeviceService.updateSmDevice(data));
}
@MchRequired
@ApiOperation("查询商户设备列表")
@GetMapping("/list")
public TableDataInfo list(SmDeviceQuery smDevice) {
@ -97,10 +80,6 @@ public class AppDeviceController extends BaseController {
return getDataTable(list);
}
/**
* 获取设备详细信息
*/
@MchRequired
@ApiOperation("获取设备详细信息")
@GetMapping(value = "/{deviceId}")
public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId) {

View File

@ -4,17 +4,17 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.ValidGroup;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.ss.mchApply.domain.MchApply;
import com.ruoyi.ss.mchApply.domain.MchApplyBO;
import com.ruoyi.ss.mchApply.domain.MchApplyQuery;
import com.ruoyi.ss.mchApply.service.IMchApplyService;
import com.ruoyi.ss.mchApply.service.MchApplyValidator;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author wjh

View File

@ -2,11 +2,9 @@ package com.ruoyi.web.controller.app;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.UserType;
import com.ruoyi.ss.resetRecord.domain.SmResetRecordQuery;
import com.ruoyi.ss.resetRecord.service.ISmResetRecordService;
import com.ruoyi.web.core.annotation.MchRequired;
import com.ruoyi.web.core.annotation.UserTypePermission;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;

View File

@ -8,14 +8,12 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.JsonViewProfile;
import com.ruoyi.common.core.domain.ValidGroup;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.UserType;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.ss.store.domain.*;
import com.ruoyi.ss.store.service.IStoreService;
import com.ruoyi.ss.store.service.StoreAssembler;
import com.ruoyi.ss.store.service.StoreValidator;
import com.ruoyi.web.core.annotation.MchRequired;
import com.ruoyi.web.core.annotation.UserTypePermission;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

View File

@ -5,7 +5,6 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.JsonViewProfile;
import com.ruoyi.common.core.domain.ValidGroup;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.ss.device.service.DeviceValidator;
import com.ruoyi.ss.suit.domain.SuitBO;

View File

@ -6,23 +6,21 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.JsonViewProfile;
import com.ruoyi.common.core.domain.ValidGroup;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.UserType;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.ss.dashboard.BillCountVo;
import com.ruoyi.ss.device.service.DeviceValidator;
import com.ruoyi.ss.transactionBill.domain.TransactionBill;
import com.ruoyi.ss.transactionBill.domain.TransactionBillQuery;
import com.ruoyi.ss.transactionBill.domain.TransactionBillVo;
import com.ruoyi.ss.transactionBill.domain.bo.TransactionBillBO;
import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillGroupBy;
import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillStatus;
import com.ruoyi.ss.transactionBill.domain.enums.TransactionBillType;
import com.ruoyi.ss.transactionBill.domain.TransactionBillVo;
import com.ruoyi.ss.dashboard.BillCountVo;
import com.ruoyi.ss.transactionBill.service.TransactionBillService;
import com.ruoyi.ss.transactionBill.service.TransactionAssembler;
import com.ruoyi.ss.transactionBill.service.TransactionBillService;
import com.ruoyi.ss.transactionBill.service.TransactionBillValidator;
import com.ruoyi.web.core.annotation.MchRequired;
import com.ruoyi.web.core.annotation.UserTypePermission;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -31,7 +29,6 @@ import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.Date;
import java.util.List;

View File

@ -6,16 +6,19 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.JsonViewProfile;
import com.ruoyi.common.enums.UserType;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.ss.user.domain.SmUserBO;
import com.ruoyi.ss.user.service.UserAssembler;
import com.ruoyi.system.domain.enums.verificationCode.CodeBusinessType;
import com.ruoyi.ss.user.domain.bo.SmUserBO;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.service.ISmUserService;
import com.ruoyi.ss.user.service.UserAssembler;
import com.ruoyi.system.domain.enums.verificationCode.CodeBusinessType;
import com.ruoyi.system.service.IVerificationCodeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Collections;
import java.util.List;

View File

@ -0,0 +1,108 @@
package com.ruoyi.web.controller.ss;
import java.util.Arrays;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.ss.ad.domain.AdQuery;
import com.ruoyi.ss.ad.domain.AdVO;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.ss.ad.domain.Ad;
import com.ruoyi.ss.ad.service.IAdService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 广告Controller
*
* @author ruoyi
* @date 2024-05-11
*/
@RestController
@RequestMapping("/ss/ad")
public class AdController extends BaseController
{
@Autowired
private IAdService adService;
/**
* 查询广告列表
*/
@PreAuthorize("@ss.hasPermi('ss:ad:list')")
@GetMapping("/list")
public TableDataInfo list(AdQuery ad)
{
startPage();
List<AdVO> list = adService.selectAdList(ad);
return getDataTable(list);
}
/**
* 导出广告列表
*/
@PreAuthorize("@ss.hasPermi('ss:ad:export')")
@Log(title = "广告", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, AdQuery ad)
{
List<AdVO> list = adService.selectAdList(ad);
ExcelUtil<AdVO> util = new ExcelUtil<AdVO>(AdVO.class);
util.exportExcel(response, list, "广告数据");
}
/**
* 获取广告详细信息
*/
@PreAuthorize("@ss.hasPermi('ss:ad:query')")
@GetMapping(value = "/{adId}")
public AjaxResult getInfo(@PathVariable("adId") Long adId)
{
return success(adService.selectAdByAdId(adId));
}
/**
* 新增广告
*/
@PreAuthorize("@ss.hasPermi('ss:ad:add')")
@Log(title = "广告", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Ad ad)
{
return toAjax(adService.insertAd(ad));
}
/**
* 修改广告
*/
@PreAuthorize("@ss.hasPermi('ss:ad:edit')")
@Log(title = "广告", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Ad ad)
{
return toAjax(adService.updateAd(ad));
}
/**
* 删除广告
*/
@PreAuthorize("@ss.hasPermi('ss:ad:remove')")
@Log(title = "广告", businessType = BusinessType.DELETE)
@DeleteMapping("/{adIds}")
public AjaxResult remove(@PathVariable Long[] adIds)
{
return toAjax(adService.logicDel(Arrays.asList(adIds)));
}
}

View File

@ -6,9 +6,12 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.ValidGroup;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.ss.device.domain.SmDeviceBO;
import com.ruoyi.ss.device.service.DeviceAssembler;
import com.ruoyi.ss.device.domain.SmDeviceQuery;
import com.ruoyi.ss.device.domain.vo.SmDeviceVo;
import com.ruoyi.ss.device.service.DeviceValidator;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.security.access.prepost.PreAuthorize;
@ -45,7 +48,7 @@ public class SmDeviceController extends BaseController
private ISmDeviceService smDeviceService;
@Autowired
private DeviceAssembler deviceAssembler;
private DeviceValidator deviceValidator;
/**
* 查询设备列表
@ -100,9 +103,11 @@ public class SmDeviceController extends BaseController
@PreAuthorize("@ss.hasPermi('system:device:add')")
@Log(title = "设备", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody @Validated({ValidGroup.Create.class}) SmDevice smDevice)
public AjaxResult add(@RequestBody @Validated({ValidGroup.Create.class}) SmDeviceBO data)
{
return toAjax(smDeviceService.insertSmDevice(smDevice));
data = data.filterCreate();
ServiceUtil.assertion(deviceValidator.preCreate(data));
return toAjax(smDeviceService.insertSmDevice(data));
}
/**
@ -111,9 +116,11 @@ public class SmDeviceController extends BaseController
@PreAuthorize("@ss.hasPermi('system:device:edit')")
@Log(title = "设备", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody @Validated({ValidGroup.Update.class}) SmDevice smDevice)
public AjaxResult edit(@RequestBody @Validated({ValidGroup.Update.class}) SmDeviceBO data)
{
return toAjax(smDeviceService.updateSmDevice(smDevice));
data = data.filterUpdate();
ServiceUtil.assertion(deviceValidator.preUpdate(data));
return toAjax(smDeviceService.updateSmDevice(data));
}
/**

View File

@ -5,11 +5,16 @@ import java.util.Collections;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.ValidGroup;
import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.ss.user.domain.SmUserQuery;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.bo.UserUpdateServiceRateBO;
import com.ruoyi.ss.user.service.UserAssembler;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
@ -117,6 +122,15 @@ public class SmUserController extends BaseController
return toAjax(smUserService.updateSmUser(smUser));
}
@ApiOperation("修改用户服务费")
@PreAuthorize("@ss.hasPermi('system:smUser:edit')")
@Log(title = "普通用户信息", businessType = BusinessType.UPDATE)
@PutMapping("/updateServiceRate")
public AjaxResult updateServiceRate(@RequestBody @Validated(ValidGroup.Update.class) UserUpdateServiceRateBO data)
{
return toAjax(smUserService.updateServiceRate(data));
}
/**
* 删除普通用户信息
*/

View File

@ -1,6 +1,7 @@
package com.ruoyi.web.controller.ss;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
@ -9,6 +10,7 @@ import com.ruoyi.common.utils.ServiceUtil;
import com.ruoyi.ss.store.domain.StoreBO;
import com.ruoyi.ss.store.domain.StoreQuery;
import com.ruoyi.ss.store.domain.StoreVo;
import com.ruoyi.ss.store.service.StoreAssembler;
import com.ruoyi.ss.store.service.StoreValidator;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
@ -46,6 +48,9 @@ public class StoreController extends BaseController
@Autowired
private StoreValidator storeValidator;
@Autowired
private StoreAssembler storeAssembler;
/**
* 查询商户列表
*/
@ -89,7 +94,11 @@ public class StoreController extends BaseController
@GetMapping(value = "/{storeId}")
public AjaxResult getInfo(@PathVariable("storeId") Long storeId)
{
return success(storeService.selectSmStoreById(storeId));
StoreVo store = storeService.selectSmStoreById(storeId);
List<StoreVo> list = Collections.singletonList(store);
storeAssembler.assembleDeviceCount(list); // 设备数量
storeAssembler.assembleRevenue(list); // 经营数据
return success(store);
}
/**